testsuite, Objective-C : Adjust gnu-api tests for Darwin.
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 5 Oct 2020 10:36:36 +0000 (11:36 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 11 Oct 2020 13:57:35 +0000 (14:57 +0100)
The GNU v2 API matches the next v2 API in most respects.

However, some of the tests depend on access to items that the
later NeXT headers consider to be 'internal implementation details'
and are not exposed (we arrange that with a DEFINE).

One test is skipped here because, although it works internally, the
number of objects returned is larger for the NeXT runtime in some
cases (where the headers have been updated to bring in more of the
system details).

gcc/testsuite/ChangeLog:

* objc.dg/gnu-api-2-class-meta.m: Add a flag to cause NeXT
headers to expose prototypes for messaging. Mark the root
class if the objc_root_class attribute is available. Use
char ** as the second arg to main.
* objc.dg/gnu-api-2-class.m: Use dispatch prototype.
* objc.dg/gnu-api-2-objc.m: Skip on NeXT because of extra
prototypes pulled in by headers.

gcc/testsuite/objc.dg/gnu-api-2-class-meta.m
gcc/testsuite/objc.dg/gnu-api-2-class.m
gcc/testsuite/objc.dg/gnu-api-2-objc.m

index 07e0ba2..3a85b16 100644 (file)
@@ -20,6 +20,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
@@ -28,6 +29,9 @@
 #include <stdio.h>
 #include <string.h>
 
+#if __has_attribute(objc_root_class)
+__attribute__((objc_root_class))
+#endif
 @interface MyRootClass
 { Class isa; }
 + alloc;
@@ -65,7 +69,7 @@ static id static_variable = nil;
 + (id) mySelf;
 @end
 
-int main(int argc, void **args)
+int main(int argc, char **args)
 {
   /* Functions are tested in alphabetical order.  */
 
index 3419529..eade0dc 100644 (file)
@@ -7,6 +7,7 @@
 /* { dg-do run } */
 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
index d65c120..1b4ce8e 100644 (file)
@@ -3,8 +3,12 @@
   This is test 'objc', covering all functions starting with 'objc'.  */
 
 /* { dg-do run } */
-/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
-/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* Although this works with the NeXT runtime in a sub-set of cases, some
+   versions of the runtime header pulls in a number of system protocols,
+   which causes the objc_copyProtocolList test to fail (in addition to those
+   systems that don't have the V2 APis).  XFAILing the run is not useful
+   since it will XPASS on the sub-set that works.  */
+/* { dg-skip-if "Incompatible" { *-*-darwin* } { "-fnext-runtime" } { "" } } */
 
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */