diff options
Diffstat (limited to 'gcc/testsuite/obj-c++.dg')
23 files changed, 70 insertions, 45 deletions
diff --git a/gcc/testsuite/obj-c++.dg/attributes/attributes.exp b/gcc/testsuite/obj-c++.dg/attributes/attributes.exp index 1d4cae4ef2..6b5b299779 100644 --- a/gcc/testsuite/obj-c++.dg/attributes/attributes.exp +++ b/gcc/testsuite/obj-c++.dg/attributes/attributes.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # # This file is part of GCC. # diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm index e94e6ec57a..0098349cbc 100644 --- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm +++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm @@ -2,12 +2,15 @@ // { dg-do run { target *-*-darwin* } } // { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } -// { dg-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4" } +// { 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" } { "" } } #include <objc/objc-runtime.h> #include <stdlib.h> +#include <Foundation/NSObject.h> + +//extern "C" { int printf(const char *,...); } #define CHECK_IF(expr) if(!(expr)) abort() #ifndef CLS_HAS_CXX_STRUCTORS @@ -19,7 +22,7 @@ struct cxx_struct { cxx_struct (void) { a = b = 55; } }; -@interface Foo { +@interface Foo: NSObject { int c; cxx_struct s; } @@ -42,9 +45,11 @@ int main (void) Class cls; cls = objc_getClass("Foo"); - CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS); +// printf((const char *)"Foo info %lx\n",cls->info); + CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) != 0); cls = objc_getClass("Bar"); - CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS)); +// printf((const char *)"Bar info %lx\n",cls->info); + CHECK_IF((cls->info & CLS_HAS_CXX_STRUCTORS) == 0); #else /* No test needed or available. */ diff --git a/gcc/testsuite/obj-c++.dg/dg.exp b/gcc/testsuite/obj-c++.dg/dg.exp index fb809b4844..0581b49edb 100644 --- a/gcc/testsuite/obj-c++.dg/dg.exp +++ b/gcc/testsuite/obj-c++.dg/dg.exp @@ -1,5 +1,5 @@ # GCC Objective-C++ testsuite that uses the `dg.exp' driver. -# Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/obj-c++.dg/dwarf-2.mm b/gcc/testsuite/obj-c++.dg/dwarf-2.mm index f936b6baef..3720a8871e 100644 --- a/gcc/testsuite/obj-c++.dg/dwarf-2.mm +++ b/gcc/testsuite/obj-c++.dg/dwarf-2.mm @@ -1,4 +1,4 @@ /* { dg-options "-gdwarf-2 -dA" } */ -/* { dg-skip-if "No Dwarf" { { alpha*-dec-osf* hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */ +/* { dg-skip-if "No Dwarf" { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */ /* { dg-final { scan-assembler "0x11\[^0-9a-f\].*DW_AT_language" } } */ int x; diff --git a/gcc/testsuite/obj-c++.dg/invalid-method-2.mm b/gcc/testsuite/obj-c++.dg/invalid-method-2.mm index 48f03599c1..e3a8ed1ff1 100644 --- a/gcc/testsuite/obj-c++.dg/invalid-method-2.mm +++ b/gcc/testsuite/obj-c++.dg/invalid-method-2.mm @@ -7,11 +7,11 @@ @end @implementation MyClass -- (x) method /* { dg-error "expected" } */ +- (x) method /* { dg-error "expected|type" } */ { return 0; } -- (id) method2: (x)argument /* { dg-error "expected" } */ +- (id) method2: (x)argument /* { dg-error "expected|type" } */ { return 0; } diff --git a/gcc/testsuite/obj-c++.dg/lto/lto.exp b/gcc/testsuite/obj-c++.dg/lto/lto.exp index 4ae08c1727..19cf510365 100644 --- a/gcc/testsuite/obj-c++.dg/lto/lto.exp +++ b/gcc/testsuite/obj-c++.dg/lto/lto.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/obj-c++.dg/method-12.mm b/gcc/testsuite/obj-c++.dg/method-12.mm index c1f2a39dfa..6cdb0f9c81 100644 --- a/gcc/testsuite/obj-c++.dg/method-12.mm +++ b/gcc/testsuite/obj-c++.dg/method-12.mm @@ -2,6 +2,7 @@ /* Author: Ziemowit Laski <zlaski@apple.com> */ /* { dg-options "-Wstrict-selector-match" } */ /* { dg-do compile } */ +/* { dg-skip-if "Object interface removed" { *-*-darwin[1-2]* && { lp64 } } { "-fnext-runtime" } { "" } } */ #include <objc/Protocol.h> @@ -19,13 +20,13 @@ void foo(void) { Class receiver; [receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */ - /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 9 } */ - /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 14 } */ + /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 10 } */ + /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 15 } */ [receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */ - /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 25 } */ - /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 25 } */ - /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 25 } */ + /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 26 } */ + /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 26 } */ + /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 26 } */ [Class port]; /* { dg-error ".Class. is not an Objective\\-C class name or alias" } */ } diff --git a/gcc/testsuite/obj-c++.dg/method-8.mm b/gcc/testsuite/obj-c++.dg/method-8.mm index 9857c63ffe..cde1bc2746 100644 --- a/gcc/testsuite/obj-c++.dg/method-8.mm +++ b/gcc/testsuite/obj-c++.dg/method-8.mm @@ -16,7 +16,7 @@ @end @implementation class3 -- (int) meth1 { return 0; } /* { dg-error "previously defined here" } */ +- (int) meth1 { return 0; } /* { dg-message "previously defined here" } */ - (int) meth1 { return 0; } /* { dg-error "redefinition of" } */ @end @@ -25,6 +25,6 @@ @end @implementation class4 -+ (void) meth1 {} /* { dg-error "previously defined here" } */ ++ (void) meth1 {} /* { dg-message "previously defined here" } */ + (void) meth1 {} /* { dg-error "redefinition of" } */ @end diff --git a/gcc/testsuite/obj-c++.dg/property/dotsyntax-4.mm b/gcc/testsuite/obj-c++.dg/property/dotsyntax-4.mm index 2e918d2821..f3292ecf39 100644 --- a/gcc/testsuite/obj-c++.dg/property/dotsyntax-4.mm +++ b/gcc/testsuite/obj-c++.dg/property/dotsyntax-4.mm @@ -35,7 +35,7 @@ int main (void) abort (); MyRootClass.int; /* { dg-error "expected identifier" } */ - /* { dg-error "expected" "" { target *-*-* } 37 } */ + if (MyRootClass.int) /* { dg-error "expected identifier" } */ /* { dg-error "expected" "" { target *-*-* } 39 } */ abort (); diff --git a/gcc/testsuite/obj-c++.dg/property/property.exp b/gcc/testsuite/obj-c++.dg/property/property.exp index 468e34b37d..e9b57f169a 100644 --- a/gcc/testsuite/obj-c++.dg/property/property.exp +++ b/gcc/testsuite/obj-c++.dg/property/property.exp @@ -1,5 +1,5 @@ # GCC Objective-C++ testsuite that uses the `dg.exp' driver. -# Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm index b7746d7a14..b32cfd8a0d 100644 --- a/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm +++ b/gcc/testsuite/obj-c++.dg/proto-lossage-7.mm @@ -1,12 +1,19 @@ /* Check that typedefs of ObjC classes preserve any @protocol qualifiers. */ /* { dg-do compile } */ + +#ifdef __NEXT_RUNTIME__ +#include <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#define OBJECT Object +#endif @protocol CanDoStuff; -typedef Object<CanDoStuff> CanDoStuffType; -typedef Object<CanDoStuff> *CanDoStuffTypePtr; +typedef OBJECT<CanDoStuff> CanDoStuffType; +typedef OBJECT<CanDoStuff> *CanDoStuffTypePtr; @protocol CanDoStuff - (int) dostuff; diff --git a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm index 14ae68c6c5..b4fc9e6ed4 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-2.mm @@ -6,7 +6,7 @@ /* So far, CFString is darwin-only. */ /* { dg-do compile { target *-*-darwin* } } */ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ -/* { dg-options "-mconstant-cfstrings -Wnonportable-cfstrings" } */ +/* { dg-options "-ftrack-macro-expansion=0 -mconstant-cfstrings -Wnonportable-cfstrings" } */ #import <Foundation/NSString.h> #import <CoreFoundation/CFString.h> diff --git a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm index 13cb789577..98bb7c5bdd 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-cfstring-5.mm @@ -6,16 +6,16 @@ /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mconstant-cfstrings" } */ -#include <objc/Object.h> +#include <Foundation/NSObject.h> -@interface Foo: Object { +@interface Foo: NSObject { char *cString; unsigned int len; } + (Foo *)description; @end -@interface Bar: Object +@interface Bar: NSObject + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm index 430ab5db2d..d0dfb668ea 100644 --- a/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm +++ b/gcc/testsuite/obj-c++.dg/strings/const-str-12.mm @@ -5,17 +5,23 @@ /* { dg-options "-fconstant-string-class=Foo" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */ +#ifdef __NEXT_RUNTIME__ +#include <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#define OBJECT Object +#endif #include "../../objc-obj-c++-shared/objc-test-suite-types.h" -@interface Foo: Object { +@interface Foo: OBJECT { char *cString; unsigned int len; } + (id)description; @end -@interface Bar: Object +@interface Bar: OBJECT + (Foo *) getString: (int) which; @end diff --git a/gcc/testsuite/obj-c++.dg/strings/strings.exp b/gcc/testsuite/obj-c++.dg/strings/strings.exp index 82cd925bb2..96e2c69acf 100644 --- a/gcc/testsuite/obj-c++.dg/strings/strings.exp +++ b/gcc/testsuite/obj-c++.dg/strings/strings.exp @@ -1,6 +1,6 @@ # String tests that only need to run at default optimization. -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # # This file is part of GCC. # diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm index 13f3c275cc..1fe9ca3c4b 100644 --- a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm +++ b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm @@ -1,7 +1,13 @@ /* Graceful handling of a syntax error. */ /* { dg-do compile } */ +#ifdef __NEXT_RUNTIME__ +#include <Foundation/NSObject.h> +#define OBJECT NSObject +#else #include <objc/Object.h> +#define OBJECT Object +#endif class foo { public: @@ -12,7 +18,7 @@ class foo { extern void NXLog(const char *, ...); -@interface Test2 : Object { +@interface Test2 : OBJECT { } - (void) foo2; @end @@ -23,4 +29,4 @@ extern void NXLog(const char *, ...); } /* { dg-error "stray .\}. between Objective\\-C\\+\\+ methods" } */ @end -/* { dg-error "expected constructor, destructor, or type conversion before" "" { target *-*-* } 22 } */ +/* { dg-error "expected constructor, destructor, or type conversion before" "" { target *-*-* } 28 } */ diff --git a/gcc/testsuite/obj-c++.dg/tls/diag-3.mm b/gcc/testsuite/obj-c++.dg/tls/diag-3.mm index 0a597b20f8..22c2395ab9 100644 --- a/gcc/testsuite/obj-c++.dg/tls/diag-3.mm +++ b/gcc/testsuite/obj-c++.dg/tls/diag-3.mm @@ -1,10 +1,10 @@ /* Report invalid extern and __thread combinations. */ /* { dg-require-effective-target tls } */ -extern int j; /* { dg-error "previously declared here" } */ +extern int j; /* { dg-message "previously declared here" } */ __thread int j; /* { dg-error "follows non-thread-local" } */ -extern __thread int i; /* { dg-error "previously declared here" } */ +extern __thread int i; /* { dg-message "previously declared here" } */ int i; /* { dg-error "follows thread-local" } */ extern __thread int k; /* This is fine. */ diff --git a/gcc/testsuite/obj-c++.dg/tls/init-2.mm b/gcc/testsuite/obj-c++.dg/tls/init-2.mm index dc886ba010..327c309e98 100644 --- a/gcc/testsuite/obj-c++.dg/tls/init-2.mm +++ b/gcc/testsuite/obj-c++.dg/tls/init-2.mm @@ -2,13 +2,13 @@ /* { dg-require-effective-target tls } */ extern __thread int i; -__thread int *p = &i; /* { dg-error "dynamically initialized" } */ +__thread int *p = &i; /* { dg-error "dynamic initialization" } */ extern int f(); -__thread int j = f(); /* { dg-error "dynamically initialized" } */ +__thread int j = f(); /* { dg-error "dynamic initialization" } */ struct S { S(); }; -__thread S s; /* { dg-error "" } two errors here */ +__thread S s; /* { dg-error "dynamic initialization" } */ diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm index cba188b70e..f2e912beb0 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm @@ -6,10 +6,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <objc/Object.h> +#include <Foundation/NSObject.h> #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSString: Object +@interface NSString: NSObject @end @interface NSSimpleCString : NSString { diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm index c54f89bd8c..7e5d9b61e7 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm @@ -7,10 +7,10 @@ /* { dg-options "-fconstant-string-class=XStr" } */ /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */ -#include <objc/Object.h> +#include <Foundation/NSObject.h> #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface XString: Object { +@interface XString: NSObject { @protected char *bytes; } diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm index b4f15fdcdd..d78dc73f93 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm @@ -5,10 +5,10 @@ /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ /* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ -#include <objc/Object.h> +#include <Foundation/NSObject.h> #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ -@interface NSConstantString: Object { +@interface NSConstantString: NSObject { char *cString; unsigned int len; } diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp b/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp index 180401c3b7..87d47bb867 100644 --- a/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp +++ b/gcc/testsuite/obj-c++.dg/torture/strings/strings.exp @@ -1,6 +1,6 @@ # String tests that should be run at all optimization levels. -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010-2014 Free Software Foundation, Inc. # # This file is part of GCC. # diff --git a/gcc/testsuite/obj-c++.dg/try-catch-13.mm b/gcc/testsuite/obj-c++.dg/try-catch-13.mm index 905702fde4..776d57bed6 100644 --- a/gcc/testsuite/obj-c++.dg/try-catch-13.mm +++ b/gcc/testsuite/obj-c++.dg/try-catch-13.mm @@ -22,7 +22,7 @@ extern void some_func (int *); typeof(q) k = 66; some_func (&j); /* { dg-error "invalid conversion" "" { target *-*-* } 23 } */ -/* { dg-error "initializing argument" "" { target *-*-* } 12 } */ +/* { dg-message "initializing argument" "" { target *-*-* } 12 } */ some_func (&k); } @catch (id exc) { @@ -39,7 +39,7 @@ extern void some_func (int *); /* { dg-error "invalid conversion" "" { target *-*-* } 38 } */ /* The following is disabled as it is already checked above and the testsuites seems to count multiple different identical errors on the same line only once */ -/* dg-error "initializing argument" "" { target *-*-* } 12 */ +/* dg-message "initializing argument" "" { target *-*-* } 12 */ } @catch (id exc) { @throw; @@ -54,7 +54,7 @@ extern void some_func (int *); /* { dg-error "invalid conversion" "" { target *-*-* } 53 } */ /* The following is disabled as it is already checked above and the testsuites seems to count multiple different identical errors on the same line only once */ -/* dg-error "initializing argument" "" { target *-*-* } 12 */ +/* dg-message "initializing argument" "" { target *-*-* } 12 */ some_func (&k); } @catch (id exc) { |