aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-10-04 00:03:54 +0100
committerIain Sandoe <iain@sandoe.co.uk>2020-10-11 14:28:53 +0100
commit67f984d62e3acd729e086d49780be8e3e5e69833 (patch)
tree981332f097cb4bbb14540472c4642a7943a5a8e8 /gcc
parent8703bf5d31fdb4789b5eddca394f8e92a0c55801 (diff)
downloadgcc-67f984d62e3acd729e086d49780be8e3e5e69833.zip
gcc-67f984d62e3acd729e086d49780be8e3e5e69833.tar.gz
gcc-67f984d62e3acd729e086d49780be8e3e5e69833.tar.bz2
testsuite, Objective-C : Compatibility fixes.
Changes to deal with warnings and/or errors seen when compiling the tests with clang. gcc/testsuite/ChangeLog: * objc-obj-c++-shared/TestsuiteObject.h: If the compiler supports objc_root_object attributes, then mark the testsuite object accordingly. * objc-obj-c++-shared/TestsuiteObject.m: Avoid direct access to isa, which is an error for modern Objective-C. * objc/execute/class-tests-1.h: Declare a string function we use locally (avoid pulling in the whole of string.h).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h3
-rw-r--r--gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m2
-rw-r--r--gcc/testsuite/objc/execute/class-tests-1.h2
3 files changed, 6 insertions, 1 deletions
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
index 66b68c8..0f139bc 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
@@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. If not see
/* We use this root class instead of Object to keep the tests
independent of the runtime being used. Keep it simple. */
+#if defined(__has_attribute) && __has_attribute(objc_root_class)
+__attribute__((objc_root_class))
+#endif
@interface TestsuiteObject
{
Class isa;
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
index 6bbe7d4..703827f 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
@@ -64,6 +64,6 @@ along with GCC; see the file COPYING3. If not see
}
- (const char *)name
{
- return class_getName (isa);
+ return object_getClassName (self);
}
@end
diff --git a/gcc/testsuite/objc/execute/class-tests-1.h b/gcc/testsuite/objc/execute/class-tests-1.h
index cfdd72b..65f1f70 100644
--- a/gcc/testsuite/objc/execute/class-tests-1.h
+++ b/gcc/testsuite/objc/execute/class-tests-1.h
@@ -4,6 +4,8 @@
#include <stdlib.h>
#include "../../objc-obj-c++-shared/runtime.h"
+extern int strcmp(const char *, const char *);
+
/*
* Standard Tests For Classes and Objects - abort upon failing; return
* normally if all is well.