[pushed] testsuite, Objective-c++ : Fix GNU API tests to work with NeXT where possible.

Message ID 395AE936-9226-41F1-80F9-8B2835677435@sandoe.co.uk
State New
Headers show
Series
  • [pushed] testsuite, Objective-c++ : Fix GNU API tests to work with NeXT where possible.
Related show

Commit Message

Iain Sandoe Oct. 11, 2020, 3:29 p.m.
Hi

(Darwin tests both GNU and NeXT runtimes).

The version 2 GNU Objective C API is mostly compatible with the NeXT one.
However, there are a few testsuite tweaks needed (and one test fails for NeXT
without considerable increase in complexity).

tested across the Darwin range, and on x86_64-linux
pushed to master
thanks
Iain

gcc/testsuite/ChangeLog:

	* obj-c++.dg/gnu-api-2-class-meta.mm: Add a flag to cause NeXT
	headers to expose prototypes for messaging.
	* obj-c++.dg/gnu-api-2-class.mm: Likewise.
	* obj-c++.dg/gnu-api-2-objc.mm: Skip this because of the extra
	protocols pulled in by system headers.
---
 gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm | 1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm      | 1 +
 gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm       | 8 ++++++--
 3 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.24.1

Patch

diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
index 7806d6faa36..bdaef9828ca 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
@@ -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.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
index 9a7c092f3b2..ae39026c2d3 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
@@ -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.  */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
index e5b1a69ed04..201ab7e7af2 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
@@ -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.  */