summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg
diff options
context:
space:
mode:
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-11 10:14:48 +0000
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-11 10:14:48 +0000
commit21193cc2b59e9cbdace9ebb755f00086f8eeb7ba (patch)
tree5b775ac5ec0f8b64be5f92c27555c7ca090cd766 /gcc/testsuite/objc.dg
parent0725e25c3c1c28f88a8fe92d2eac113857e6e407 (diff)
downloadgcc-21193cc2b59e9cbdace9ebb755f00086f8eeb7ba.tar.gz
gcc/testsuite:
* objc-obj-c++-shared/next-mapping.h: Add copyright header. Split type definitions and NSConstantString class into... * objc-obj-c++-shared/objc-test-suite-types.h: New. * objc-obj-c++-shared/nsconstantstring-class.h: New. * objc-obj-c++-shared/nsconstantstring-class-impl.h: New. * objc-obj-c++-shared/nsconstantstring-class-impl.m: New. * objc-obj-c++-shared/nsconstantstring-class-impl.mm: New. * objc-obj-c++-shared/next-abi.h: Add copyright header, minor update to comments. * objc-obj-c++-shared/objc-test-suite-next-encode-assist.h: Adjust encode defines for newer NeXT system headers. * obj-c++.dg/template-4.mm: Adjust to use nsconstantstring headers. * obj-c++.dg/torture/strings/string1.mm: Likewise. * objc.dg/foreach-5.m: Likewise. * objc.dg/foreach-2.m: Likewise. * objc.dg/foreach-4.m: Likewise. * objc.dg/torture/strings/string1.m: Likewise. * objc.dg/torture/strings/string2.m: Likewise. * objc.dg/torture/strings/string3.m: Likewise. * objc.dg/torture/strings/string4.m: Likewise. * obj-c++.dg/torture/strings/const-str-3.mm: Adjust to use type header and stand alone. * obj-c++.dg/strings/strings-2.mm: Likewise. * objc.dg/torture/strings/const-str-3.m: Likewise. * objc.dg/strings/strings-2.m: Likewise. * objc.dg/strings/const-str-12b.m: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168653 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r--gcc/testsuite/objc.dg/foreach-2.m4
-rw-r--r--gcc/testsuite/objc.dg/foreach-4.m4
-rw-r--r--gcc/testsuite/objc.dg/foreach-5.m4
-rw-r--r--gcc/testsuite/objc.dg/strings/const-str-12b.m10
-rw-r--r--gcc/testsuite/objc.dg/strings/strings-2.m20
-rw-r--r--gcc/testsuite/objc.dg/torture/strings/const-str-3.m25
-rw-r--r--gcc/testsuite/objc.dg/torture/strings/string1.m9
-rw-r--r--gcc/testsuite/objc.dg/torture/strings/string2.m9
-rw-r--r--gcc/testsuite/objc.dg/torture/strings/string3.m8
-rw-r--r--gcc/testsuite/objc.dg/torture/strings/string4.m8
10 files changed, 49 insertions, 52 deletions
diff --git a/gcc/testsuite/objc.dg/foreach-2.m b/gcc/testsuite/objc.dg/foreach-2.m
index 80e9e708e17..a319a4bc716 100644
--- a/gcc/testsuite/objc.dg/foreach-2.m
+++ b/gcc/testsuite/objc.dg/foreach-2.m
@@ -5,12 +5,14 @@
/* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
-/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */
+/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m ../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
#include "../objc-obj-c++-shared/Object1.h"
#include "../objc-obj-c++-shared/next-mapping.h"
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
extern int printf (const char *, ...);
diff --git a/gcc/testsuite/objc.dg/foreach-4.m b/gcc/testsuite/objc.dg/foreach-4.m
index ed5dda01a60..13b9b0bb9de 100644
--- a/gcc/testsuite/objc.dg/foreach-4.m
+++ b/gcc/testsuite/objc.dg/foreach-4.m
@@ -5,12 +5,14 @@
/* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
-/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */
+/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m ../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
#import "../objc-obj-c++-shared/Object1.h"
#import "../objc-obj-c++-shared/next-mapping.h"
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
extern int printf (const char *, ...);
diff --git a/gcc/testsuite/objc.dg/foreach-5.m b/gcc/testsuite/objc.dg/foreach-5.m
index 7bcabee5367..c715b2d822d 100644
--- a/gcc/testsuite/objc.dg/foreach-5.m
+++ b/gcc/testsuite/objc.dg/foreach-5.m
@@ -5,12 +5,14 @@
/* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
-/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m" } */
+/* { dg-additional-sources "../objc-obj-c++-shared/Object1.m ../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
#import "../objc-obj-c++-shared/Object1.h"
#import "../objc-obj-c++-shared/next-mapping.h"
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
extern int printf (const char *, ...);
diff --git a/gcc/testsuite/objc.dg/strings/const-str-12b.m b/gcc/testsuite/objc.dg/strings/const-str-12b.m
index cad481e15a0..430ab5db2d6 100644
--- a/gcc/testsuite/objc.dg/strings/const-str-12b.m
+++ b/gcc/testsuite/objc.dg/strings/const-str-12b.m
@@ -5,8 +5,8 @@
/* { dg-options "-fconstant-string-class=Foo" } */
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
-#include "../../objc-obj-c++-shared/Object1.h"
-#import "../../objc-obj-c++-shared/next-mapping.h"
+#include <objc/Object.h>
+#include "../../objc-obj-c++-shared/objc-test-suite-types.h"
@interface Foo: Object {
char *cString;
@@ -19,11 +19,7 @@
+ (Foo *) getString: (int) which;
@end
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-struct fudge_objc_class _FooClassReference;
-#else
-struct objc_class _FooClassReference;
-#endif
+TNS_STRING_REF_T _FooClassReference; /* Only used by NeXT. */
@implementation Bar
+ (Foo *) getString: (int) which {
diff --git a/gcc/testsuite/objc.dg/strings/strings-2.m b/gcc/testsuite/objc.dg/strings/strings-2.m
index 29d9375bf7b..b07ac0f7842 100644
--- a/gcc/testsuite/objc.dg/strings/strings-2.m
+++ b/gcc/testsuite/objc.dg/strings/strings-2.m
@@ -5,24 +5,25 @@
/* { dg-options "-fconstant-string-class=MyTestString" } */
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=MyTestString" { target *-*-darwin* } } */
-/* { dg-additional-sources "../../objc-obj-c++-shared/Object1.m" } */
-
-#include "../../objc-obj-c++-shared/Object1.h"
-#include "../../objc-obj-c++-shared/next-mapping.h"
+#include "../../objc-obj-c++-shared/objc-test-suite-types.h"
#include <stdlib.h> /* For abort() */
-@interface MyTestString : Object
+@interface MyTestString
{
+ void *dummy_class_ptr;
char *string;
unsigned int len;
}
++ initialize;
/* All strings should contain the C string 'test'. Call -check to
test that this is true. */
- (void) check;
@end
@implementation MyTestString
++ initialize {return self;}
+
- (void) check
{
if (len != 4 || string[0] != 't' || string[1] != 'e'
@@ -31,13 +32,7 @@
}
@end
-#ifdef __NEXT_RUNTIME__
-# ifdef NEXT_OBJC_USE_NEW_INTERFACE
-struct fudge_objc_class _MyTestStringClassReference;
-# else
-struct objc_class _MyTestStringClassReference;
-# endif
-#endif
+TNS_STRING_REF_T _MyTestStringClassReference; /* Only used by NeXT. */
int main (void)
{
@@ -61,6 +56,7 @@ int main (void)
#ifdef __NEXT_RUNTIME__
/* The MyTestString metaclass will need to be initialized before we can
send messages to strings. */
+#include <string.h>
void testsuite_mytest_string_init (void) __attribute__((constructor));
void testsuite_mytest_string_init (void) {
diff --git a/gcc/testsuite/objc.dg/torture/strings/const-str-3.m b/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
index ca2df5a89ec..0eb2d6a01e0 100644
--- a/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
+++ b/gcc/testsuite/objc.dg/torture/strings/const-str-3.m
@@ -4,28 +4,27 @@
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-options "-fconstant-string-class=Foo" } */
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
-/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */
-#include "../../../objc-obj-c++-shared/Object1.h"
-#include "../../../objc-obj-c++-shared/next-mapping.h"
+#include "../../../objc-obj-c++-shared/objc-test-suite-types.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-@interface Foo: Object {
+@interface Foo {
+ void *dummy_class_ref;
char *cString;
unsigned int len;
}
++ initialize;
- (char *)customString;
@end
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-struct fudge_objc_class _FooClassReference;
-#else
-struct objc_class _FooClassReference;
-#endif
+TNS_STRING_REF_T _FooClassReference; /* Only used by NeXT. */
+
+@implementation Foo
++ initialize {return self;}
-@implementation Foo : Object
- (char *)customString {
return cString;
}
@@ -39,11 +38,13 @@ int main () {
abort();
printf("Strings are being uniqued properly\n");
+#ifdef __NEXT_RUNTIME__
/* This memcpy has to be done before the first message is sent to a
constant string object. Can't be moved to +initialize since _that_
- is already a message. */
+ is already a message. */
- memcpy(&_FooClassReference, objc_get_class("Foo"), sizeof(_FooClassReference));
+ memcpy(&_FooClassReference, objc_getClass("Foo"), sizeof(_FooClassReference));
+#endif
if (strcmp ([string customString], "bla")) {
abort ();
}
diff --git a/gcc/testsuite/objc.dg/torture/strings/string1.m b/gcc/testsuite/objc.dg/torture/strings/string1.m
index 76d3c9b0756..455b5f1bff1 100644
--- a/gcc/testsuite/objc.dg/torture/strings/string1.m
+++ b/gcc/testsuite/objc.dg/torture/strings/string1.m
@@ -1,18 +1,17 @@
/* Based on a test case contributed by Nicola Pero. */
/* { dg-do run } */
-/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
+/* { dg-options "-mno-constant-cfstrings -Wno-deprecated-declarations" { target *-*-darwin* } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */
-
-#include "../../../objc-obj-c++-shared/Object1.h"
-#include "../../../objc-obj-c++-shared/next-mapping.h"
+/* { dg-additional-sources "../../../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
#include <string.h>
#include <stdlib.h>
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../../../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
int main(int argc, void **args)
diff --git a/gcc/testsuite/objc.dg/torture/strings/string2.m b/gcc/testsuite/objc.dg/torture/strings/string2.m
index 90e4db1e33c..030ba602db5 100644
--- a/gcc/testsuite/objc.dg/torture/strings/string2.m
+++ b/gcc/testsuite/objc.dg/torture/strings/string2.m
@@ -1,18 +1,17 @@
/* Based on a test case contributed by Nicola Pero. */
/* { dg-do run } */
-/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
+/* { dg-options "-mno-constant-cfstrings -Wno-deprecated-declarations" { target *-*-darwin* } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */
-
-#include "../../../objc-obj-c++-shared/Object1.h"
-#include "../../../objc-obj-c++-shared/next-mapping.h"
+/* { dg-additional-sources "../../../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
#include <string.h>
#include <stdlib.h>
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../../../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
int main(int argc, void **args)
diff --git a/gcc/testsuite/objc.dg/torture/strings/string3.m b/gcc/testsuite/objc.dg/torture/strings/string3.m
index ca08fed8d00..b08dfb242b3 100644
--- a/gcc/testsuite/objc.dg/torture/strings/string3.m
+++ b/gcc/testsuite/objc.dg/torture/strings/string3.m
@@ -1,17 +1,17 @@
/* Based on a test case contributed by Nicola Pero. */
/* { dg-do run } */
-/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
+/* { dg-options "-mno-constant-cfstrings -Wno-deprecated-declarations" { target *-*-darwin* } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */
+/* { dg-additional-sources "../../../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
-#include "../../../objc-obj-c++-shared/Object1.h"
-#import "../../../objc-obj-c++-shared/next-mapping.h"
#include <string.h>
#include <stdlib.h>
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../../../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
#define STRING "this is a string"
diff --git a/gcc/testsuite/objc.dg/torture/strings/string4.m b/gcc/testsuite/objc.dg/torture/strings/string4.m
index caa877e4de7..425ccc080ea 100644
--- a/gcc/testsuite/objc.dg/torture/strings/string4.m
+++ b/gcc/testsuite/objc.dg/torture/strings/string4.m
@@ -1,17 +1,17 @@
/* Based on a test case contributed by Nicola Pero. */
/* { dg-do run } */
-/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */
+/* { dg-options "-mno-constant-cfstrings -Wno-deprecated-declarations" { target *-*-darwin* } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-/* { dg-additional-sources "../../../objc-obj-c++-shared/Object1.m" } */
+/* { dg-additional-sources "../../../objc-obj-c++-shared/nsconstantstring-class-impl.m" } */
-#include "../../../objc-obj-c++-shared/Object1.h"
-#import "../../../objc-obj-c++-shared/next-mapping.h"
#include <string.h>
#include <stdlib.h>
#ifndef __NEXT_RUNTIME__
#include <objc/NXConstStr.h>
+#else
+#include "../../../objc-obj-c++-shared/nsconstantstring-class.h"
#endif
int main(int argc, void **args)