[objective-c/c++, testsuite, 3/3] Workaround for PR90709.
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 15 Jun 2019 14:03:44 +0000 (14:03 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Sat, 15 Jun 2019 14:03:44 +0000 (14:03 +0000)
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  <iain@sandoe.co.uk>

PR objc/90709
* obj-c++.dg/proto-lossage-7.mm: Use proxy headers.
* obj-c++.dg/strings/const-cfstring-2.mm: Likewise.
* obj-c++.dg/strings/const-cfstring-5.mm: Likewise
* obj-c++.dg/strings/const-str-12.mm: Likewise.
* obj-c++.dg/syntax-error-1.mm: Likewise.
* obj-c++.dg/torture/strings/const-cfstring-1.mm: Likewise.
* obj-c++.dg/torture/strings/const-str-10.mm: Likewise.
* obj-c++.dg/torture/strings/const-str-11.mm: Likewise.
* obj-c++.dg/torture/strings/const-str-9.mm: Likewise.
* obj-c++.dg/cxx-ivars-3.mm: Skip on later Darwin, where the 10.4 API
in no longer supported, also on m64 where there's no meaning to it.
* obj-c++.dg/isa-field-1.mm: Suppress unwanted warning, add comment why.
* obj-c++.dg/objc-gc-3.mm: Skip for Darwin > 16, the API use is an error
there.
* obj-c++.dg/qual-types-1.mm: Prune a spurious l64 warning.
* obj-c++.dg/stubify-1.mm: Tidy up after better compiler warnings.
* obj-c++.dg/stubify-2.mm: Likewise.
* obj-c++.dg/try-catch-1.mm: Likewise.
* obj-c++.dg/try-catch-3.mm: Likewise.

From-SVN: r272327

18 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
gcc/testsuite/obj-c++.dg/isa-field-1.mm
gcc/testsuite/obj-c++.dg/objc-gc-3.mm
gcc/testsuite/obj-c++.dg/proto-lossage-7.mm
gcc/testsuite/obj-c++.dg/qual-types-1.mm
gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm
gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm
gcc/testsuite/obj-c++.dg/strings/const-str-12.mm
gcc/testsuite/obj-c++.dg/stubify-1.mm
gcc/testsuite/obj-c++.dg/stubify-2.mm
gcc/testsuite/obj-c++.dg/syntax-error-1.mm
gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-1.mm
gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm
gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm
gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm
gcc/testsuite/obj-c++.dg/try-catch-1.mm
gcc/testsuite/obj-c++.dg/try-catch-3.mm

index 9b2dcf0d7e5039f00b064ef24c642210d81e58a0..7efcfd9b3f91b36b9c8948c507fd114d08096472 100644 (file)
@@ -1,3 +1,26 @@
+2019-06-15  Iain Sandoe  <iain@sandoe.co.uk>
+
+       PR objc/90709
+       * obj-c++.dg/proto-lossage-7.mm: Use proxy headers.
+       * obj-c++.dg/strings/const-cfstring-2.mm: Likewise.
+       * obj-c++.dg/strings/const-cfstring-5.mm: Likewise
+       * obj-c++.dg/strings/const-str-12.mm: Likewise.
+       * obj-c++.dg/syntax-error-1.mm: Likewise.
+       * obj-c++.dg/torture/strings/const-cfstring-1.mm: Likewise.
+       * obj-c++.dg/torture/strings/const-str-10.mm: Likewise.
+       * obj-c++.dg/torture/strings/const-str-11.mm: Likewise.
+       * obj-c++.dg/torture/strings/const-str-9.mm: Likewise.
+       * obj-c++.dg/cxx-ivars-3.mm: Skip on later Darwin, where the 10.4 API
+       in no longer supported, also on m64 where there's no meaning to it.
+       * obj-c++.dg/isa-field-1.mm: Suppress unwanted warning, add comment why.
+       * obj-c++.dg/objc-gc-3.mm: Skip for Darwin > 16, the API use is an error
+       there.
+       * obj-c++.dg/qual-types-1.mm: Prune a spurious l64 warning.
+       * obj-c++.dg/stubify-1.mm: Tidy up after better compiler warnings.
+       * obj-c++.dg/stubify-2.mm: Likewise.
+       * obj-c++.dg/try-catch-1.mm: Likewise.
+       * obj-c++.dg/try-catch-3.mm: Likewise.
+
 2019-06-15  Iain Sandoe  <iain@sandoe.co.uk>
 
        PR objc/90709
index 0098349cbceeefab32ba4a10437fcceb57d8401a..18b671d122a3170c2f091add88ed3be26149cf1c 100644 (file)
@@ -2,13 +2,14 @@
 
 // { dg-do run { target *-*-darwin* } }
 // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
+// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[3-8]* } { "-fnext-runtime" } { "" } }
 // { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" }
 // This test has no equivalent or meaning for m64/ABI V2
-// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
+// { dg-xfail-run-if "No Test Avail" {  *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
 
 #include <objc/objc-runtime.h>
 #include <stdlib.h>
-#include <Foundation/NSObject.h>
+#include "../objc-obj-c++-shared/F-NSObject.h"
 
 //extern "C" { int printf(const char *,...); }
 #define CHECK_IF(expr) if(!(expr)) abort()
index 4501d01a11e605d36771671817b0aa5aa7b035a6..3fb27d5f641b4110924bcfc0b9ea8c9b5bfc646e 100644 (file)
@@ -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 is works. */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include "../objc-obj-c++-shared/TestsuiteObject.h"
 #include "../objc-obj-c++-shared/runtime.h"
index 430e5832eb6c02e5be2d250be227f4cf2a827cf8..68bebf8fc96d5dbe09274216c0678d977bfa74dd 100644 (file)
@@ -3,6 +3,7 @@
 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
 
 /* { 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 "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
 
index b32cfd8a0dd62403c06b3b3da167ca701bc5637a..d136af92d67bd60faa872c8a462143c5c955b1e0 100644 (file)
@@ -1,9 +1,11 @@
 /* Check that typedefs of ObjC classes preserve 
    any @protocol qualifiers.  */
 /* { dg-do compile } */
+/* Suppress warnings that the GNUStep headers introduce.  */
+/* { dg-additional-options "-std=gnu++11 -Wno-expansion-to-defined -Wno-variadic-macros" { target *-*-darwin* } } */
 
 #ifdef __NEXT_RUNTIME__
-#include <Foundation/NSObject.h>
+#include "../objc-obj-c++-shared/F-NSObject.h"
 #define OBJECT NSObject
 #else
 #include <objc/Object.h>
index dd0eb42bc4f00528b5931fd905c3f01ccd49217e..2fe06e4c80dac2a87d192a8384ce8cbf4f379300 100644 (file)
@@ -4,6 +4,8 @@
 
 /* { dg-do run } */
 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-prune-output ".*ld: warning: direct access in.*" } */
+
 #include "../objc-obj-c++-shared/TestsuiteObject.m"
 #include <stdlib.h>
 
index b4fc9e6ed4fbdd97ce9850e06d7b76b26a4efcd3..e81f47138283674c8c141ba52e504a31b8e63862 100644 (file)
@@ -8,8 +8,8 @@
 /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-options "-ftrack-macro-expansion=0 -mconstant-cfstrings -Wnonportable-cfstrings" } */
 
-#import <Foundation/NSString.h>
-#import <CoreFoundation/CFString.h>
+#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
index 98bb7c5bddc1b57b5d696d580169bb1c32246694..762afb6b1ba5c256685a9ea9cbae3a3aa2a314f8 100644 (file)
@@ -6,7 +6,7 @@
 /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-options "-mconstant-cfstrings" } */
 
-#include <Foundation/NSObject.h>
+#include "../../objc-obj-c++-shared/F-NSObject.h"
 
 @interface Foo: NSObject {
   char *cString;
index d0dfb668ea93b666077eedf3ffc9cfcdd3858100..ade24b3a22ca84fabed926fb3094d01acd978f2a 100644 (file)
@@ -6,7 +6,7 @@
 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
 
 #ifdef __NEXT_RUNTIME__
-#include <Foundation/NSObject.h>
+#include "../../objc-obj-c++-shared/F-NSObject.h"
 #define OBJECT NSObject
 #else
 #include <objc/Object.h>
index 687739ceccd9dffd73158f0ff81f442c1618d0dc..c2355437afc8051bdd472f34e689d6e3904f5b00 100644 (file)
@@ -10,7 +10,7 @@ typedef struct objc_object { } *id ;
 int x = 41 ;
 
 extern "C" {
-  extern id objc_msgSend(id self, char * op, ...);
+  extern id objc_msgSend(id self, objc_selector* op, ...);
   extern int bogonic (int, int, int);
 }
 
@@ -20,9 +20,9 @@ extern "C" {
 - (Document *) close;
 @end
 @implementation Document
-- (Document *) class { }
-- (Document *) close { }
-- (Document *) window { }
+- (Document *) class { return (Document *)0; }
+- (Document *) close { return (Document *)0; }
+- (Document *) window { return (Document *)0; }
 - (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
   [[self window] close];
   ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1);
index 9968672ed344917e51c3a6948d9a21c7aa754374..a9f66cac5d26b72d4223edf05c7adab08b183d44 100644 (file)
@@ -16,9 +16,9 @@ extern int bogonic (int, int, int) ;
 - (Document *) close;
 @end
 @implementation Document
-- (Document *) class { }
-- (Document *) close { }
-- (Document *) window { }
+- (Document *) class { return (Document *)0; }
+- (Document *) close { return (Document *)0; }
+- (Document *) window { return (Document *)0; }
 - (void)willEndCloseSheet:(void *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
   [[self window] close];
   ((void (*)(id, char *, int))objc_msgSend)([self class], (char *)contextInfo, 1);
index 320d56c5ec13a5cd050bf56abc296a8299784dd9..edbd9efc96490370039f23800c9b61140eaaf19a 100644 (file)
@@ -1,8 +1,10 @@
 /* Graceful handling of a syntax error.  */
 /* { dg-do compile } */
+/* Suppress warnings that the GNUStep headers introduce.  */
+/* { dg-additional-options "-std=gnu++11 -Wno-expansion-to-defined -Wno-variadic-macros" { target *-*-darwin* } } */
 
 #ifdef __NEXT_RUNTIME__
-#include <Foundation/NSObject.h>
+#include "../objc-obj-c++-shared/F-NSObject.h"
 #define OBJECT NSObject
 #else
 #include <objc/Object.h>
index 2983c43c445a0e43b4c70c5459e2f669f26ae2b4..0f1d92bb5ce021d5f1bc09b15c449c7287a202f6 100644 (file)
@@ -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 <Foundation/NSString.h>
-#import <CoreFoundation/CFString.h>
+#include "../../../objc-obj-c++-shared/F-NSString.h"
+#include "../../../objc-obj-c++-shared/CF-CFString.h"
 #include <stdlib.h>
 
 void printOut(NSString *str) {
@@ -47,10 +47,10 @@ int main(void) {
   checkNSRange([@"Hello World" rangeOfString:(id)CFSTR("World")]);
   checkNSRange([(id)CFSTR("Hello World") rangeOfString:(id)CFSTR("World")]);
 
-  checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", 0));
-  checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", 0));
-  checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), 0));
-  checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), 0));
+  checkCFRange(CFStringFind((CFStringRef)@"Hello World", (CFStringRef)@"World", (CFStringCompareFlags)0));
+  checkCFRange(CFStringFind(CFSTR("Hello World"), (CFStringRef)@"World", (CFStringCompareFlags)0));
+  checkCFRange(CFStringFind((CFStringRef)@"Hello World", CFSTR("World"), (CFStringCompareFlags)0));
+  checkCFRange(CFStringFind(CFSTR("Hello World"), CFSTR("World"), (CFStringCompareFlags)0));
 
   /* Check for string uniquing.  */
   if (s0a != s0b || s0a != s2 || s1 != (id)s2) {
index f2e912beb0a02d03ab3ec667f658ac3157afedd4..e1dad124cd6dac46026d9bc52b355a2f53f1af8c 100644 (file)
@@ -6,7 +6,7 @@
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
 
-#include <Foundation/NSObject.h>
+#include "../../../objc-obj-c++-shared/F-NSObject.h"
 #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE.  */
 
 @interface NSString: NSObject
index 7e5d9b61e71ac0b3c6fc3241fe49a4906f683151..30a9228a64eca823f6e46f44a77ec5eb3dbe88c7 100644 (file)
@@ -7,7 +7,7 @@
 /* { dg-options "-fconstant-string-class=XStr" } */
 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */
 
-#include <Foundation/NSObject.h>
+#include "../../../objc-obj-c++-shared/F-NSObject.h"
 #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE.  */
 
 @interface XString: NSObject {
index d78dc73f9378e351b0ab910920f4458e58414618..a1a14295e905358e8725725a2c278ec057bf2599 100644 (file)
@@ -5,7 +5,7 @@
 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
 /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
 
-#include <Foundation/NSObject.h>
+#include "../../../objc-obj-c++-shared/F-NSObject.h"
 #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE.  */
 
 @interface NSConstantString: NSObject {
index cbdace62d43ccad1af98ef85dbbd3207246e691b..1688995a2bf526097b7bf57185adbeb195de0e5d 100644 (file)
@@ -39,4 +39,5 @@ int foo()
   @finally {
     printf("In @finally block (%d)... ", exc_control);
   }
+  return -1;
 }
index b0822d3d7c7d342fde9b09cf7e6c45f0b74c97a3..e6868a350eb22eefda6e66fe48714ff6fda8764c 100644 (file)
@@ -15,4 +15,5 @@ const char *foo(void)
   @catch (TestsuiteObject* theException) {
     return [theException name];
   }
+  return (const char *)0;
 }