From e3b8c2aeeebbb6e86d1b1b1499cf837d96856c46 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 15 Jun 2019 14:00:24 +0000 Subject: [PATCH] [objective-c/c++, testsuite, 2/3] Workaround for PR90709. Use the CF-CFString.h, F-NS*.h proxy headers where needed in the objective-c testsuite. Make minor adjustments to tests as required, providing that those do not alter the test intent. 2019-06-15 Iain Sandoe PR objc/90709 * objc.dg/encode-7-next-64bit.m: Use proxy headers. * objc.dg/image-info.m: Likewise. * objc.dg/method-6.m: Likewise. * objc.dg/no-extra-load.m: Likewise. * objc.dg/objc-foreach-4.m: Likewise. * objc.dg/objc-foreach-5.m: Likewise. * objc.dg/proto-lossage-7.m: Likewise. * objc.dg/strings/const-cfstring-2.m: Likewise. * objc.dg/strings/const-cfstring-5.m: Likewise. * objc.dg/strings/const-str-12b.m: Likewise. * objc.dg/symtab-1.m: Likewise. * objc.dg/torture/strings/const-cfstring-1.m: Likewise. * objc.dg/torture/strings/const-str-10.m: Likewise. * objc.dg/torture/strings/const-str-11.m: Likewise. * objc.dg/torture/strings/const-str-9.m: Likewise. * objc.dg/zero-link-1.m: Likewise. * objc.dg/zero-link-2.m: Likewise. * objc.dg/zero-link-3.m: Likewise. * objc.dg/isa-field-1.m: Suppress unwanted warning, add comment why. * objc.dg/headers.m: XFAIL for Darwin14-19. * objc.dg/objc-gc-4.m: Skip for Darwin > 16, the API use is an error there. From-SVN: r272326 --- gcc/testsuite/ChangeLog | 26 +++++++++++++++++++ gcc/testsuite/objc.dg/encode-7-next-64bit.m | 5 ++-- gcc/testsuite/objc.dg/headers.m | 1 + gcc/testsuite/objc.dg/image-info.m | 2 +- gcc/testsuite/objc.dg/isa-field-1.m | 2 ++ gcc/testsuite/objc.dg/method-6.m | 10 +++---- gcc/testsuite/objc.dg/no-extra-load.m | 2 +- gcc/testsuite/objc.dg/objc-foreach-4.m | 6 ++--- gcc/testsuite/objc.dg/objc-foreach-5.m | 5 ++-- gcc/testsuite/objc.dg/objc-gc-4.m | 1 + gcc/testsuite/objc.dg/proto-lossage-7.m | 2 +- .../objc.dg/strings/const-cfstring-2.m | 4 +-- .../objc.dg/strings/const-cfstring-5.m | 2 +- gcc/testsuite/objc.dg/strings/const-str-12b.m | 8 +++--- gcc/testsuite/objc.dg/symtab-1.m | 2 +- .../torture/strings/const-cfstring-1.m | 4 +-- .../objc.dg/torture/strings/const-str-10.m | 3 ++- .../objc.dg/torture/strings/const-str-11.m | 2 +- .../objc.dg/torture/strings/const-str-9.m | 2 +- gcc/testsuite/objc.dg/zero-link-1.m | 2 +- gcc/testsuite/objc.dg/zero-link-2.m | 2 +- gcc/testsuite/objc.dg/zero-link-3.m | 10 +++---- 22 files changed, 68 insertions(+), 35 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f8a1084c4aa..9b2dcf0d7e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,29 @@ +2019-06-15 Iain Sandoe + + PR objc/90709 + * objc.dg/encode-7-next-64bit.m: Use proxy headers. + * objc.dg/image-info.m: Likewise. + * objc.dg/method-6.m: Likewise. + * objc.dg/no-extra-load.m: Likewise. + * objc.dg/objc-foreach-4.m: Likewise. + * objc.dg/objc-foreach-5.m: Likewise. + * objc.dg/proto-lossage-7.m: Likewise. + * objc.dg/strings/const-cfstring-2.m: Likewise. + * objc.dg/strings/const-cfstring-5.m: Likewise. + * objc.dg/strings/const-str-12b.m: Likewise. + * objc.dg/symtab-1.m: Likewise. + * objc.dg/torture/strings/const-cfstring-1.m: Likewise. + * objc.dg/torture/strings/const-str-10.m: Likewise. + * objc.dg/torture/strings/const-str-11.m: Likewise. + * objc.dg/torture/strings/const-str-9.m: Likewise. + * objc.dg/zero-link-1.m: Likewise. + * objc.dg/zero-link-2.m: Likewise. + * objc.dg/zero-link-3.m: Likewise. + * objc.dg/isa-field-1.m: Suppress unwanted warning, add comment why. + * objc.dg/headers.m: XFAIL for Darwin14-19. + * objc.dg/objc-gc-4.m: Skip for Darwin > 16, the API use is an error + there. + 2019-06-15 Iain Sandoe PR objc/90709 diff --git a/gcc/testsuite/objc.dg/encode-7-next-64bit.m b/gcc/testsuite/objc.dg/encode-7-next-64bit.m index 4a418fc92b1..5686cb4c537 100644 --- a/gcc/testsuite/objc.dg/encode-7-next-64bit.m +++ b/gcc/testsuite/objc.dg/encode-7-next-64bit.m @@ -9,10 +9,11 @@ #include #include #include -#include +#include +#include "../objc-obj-c++-shared/F-NSObject.h" +#include "../objc-obj-c++-shared/CF-CFString.h" #include "../objc-obj-c++-shared/runtime.h" -extern int printf(char *,...); void CHECK_IF(const char *s1, const char *s2) { if (strcmp(s1,s2) != 0) { diff --git a/gcc/testsuite/objc.dg/headers.m b/gcc/testsuite/objc.dg/headers.m index 355c2cf3c60..e628199f0cc 100644 --- a/gcc/testsuite/objc.dg/headers.m +++ b/gcc/testsuite/objc.dg/headers.m @@ -2,6 +2,7 @@ // test in libstdc++-v3). Author: Loren J. Rittle . // { dg-options "-Wall -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wshadow" } // { dg-do compile } +/* { dg-xfail-if "PR90709" { *-*-darwin1[4-9]* } { "-fnext-runtime" } { "" } } */ #ifdef __NEXT_RUNTIME__ #include diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 09329130a73..b2effe5dc86 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -7,7 +7,7 @@ /* { dg-skip-if "NeXT-only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-freplace-objc-classes" } */ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/isa-field-1.m b/gcc/testsuite/objc.dg/isa-field-1.m index 4501d01a11e..a786ec3deb5 100644 --- a/gcc/testsuite/objc.dg/isa-field-1.m +++ b/gcc/testsuite/objc.dg/isa-field-1.m @@ -1,5 +1,7 @@ /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects. */ /* { dg-do compile } */ +/* The use of isa is deprecated, but we still want to test that it works. */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include "../objc-obj-c++-shared/TestsuiteObject.h" #include "../objc-obj-c++-shared/runtime.h" diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m index 3ff73e0e9ca..7d3b11c5c75 100644 --- a/gcc/testsuite/objc.dg/method-6.m +++ b/gcc/testsuite/objc.dg/method-6.m @@ -5,12 +5,12 @@ /* { dg-options "-Wstrict-selector-match" } */ #ifdef __NEXT_RUNTIME__ -#include -#define OBJECT NSObject +# include "../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include -#include -#define OBJECT Object +# include +# include +# define OBJECT Object #endif @interface Base diff --git a/gcc/testsuite/objc.dg/no-extra-load.m b/gcc/testsuite/objc.dg/no-extra-load.m index f5e1d74563d..35bd1daf661 100644 --- a/gcc/testsuite/objc.dg/no-extra-load.m +++ b/gcc/testsuite/objc.dg/no-extra-load.m @@ -1,7 +1,7 @@ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" main() { [NSObject new]; } /* { dg-final { scan-assembler-not "L_objc_msgSend\\\$non_lazy_ptr" } } */ diff --git a/gcc/testsuite/objc.dg/objc-foreach-4.m b/gcc/testsuite/objc.dg/objc-foreach-4.m index 4d902f55882..c8dc074b267 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-4.m +++ b/gcc/testsuite/objc.dg/objc-foreach-4.m @@ -5,9 +5,9 @@ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#include -#include -#include +#include "../objc-obj-c++-shared/F-NSString.h" +#include "../objc-obj-c++-shared/F-NSAutoreleasePool.h" +#include "../objc-obj-c++-shared/F-NSArray.h" // gcc -o foo foo.m -framework Foundation diff --git a/gcc/testsuite/objc.dg/objc-foreach-5.m b/gcc/testsuite/objc.dg/objc-foreach-5.m index 7113a7ac262..e02bd7aa06d 100644 --- a/gcc/testsuite/objc.dg/objc-foreach-5.m +++ b/gcc/testsuite/objc.dg/objc-foreach-5.m @@ -4,8 +4,9 @@ /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */ -#include -#include +#include "../objc-obj-c++-shared/F-NSArray.h" +#include "../objc-obj-c++-shared/F-NSAutoreleasePool.h" +#include "../objc-obj-c++-shared/F-NSValue.h" NSArray * createTestVictim(unsigned capacity) { NSMutableArray * arr = [[NSMutableArray alloc] initWithCapacity:capacity]; diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m index 747da4d5199..96c32788dfe 100644 --- a/gcc/testsuite/objc.dg/objc-gc-4.m +++ b/gcc/testsuite/objc.dg/objc-gc-4.m @@ -3,6 +3,7 @@ /* Contributed by Ziemowit Laski */ /* { dg-do compile } */ +/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */ /* { dg-options "-fobjc-gc" } */ /* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */ diff --git a/gcc/testsuite/objc.dg/proto-lossage-7.m b/gcc/testsuite/objc.dg/proto-lossage-7.m index b32cfd8a0dd..118a130fd9e 100644 --- a/gcc/testsuite/objc.dg/proto-lossage-7.m +++ b/gcc/testsuite/objc.dg/proto-lossage-7.m @@ -3,7 +3,7 @@ /* { dg-do compile } */ #ifdef __NEXT_RUNTIME__ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" #define OBJECT NSObject #else #include diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-2.m b/gcc/testsuite/objc.dg/strings/const-cfstring-2.m index 14ae68c6c50..effe7f57bdc 100644 --- a/gcc/testsuite/objc.dg/strings/const-cfstring-2.m +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-2.m @@ -8,8 +8,8 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings -Wnonportable-cfstrings" } */ -#import -#import +#include "../../objc-obj-c++-shared/F-NSString.h" +#include "../../objc-obj-c++-shared/CF-CFString.h" #ifndef __CONSTANT_CFSTRINGS__ #error The -fconstant-cfstrings option is not functioning properly diff --git a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m index 98bb7c5bddc..762afb6b1ba 100644 --- a/gcc/testsuite/objc.dg/strings/const-cfstring-5.m +++ b/gcc/testsuite/objc.dg/strings/const-cfstring-5.m @@ -6,7 +6,7 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include +#include "../../objc-obj-c++-shared/F-NSObject.h" @interface Foo: NSObject { char *cString; diff --git a/gcc/testsuite/objc.dg/strings/const-str-12b.m b/gcc/testsuite/objc.dg/strings/const-str-12b.m index d0dfb668ea9..e04f0f66660 100644 --- a/gcc/testsuite/objc.dg/strings/const-str-12b.m +++ b/gcc/testsuite/objc.dg/strings/const-str-12b.m @@ -6,11 +6,11 @@ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ #ifdef __NEXT_RUNTIME__ -#include -#define OBJECT NSObject +# include "../../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include -#define OBJECT Object +# include +# define OBJECT Object #endif #include "../../objc-obj-c++-shared/objc-test-suite-types.h" diff --git a/gcc/testsuite/objc.dg/symtab-1.m b/gcc/testsuite/objc.dg/symtab-1.m index 04d747dbce1..e6e0b613923 100644 --- a/gcc/testsuite/objc.dg/symtab-1.m +++ b/gcc/testsuite/objc.dg/symtab-1.m @@ -4,7 +4,7 @@ /* { dg-do compile { target { *-*-darwin* } } } */ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" @interface Base: NSObject - (void)setValues; diff --git a/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m b/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m index 7e989156419..a9c0ab666f1 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-cfstring-1.m @@ -13,8 +13,8 @@ Well, we don't implement writable ones at this juncture. */ /* { dg-options "-mconstant-cfstrings -framework Cocoa -Wl,-w" { target *-*-darwin[123]* } } */ -#import -#import +#include "../../../objc-obj-c++-shared/F-NSString.h" +#include "../../../objc-obj-c++-shared/CF-CFString.h" #include void printOut(NSString *str) { diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m index 120bcd94c7b..6565dc20007 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -6,7 +6,8 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include "../../../objc-obj-c++-shared/F-NSObject.h" +#include #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSString: NSObject diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m index 4c3f9eac893..2bdb1531e1d 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -7,7 +7,7 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface XString: NSObject { diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m index d65aa01c044..966ea5e498d 100644 --- a/gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ b/gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include +#include "../../../objc-obj-c++-shared/F-NSObject.h" #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ @interface NSConstantString: NSObject { diff --git a/gcc/testsuite/objc.dg/zero-link-1.m b/gcc/testsuite/objc.dg/zero-link-1.m index 812267bc376..e1148deb4a7 100644 --- a/gcc/testsuite/objc.dg/zero-link-1.m +++ b/gcc/testsuite/objc.dg/zero-link-1.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fzero-link" } */ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-2.m b/gcc/testsuite/objc.dg/zero-link-2.m index 3bfe84d021d..19100919b3c 100644 --- a/gcc/testsuite/objc.dg/zero-link-2.m +++ b/gcc/testsuite/objc.dg/zero-link-2.m @@ -5,7 +5,7 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-fno-zero-link" } */ -#include +#include "../objc-obj-c++-shared/F-NSObject.h" extern void abort(void); #define CHECK_IF(expr) if(!(expr)) abort(); diff --git a/gcc/testsuite/objc.dg/zero-link-3.m b/gcc/testsuite/objc.dg/zero-link-3.m index 18f21db4e65..0c77c095d4d 100644 --- a/gcc/testsuite/objc.dg/zero-link-3.m +++ b/gcc/testsuite/objc.dg/zero-link-3.m @@ -7,12 +7,12 @@ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ #ifdef __NEXT_RUNTIME__ -#include -#define OBJECT NSObject +# include "../objc-obj-c++-shared/F-NSObject.h" +# define OBJECT NSObject #else -#include -#include -#define OBJECT Object +# include +# include +# define OBJECT Object #endif extern void abort(void); -- 2.30.2