summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog216
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/constant4.C2
-rw-r--r--gcc/testsuite/g++.dg/template/qualified-id3.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20001226-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20010327-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20020604-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080625-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr41181.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr43191.c1
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_derived_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90121
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f121
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90107
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/pr46259.f19
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_1.f032
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_11.f032
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm33
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm23
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm21
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm43
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm34
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm34
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-10.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-11.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-12.mm46
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-13.mm71
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-6.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-7.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-8.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-9.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm37
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-attribute-2.m2
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-deprecated-1.m33
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-deprecated-2.m23
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-deprecated-3.m21
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-format-1.m43
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-noreturn-1.m34
-rw-r--r--gcc/testsuite/objc.dg/attributes/method-sentinel-1.m34
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-10.m5
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-11.m5
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-12.m46
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-13.m71
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-6.m2
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-7.m2
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-8.m2
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-9.m5
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-deprecated-1.m37
56 files changed, 1296 insertions, 70 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6eac260146c..8fc1d6bd2aa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,160 @@
+2010-11-01 Jason Merrill <jason@redhat.com>
+ Benjamin Kosnik <bkoz@redhat.com>
+
+ * g++.dg/cpp0x/constexpr-initlist2.C: New.
+ * g++.dg/cpp0x/constexpr-initlist3.C: New.
+
+ * g++.dg/cpp0x/constexpr-array-ptr.C: New.
+ * g++.dg/cpp0x/constexpr-array-ptr2.C: New.
+ * g++.dg/cpp0x/constexpr-array-ptr3.C: New.
+ * g++.dg/cpp0x/constexpr-array-ptr4.C: New.
+ * g++.dg/cpp0x/constexpr-array-ptr5.C: New.
+ * g++.dg/cpp0x/constexpr-array-ptr6.C: New.
+ * g++.dg/cpp0x/constexpr-array.C: New.
+ * g++.dg/cpp0x/constexpr-base.C: New.
+ * g++.dg/cpp0x/constexpr-complex.C: New.
+ * g++.dg/cpp0x/constexpr-data1.C: New.
+ * g++.dg/cpp0x/constexpr-data2.C: New.
+ * g++.dg/cpp0x/constexpr-deref.C: New.
+ * g++.dg/cpp0x/constexpr-diag1.C: New.
+ * g++.dg/cpp0x/constexpr-eh-spec.C: New.
+ * g++.dg/cpp0x/constexpr-ellipsis.C: New.
+ * g++.dg/cpp0x/constexpr-ellipsis2.C: New.
+ * g++.dg/cpp0x/constexpr-empty.C: New.
+ * g++.dg/cpp0x/constexpr-empty2.C: New.
+ * g++.dg/cpp0x/constexpr-empty3.C: New.
+ * g++.dg/cpp0x/constexpr-empty4.C: New.
+ * g++.dg/cpp0x/constexpr-empty5.C: New.
+ * g++.dg/cpp0x/constexpr-ex1.C: New.
+ * g++.dg/cpp0x/constexpr-ex2.C: New.
+ * g++.dg/cpp0x/constexpr-ex3.C: New.
+ * g++.dg/cpp0x/constexpr-ex4.C: New.
+ * g++.dg/cpp0x/constexpr-explicit-inst.C: New.
+ * g++.dg/cpp0x/constexpr-fnptr.C: New.
+ * g++.dg/cpp0x/constexpr-function1.C: New.
+ * g++.dg/cpp0x/constexpr-function2.C: New.
+ * g++.dg/cpp0x/constexpr-function3.C: New.
+ * g++.dg/cpp0x/constexpr-ice.C: New.
+ * g++.dg/cpp0x/constexpr-initlist.C: New.
+ * g++.dg/cpp0x/constexpr-neg1.C: New.
+ * g++.dg/cpp0x/constexpr-noexcept.C: New.
+ * g++.dg/cpp0x/constexpr-noexcept2.C: New.
+ * g++.dg/cpp0x/constexpr-noexcept3.C: New.
+ * g++.dg/cpp0x/constexpr-noexcept4.C: New.
+ * g++.dg/cpp0x/constexpr-non-const-arg.C: New.
+ * g++.dg/cpp0x/constexpr-nonlit.C: New.
+ * g++.dg/cpp0x/constexpr-nonlit2.C: New.
+ * g++.dg/cpp0x/constexpr-nullptr.C: New.
+ * g++.dg/cpp0x/constexpr-object1.C: New.
+ * g++.dg/cpp0x/constexpr-object2.C: New.
+ * g++.dg/cpp0x/constexpr-overflow.C: New.
+ * g++.dg/cpp0x/constexpr-pedantic.C: New.
+ * g++.dg/cpp0x/constexpr-pos1.C: New.
+ * g++.dg/cpp0x/constexpr-potential1.C: New.
+ * g++.dg/cpp0x/constexpr-ptrmem.C: New.
+ * g++.dg/cpp0x/constexpr-pure.C: New.
+ * g++.dg/cpp0x/constexpr-static.C: New.
+ * g++.dg/cpp0x/constexpr-static2.C: New.
+ * g++.dg/cpp0x/constexpr-static3.C: New.
+ * g++.dg/cpp0x/constexpr-static4.C: New.
+ * g++.dg/cpp0x/constexpr-static5.C: New.
+ * g++.dg/cpp0x/constexpr-static6.C: New.
+ * g++.dg/cpp0x/constexpr-string.C: New.
+ * g++.dg/cpp0x/constexpr-switch.C: New.
+ * g++.dg/cpp0x/constexpr-targ.C: New.
+ * g++.dg/cpp0x/constexpr-throw.C: New.
+ * g++.dg/cpp0x/constexpr-typeid.C: New.
+ * g++.dg/cpp0x/constexpr-union.C: New.
+ * g++.dg/cpp0x/constexpr-value.C: New.
+ * g++.dg/cpp0x/constexpr-value2.C: New.
+ * g++.dg/cpp0x/constexpr-variadic.C: New.
+ * g++.dg/cpp0x/initlist5.C: Use constexpr.
+ * g++.dg/cpp0x/static_assert3.C: Add expected error.
+ * g++.dg/other/fold1.C: Likewise.
+ * g++.dg/parse/crash36.C: Likewise.
+ * g++.dg/parse/constant4.C: Adjust expected error.
+ * g++.dg/template/arg5.C: Likewise.
+ * g++.dg/template/non-dependent10.C: Likewise.
+ * g++.dg/template/qualified-id3.C: Likewise.
+ * g++.dg/warn/overflow-warn-1.C: Likewise.
+ * g++.dg/warn/overflow-warn-3.C: Likewise.
+ * g++.dg/warn/overflow-warn-4.C: Likewise.
+ * g++.old-deja/g++.pt/crash10.C: Likewise.
+
+ * g++.dg/cpp0x/constexpr-ctor2.C: New.
+
+2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Implemented format and noreturn attributes for Objective-C methods.
+ * objc.dg/attributes/method-attribute-2.m: Updated warnings.
+ * objc.dg/attributes/method-deprecated-1.m: New.
+ * objc.dg/attributes/method-deprecated-2.m: New.
+ * objc.dg/attributes/method-deprecated-3.m: New.
+ * objc.dg/attributes/method-noreturn-1.m: New.
+ * objc.dg/attributes/method-sentinel-1.m: New.
+ * objc.dg/attributes/method-format-1.m: New.
+ * obj-c++.dg/attributes/method-attribute-2.mm: Updated warnings.
+ * obj-c++.dg/attributes/method-deprecated-1.mm: New.
+ * obj-c++.dg/attributes/method-deprecated-2.mm: New.
+ * obj-c++.dg/attributes/method-deprecated-3.mm: New.
+ * obj-c++.dg/attributes/method-noreturn-1.mm: New.
+ * obj-c++.dg/attributes/method-sentinel-1.mm: New.
+ * obj-c++.dg/attributes/method-format-1.mm: New.
+
+2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc.dg/property/at-property-deprecated-1.m: New.
+ * obj-c++.dg/property/at-property-deprecated-1.mm: New.
+
+2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Implemented Objective-C 2.0 property accessors.
+ * objc.dg/property/at-property-6.m: Use nonatomic properties to
+ avoid testing more complex accessors in this testcase which is not
+ about them.
+ * objc.dg/property/at-property-7.m: Same change.
+ * objc.dg/property/at-property-8.m: Same change.
+ * objc.dg/property/at-property-9.m: Same change.
+ * objc.dg/property/at-property-10.m: Same change.
+ * objc.dg/property/at-property-11.m: Same change.
+ * obj-c++.dg/property/at-property-6.mm: Same change.
+ * obj-c++.dg/property/at-property-7.mm: Same change.
+ * obj-c++.dg/property/at-property-8.mm: Same change.
+ * obj-c++.dg/property/at-property-9.mm: Same change.
+ * obj-c++.dg/property/at-property-10.mm: Same change.
+ * obj-c++.dg/property/at-property-11.mm: Same change.
+ * objc.dg/property/at-property-12.m: New.
+ * objc.dg/property/at-property-13.m: New.
+ * obj-c++.dg/property/at-property-12.mm: New.
+ * obj-c++.dg/property/at-property-13.mm: New.
+
+2010-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/46152
+ * gfortran.dg/select_type_11.f03: Update dg-error phrase.
+ * gfortran.dg/allocate_with_typespec_4.f90: New test.
+ * gfortran.dg/allocate_with_typespec_1.f90: New test.
+ * gfortran.dg/allocate_with_typespec_2.f: New test.
+ * gfortran.dg/allocate_with_typespec_3.f90: New test.
+ * gfortran.dg/allocate_derived_1.f90: Update dg-error phrase.
+ * gfortran.dg/select_type_1.f03: Update dg-error phrase.
+
+2010-11-01 H.J. Lu <hongjiu.lu@intel.com>
+ Nathan Froyd <froydnj@codesourcery.com>
+
+ PR tree-optimization/46259
+ * gfortran.dg/pr46259.f: New testcase.
+
+2010-11-01 Paul Koning <ni1d@arrl.net>
+
+ * gcc.c-torture/compile/20080625-1.c: Skip if pdp11.
+ * gcc.c-torture/compile/20020604-1.c: Ditto.
+ * gcc.c-torture/compile/20001226-1.c: Ditto.
+ * gcc.c-torture/compile/20010327-1.c: Ditto.
+ * gcc.c-torture/compile/limits-stringlit.c: Ditto.
+ * gcc.c-torture/compile/pr43191.c: Ditto.
+ * gcc.c-torture/compile/pr41181.c: Ditto.
+
2010-10-31 Richard Henderson <rth@redhat.com>
* lib/target-supports.exp
@@ -1207,8 +1364,6 @@
2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>
-2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com>
-
Merge from 'apple/trunk' branch on FSF servers.
2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
@@ -1272,10 +1427,6 @@
PR fortran/45889
* gfortran.dg/alloc_comp_constraint_6.f90: New test.
-2010-10-06 Eric Botcazou <ebotcazou@adacore.com>
-
- * g++.dg/cpp0x/pr45908.C: New test.
-
2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
@@ -1287,17 +1438,11 @@
2010-10-06 Eric Botcazou <ebotcazou@adacore.com>
- * gnat.dg/opt6.ad[sb]: New test.
-
-2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
-
- PR objc++/28050
- * obj-c++.dg/syntax-error-10.mm: New.
+ * g++.dg/cpp0x/pr45908.C: New test.
-2010-10-06 Hariharan Sandanagobalane <hariharan@picochip.com>
+2010-10-06 Eric Botcazou <ebotcazou@adacore.com>
- * gcc.c-torture/execute/cmpsi-2.c : Unsigned comparisons should use
- unsigned values.
+ * gnat.dg/opt6.ad[sb]: New test.
2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com>
@@ -1336,6 +1481,16 @@
Radar 4294910
* objc.dg/objc-foreach-1.m: New
+2010-10-06 Hariharan Sandanagobalane <hariharan@picochip.com>
+
+ * gcc.c-torture/execute/cmpsi-2.c : Unsigned comparisons should use
+ unsigned values.
+
+2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ PR objc++/28050
+ * obj-c++.dg/syntax-error-10.mm: New.
+
2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc++/23707
@@ -1346,11 +1501,6 @@
PR objc++/31126
* obj-c++.dg/syntax-error-8.mm: New.
-2010-10-05 Ira Rosen <irar@il.ibm.com>
-
- PR tree-optimization/45752
- * gcc.dg/vect/pr45752.c: New test.
-
2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
@@ -1380,6 +1530,11 @@
Radar 4185810
* obj-c++.dg/syntax-error-[1-2].mm: New.
+2010-10-05 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/45752
+ * gcc.dg/vect/pr45752.c: New test.
+
2010-10-05 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-prof/val-prof-1.c: Adjust.
@@ -1416,8 +1571,6 @@
PR debug/45849
* gcc.dg/debug/pr45849.c: New test.
-2010-10-04 Jakub Jelinek <jakub@redhat.com>
-
PR middle-end/45876
* gcc.c-torture/compile/pr45876.c: New test.
@@ -2712,12 +2865,6 @@
* gfortran.dg/iall_iany_iparity_1.f90: New.
* gfortran.dg/iall_iany_iparity_2.f90: New.
-2010-09-06 Jakub Jelinek <jakub@redhat.com>
-
- PR testsuite/45543
- * g++.dg/debug/dwarf2/typedef1.C: Expect just one
- DW_TAG_enumeration_type DIE.
-
2010-09-06 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist42.C: New.
@@ -8013,19 +8160,6 @@
* gcc.dg/ordered-comparison-3.c: New test.
* gcc.dg/ordered-comparison-4.c: New test.
-2009-12-03 Benjamin Kosnik <bkoz@redhat.com>
- Gabriel Dos Reis <gdr@cs.tamu.edu>
-
- * constexpr-data1.C: New.
- * constexpr-data2.C: New.
- * constexpr-ex1.C: New.
- * constexpr-ex2.C: New.
- * constexpr-function1.C: New.
- * constexpr-function2.C: New.
- * constexpr-function3.C: New.
- * constexpr-object1.C: New.
- * constexpr-object2.C: New.
-
2010-05-06 Mike Stump <mikestump@comcast.net>
PR objc/35165
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
index f2b53846ecb..c7757f47598 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
@@ -55,7 +55,7 @@ constexpr complex I(0, 1); // OK -- literal complex
// 2 invoked with non-const args
-double x5 = 1.0;
+double x5 = 1.0; // { dg-message "not declared .constexpr" }
constexpr complex unit(x5, 0); // { dg-error "x5|argument" } error: x5 non-constant
const complex one(x5, 0); // OK, ‘‘ordinary const’’ -- dynamic
// initialization
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C
index 597603c39a4..08552cd7de7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C
@@ -15,7 +15,7 @@ struct B
constexpr B(T _t): t(_t) { }
};
-B<int> b(1);
+B<int> b(1); // { dg-message "not declared .constexpr" }
SA(b.t==1); // { dg-error "non-constant condition|'b'" }
constexpr B<int> b2(1);
SA(b2.t==1);
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C
index 5e0c101b2ba..a902e0e226c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C
@@ -17,7 +17,7 @@ inline constexpr double
squared(double x) { return x * x; }
constexpr int squarei(int x) { return x * x; }
-extern const int side;
+extern const int side; // { dg-message "not initialized with a constant expression" }
constexpr int area = squarei(side); // { dg-error "side|argument" }
// error: squarei(side) is not a constant expression
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
index ce01f8b5d44..8294afa9837 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
@@ -18,7 +18,7 @@ constexpr pixel::pixel(int a)
// error: square not defined, so small(2) not constant (5.19), so constexpr
// not satisfied
-constexpr pixel small(2); // { dg-error "" }
+constexpr pixel small(2); // { dg-message "in constexpr expansion" }
// error: not for parameters
int next(constexpr int x) { // { dg-error "parameter" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C
index 2c53595833e..7637c0a05bc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C
@@ -7,7 +7,7 @@ struct B {
int i;
};
-int global; // not constant
+int global; // { dg-message "not const" }
struct D : B {
constexpr D() : B(global) { } // { dg-error "global|argument" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
index 345b24097b1..f1ef9dc7d0d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C
@@ -4,5 +4,5 @@ constexpr int may_throw(bool decide) {
return decide ? 42 : throw -1; // { dg-error "throw" }
}
-constexpr int x = may_throw(false); // { dg-error "may_throw" }
+constexpr int x = may_throw(false); // { dg-message "may_throw" }
constexpr int y = may_throw(true);
diff --git a/gcc/testsuite/g++.dg/parse/constant4.C b/gcc/testsuite/g++.dg/parse/constant4.C
index b2c112ce714..4d9814fb485 100644
--- a/gcc/testsuite/g++.dg/parse/constant4.C
+++ b/gcc/testsuite/g++.dg/parse/constant4.C
@@ -16,7 +16,7 @@ void Foo ()
Y<I> i;
- static const unsigned J = X<T>::J;
+ static const unsigned J = X<T>::J; // { dg-message "not initialized with a constant expression" }
Y<J> j; // { dg-error "constant" "" }
}
diff --git a/gcc/testsuite/g++.dg/template/qualified-id3.C b/gcc/testsuite/g++.dg/template/qualified-id3.C
index 1fc1cc32050..bbfb51e4ce1 100644
--- a/gcc/testsuite/g++.dg/template/qualified-id3.C
+++ b/gcc/testsuite/g++.dg/template/qualified-id3.C
@@ -2,7 +2,7 @@
template <const int N> struct A { };
template <class T> struct B {
- static const int c;
+ static const int c; // { dg-message "not initialized with a constant expression" }
typedef A<B<T>::c> C; // { dg-error "constant expression" }
};
template <class T> const int B<T>::c = sizeof (T);
diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
index 7cf963f0ac7..8c93baccda9 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c
@@ -3,6 +3,7 @@
/* { dg-do assemble } */
/* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */
/* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "too much code for pdp11" { "pdp11-*-*" } { "*" } { "" } } */
/* { dg-xfail-if "jump beyond 128K not supported" { xtensa*-*-* } { "-O0" } { "" } } */
/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */
/* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c
index f20e3a3e2dc..ce68f78df1d 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c
@@ -1,5 +1,6 @@
/* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */
/* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "HI mode pointer for pdp11" { "pdp11-*-*" } { "*" } { "" } } */
/* { dg-skip-if "non-SI pointers for w64" { "x86_64-*-mingw*" } { "*" } { "" } } */
/* This testcase tests whether GCC can produce static initialized data
diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c
index 17b9b2165ba..8b958040e3c 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c
@@ -1,6 +1,6 @@
/* { dg-do assemble } */
/* { dg-xfail-if "The array is too big" { "m6811-*-* m6812-*-*" } { "*" } { "" } } */
-/* { dg-skip-if "The array is too big" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */
/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */
/* { dg-skip-if "" { m32c-*-* } { } { } } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c
index e656cd4f58e..16def2c8a37 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c
@@ -1,4 +1,4 @@
-/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" "pdp11-*-*" } { "*" } { "" } } */
struct peakbufStruct {
unsigned int lnum [5000];
int lscan [5000][4000];
diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c
index 75b824d1987..41fa2f14022 100644
--- a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c
+++ b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c
@@ -1,4 +1,4 @@
-/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* } { "*" } { "" } } */
+/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* pdp11-*-* } { "*" } { "" } } */
#define STR2 "012345678901234567890123456789012345678901234567890123456789\
0123456789012345678901234567890123456789"
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41181.c b/gcc/testsuite/gcc.c-torture/compile/pr41181.c
index 9e42f420939..5fafb020ea5 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr41181.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr41181.c
@@ -1,4 +1,4 @@
-/* { dg-skip-if "The array is too big" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */
char paths[1024];
static void x264_slicetype_path(char (*best_paths)[250], int n, int length)
{
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43191.c b/gcc/testsuite/gcc.c-torture/compile/pr43191.c
index 9c8d1444cf9..f4ec0b4770d 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr43191.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr43191.c
@@ -1,3 +1,4 @@
+/* { dg-skip-if "Ints are 16 bits" { "pdp11-*-*" } { "*" } { "" } } */
struct S0
{
};
diff --git a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
index b9f6d5580a0..d2c65ffa38b 100644
--- a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90
@@ -32,7 +32,7 @@
allocate(t1 :: x(2))
allocate(t2 :: x(3))
allocate(t3 :: x(4))
- allocate(tx :: x(5)) ! { dg-error "is not an accessible derived type" }
+ allocate(tx :: x(5)) ! { dg-error "Error in type-spec at" }
allocate(u0 :: x(6)) ! { dg-error "may not be ABSTRACT" }
allocate(v1 :: x(7)) ! { dg-error "is type incompatible with typespec" }
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90
new file mode 100644
index 00000000000..945a80e4afd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90
@@ -0,0 +1,121 @@
+! { dg-do compile }
+!
+! Allocation of arrays with a type-spec specification with implicit none.
+!
+subroutine implicit_none_test1
+
+ implicit none
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+ character(len=4), allocatable :: c2(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(real :: x(1))
+ allocate(real(4) :: x4(1))
+ allocate(real(8) :: x8(1))
+ allocate(double precision :: d1(1))
+ allocate(doubleprecision :: d2(1))
+ allocate(character :: c1(1))
+ allocate(character(len=4) :: c2(1))
+ allocate(a :: b(1))
+
+end subroutine implicit_none_test1
+!
+! Allocation of a scalar with a type-spec specification with implicit none
+!
+subroutine implicit_none_test2
+
+ implicit none
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ doubleprecision, allocatable :: d2
+ character, allocatable :: c1
+ character(len=4), allocatable :: c2
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(real :: x)
+ allocate(real(4) :: x4)
+ allocate(real(8) :: x8)
+ allocate(double precision :: d1)
+ allocate(doubleprecision :: d2)
+ allocate(character :: c1)
+ allocate(character(len=4) :: c2)
+ allocate(a :: b)
+
+end subroutine implicit_none_test2
+!
+! Allocation of arrays with a type-spec specification with implicit none.
+!
+subroutine implicit_test3
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+ character(len=4), allocatable :: c2(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(real :: x(1))
+ allocate(real(4) :: x4(1))
+ allocate(real(8) :: x8(1))
+ allocate(double precision :: d1(1))
+ allocate(doubleprecision :: d2(1))
+ allocate(character :: c1(1))
+ allocate(character(len=4) :: c2(1))
+ allocate(a :: b(1))
+
+end subroutine implicit_test3
+!
+! Allocation of a scalar with a type-spec specification without implicit none
+!
+subroutine implicit_test4
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ doubleprecision, allocatable :: d2
+ character, allocatable :: c1
+ character(len=4), allocatable :: c2
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(real :: x)
+ allocate(real(4) :: x4)
+ allocate(real(8) :: x8)
+ allocate(double precision :: d1)
+ allocate(doubleprecision :: d2)
+ allocate(character :: c1)
+ allocate(character(len=4) :: c2)
+ allocate(a :: b)
+
+end subroutine implicit_test4
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f b/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f
new file mode 100644
index 00000000000..51d1afad08c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f
@@ -0,0 +1,121 @@
+C { dg-do compile }
+C
+C Allocation of arrays with a type-spec specification with implicit none.
+C
+ subroutine implicit_none_test1
+
+ implicit none
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+ character(len=4), allocatable :: c2(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(real :: x(1))
+ allocate(real(4) :: x4(1))
+ allocate(real(8) :: x8(1))
+ allocate(double precision :: d1(1))
+ allocate(doubleprecision :: d2(1))
+ allocate(character :: c1(1))
+ allocate(character(len=4) :: c2(1))
+ allocate(a :: b(1))
+
+ end
+C
+C Allocation of a scalar with a type-spec specification with implicit none
+C
+ subroutine implicit_none_test2
+
+ implicit none
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ doubleprecision, allocatable :: d2
+ character, allocatable :: c1
+ character(len=4), allocatable :: c2
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(real :: x)
+ allocate(real(4) :: x4)
+ allocate(real(8) :: x8)
+ allocate(double precision :: d1)
+ allocate(doubleprecision :: d2)
+ allocate(character :: c1)
+ allocate(character(len=4) :: c2)
+ allocate(a :: b)
+
+ end subroutine implicit_none_test2
+C
+C Allocation of arrays with a type-spec specification with implicit none.
+C
+ subroutine implicit_test3
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+ character(len=4), allocatable :: c2(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(real :: x(1))
+ allocate(real(4) :: x4(1))
+ allocate(real(8) :: x8(1))
+ allocate(double precision :: d1(1))
+ allocate(doubleprecision :: d2(1))
+ allocate(character :: c1(1))
+ allocate(character(len=4) :: c2(1))
+ allocate(a :: b(1))
+
+ end
+C
+C Allocation of a scalar with a type-spec specification without implicit none
+C
+ subroutine implicit_test4
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ doubleprecision, allocatable :: d2
+ character, allocatable :: c1
+ character(len=4), allocatable :: c2
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(real :: x)
+ allocate(real(4) :: x4)
+ allocate(real(8) :: x8)
+ allocate(double precision :: d1)
+ allocate(doubleprecision :: d2)
+ allocate(character :: c1)
+ allocate(character(len=4) :: c2)
+ allocate(a :: b)
+
+ end
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90
new file mode 100644
index 00000000000..57f8a110e8f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90
@@ -0,0 +1,107 @@
+! { dg-do compile }
+!
+! Allocation of arrays with a type-spec specification with implicit none.
+!
+subroutine implicit_none_test1
+
+ implicit none
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(complex :: x(1)) ! { dg-error "is type incompatible" }
+ allocate(real(8) :: x4(1)) ! { dg-error "differs from the kind type parameter" }
+ allocate(real(4) :: x8(1)) ! { dg-error "differs from the kind type parameter" }
+ allocate(double :: d1(1)) ! { dg-error "Error in type-spec at" }
+ allocate(character(:) :: c1(1)) ! { dg-error "Syntax error in CHARACTER declaration" }
+ allocate(real :: b(1)) ! { dg-error "is type incompatible" }
+
+end subroutine implicit_none_test1
+!
+! Allocation of a scalar with a type-spec specification with implicit none
+!
+subroutine implicit_none_test2
+
+ implicit none
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ character, allocatable :: c1
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(complex :: x) ! { dg-error "is type incompatible" }
+ allocate(real(8) :: x4) ! { dg-error "differs from the kind type parameter" }
+ allocate(real(4) :: x8) ! { dg-error "differs from the kind type parameter" }
+ allocate(double :: d1) ! { dg-error "Error in type-spec at" }
+ allocate(character(:) :: c1) ! { dg-error "Syntax error in CHARACTER declaration" }
+ allocate(real :: b) ! { dg-error "is type incompatible" }
+
+end subroutine implicit_none_test2
+!
+! Allocation of arrays with a type-spec specification with implicit none.
+!
+subroutine implicit_test3
+
+ real, allocatable :: x(:)
+ real(4), allocatable :: x4(:)
+ real(8), allocatable :: x8(:)
+ double precision, allocatable :: d1(:)
+ doubleprecision, allocatable :: d2(:)
+ character, allocatable :: c1(:)
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b(:)
+
+ allocate(complex :: x(1)) ! { dg-error "is type incompatible" }
+ allocate(real(8) :: x4(1)) ! { dg-error "differs from the kind type parameter" }
+ allocate(real(4) :: x8(1)) ! { dg-error "differs from the kind type parameter" }
+ allocate(double :: d1(1)) ! { dg-error "Error in type-spec" }
+ allocate(character(:) :: c1(1)) ! { dg-error "Syntax error in CHARACTER declaration" }
+ allocate(real :: b(1)) ! { dg-error "is type incompatible" }
+
+end subroutine implicit_test3
+!
+! Allocation of a scalar with a type-spec specification without implicit none
+!
+subroutine implicit_test4
+
+ real, allocatable :: x
+ real(4), allocatable :: x4
+ real(8), allocatable :: x8
+ double precision, allocatable :: d1
+ character, allocatable :: c1
+
+ type a
+ integer mytype
+ end type a
+
+ type(a), allocatable :: b
+
+ allocate(complex :: x) ! { dg-error "is type incompatible" }
+ allocate(real(8) :: x4) ! { dg-error "differs from the kind type parameter" }
+ allocate(real(4) :: x8) ! { dg-error "differs from the kind type parameter" }
+ allocate(double :: d1) ! { dg-error "Error in type-spec at" }
+ allocate(character(:) :: c1) ! { dg-error "Syntax error in CHARACTER declaration" }
+ allocate(real :: b) ! { dg-error "is type incompatible" }
+
+end subroutine implicit_test4
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90
new file mode 100644
index 00000000000..327f28dcdc9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-options "-w" }
+subroutine not_an_f03_intrinsic
+
+ implicit none
+
+ byte, allocatable :: x, y(:)
+ real*8, allocatable :: x8, y8(:)
+ double complex :: z
+
+ type real_type
+ integer mytype
+ end type real_type
+
+ type(real_type), allocatable :: b, c(:)
+
+ allocate(byte :: x) ! { dg-error "Error in type-spec at" }
+ allocate(byte :: y(1)) ! { dg-error "Error in type-spec at" }
+
+ allocate(real*8 :: x) ! { dg-error "Invalid type-spec at" }
+ allocate(real*8 :: y(1)) ! { dg-error "Invalid type-spec at" }
+ allocate(real*4 :: x8) ! { dg-error "Invalid type-spec at" }
+ allocate(real*4 :: y8(1)) ! { dg-error "Invalid type-spec at" }
+ allocate(double complex :: d1) ! { dg-error "not a nonprocedure pointer or an allocatable" }
+ allocate(real_type :: b)
+ allocate(real_type :: c(1))
+
+end subroutine not_an_f03_intrinsic
diff --git a/gcc/testsuite/gfortran.dg/pr46259.f b/gcc/testsuite/gfortran.dg/pr46259.f
new file mode 100644
index 00000000000..d74e549a248
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr46259.f
@@ -0,0 +1,19 @@
+! PR tree-optimization/46259
+! { dg-do compile }
+! { dg-options "-O3" }
+ SUBROUTINE RDSTFR(FRGMNT,IFRAG,PROVEC,FOCKMA,
+ * MXBF,MXMO,MXMO2,NTMOF)
+ PARAMETER (MXPT=100, MXFRG=50, MXFGPT=MXPT*MXFRG)
+ CHARACTER*8 WORD,MNAME,PNAME,RNAME
+ COMMON /FRGSTD/ CORD(3,MXPT),PCORD(3,MXPT),POLT(9,MXPT),
+ * INLPR(4*MXPT),IKFR(MXPT),IKLR(MXPT),
+ * MNAME(MXPT),PNAME(MXPT),RNAME(MXPT)
+ DO 10 I=1,MXPT
+ INLPR(4*(I-1)+1)=0
+ INLPR(4*(I-1)+2)=0
+ INLPR(4*(I-1)+3)=0
+ INLPR(4*(I-1)+4)=0
+ IKLR(I)=0
+ RNAME(I)=' '
+ 10 CONTINUE
+ END
diff --git a/gcc/testsuite/gfortran.dg/select_type_1.f03 b/gcc/testsuite/gfortran.dg/select_type_1.f03
index 840dde922f2..af0db3c84e3 100644
--- a/gcc/testsuite/gfortran.dg/select_type_1.f03
+++ b/gcc/testsuite/gfortran.dg/select_type_1.f03
@@ -45,7 +45,7 @@
print *,"a is TYPE(ts)"
type is (t3) ! { dg-error "must be an extension of" }
print *,"a is TYPE(t3)"
- type is (t4) ! { dg-error "is not an accessible derived type" }
+ type is (t4) ! { dg-error "error in TYPE IS specification" }
print *,"a is TYPE(t3)"
class is (t1)
print *,"a is CLASS(t1)"
diff --git a/gcc/testsuite/gfortran.dg/select_type_11.f03 b/gcc/testsuite/gfortran.dg/select_type_11.f03
index 54501d6ab1e..c3bd9bac8d5 100644
--- a/gcc/testsuite/gfortran.dg/select_type_11.f03
+++ b/gcc/testsuite/gfortran.dg/select_type_11.f03
@@ -19,7 +19,7 @@ contains
class(vector_class), intent(in) :: v
select type (v)
- class is (bad_id) ! { dg-error "is not an accessible derived type" }
+ class is (bad_id) ! { dg-error " error in CLASS IS specification" }
this%elements(:) = v%elements(:) ! { dg-error "is not a member of" }
end select
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
index f9a184cdf41..4a56b3aa8f6 100644
--- a/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
@@ -14,7 +14,7 @@
@end
@implementation obj
-- (int) depmth __attribute__((deprecated)) { return var; }
+- (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes can not be specified in @implementation context" } */
- (int) depmtharg:(int) iarg { return var + iarg ; }
- (int) unusedarg:(int) __attribute__((unused)) uarg { return var; }
- (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm
new file mode 100644
index 00000000000..8343856a5c6
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm
@@ -0,0 +1,33 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) method;
+- (int) method;
++ (int) deprecatedClassMethod __attribute__((deprecated));
+- (int) deprecatedInstanceMethod __attribute__((deprecated));
+@end
+
+/* Test that deprecation warnings are produced, but not if the
+ receiver is of type 'id'. */
+void foo (void)
+{
+ Class c;
+ id object;
+ MyClass *another_object;
+
+ [c method];
+ [object method];
+ [c deprecatedClassMethod];
+ [object deprecatedInstanceMethod];
+
+ [object method];
+ [another_object method];
+ [MyClass deprecatedClassMethod]; /* { dg-warning "is deprecated" } */
+ [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm
new file mode 100644
index 00000000000..1e5d87f3e63
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm
@@ -0,0 +1,23 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((deprecated));
+- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((deprecated));
+@end
+
+/* Test that deprecation warnings are produced even if the method is
+ also marked with another attribute too (this is to test the
+ processing of multiple attributes). */
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */
+ [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm
new file mode 100644
index 00000000000..5c715a20b68
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm
@@ -0,0 +1,21 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+/* Test that __attribute__ ((__deprecated__)) works as well as __attribute__ ((deprecated)). */
+@interface MyClass
+{
+ Class isa;
+}
++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((__deprecated__));
+- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((__deprecated__));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */
+ [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
new file mode 100644
index 00000000000..0a078ff0a3a
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
@@ -0,0 +1,43 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface LogObject
+{
+ Class isa;
+}
++ (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3)));
+- (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3)));
+
++ (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2)));
+- (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2)));
+
+/* Just make sure a missing or invalid attribute won't crash the compiler. */
+- (void) log2: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2))); /* { dg-error "wrong" } */
++ (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */
+- (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */
++ (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */
+- (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */
+@end
+
+void test (LogObject *object)
+{
+ [object log: 2 message: "attribute only applies to variadic functions"];
+ [object log: 2 message: "attribute %s only applies to variadic functions", "'format'"];
+ [object log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [object debug: "attribute only applies to variadic functions"];
+ [object debug: "attribute %s only applies to variadic functions", "'format'"];
+ [object debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [LogObject log: 2 message: "attribute only applies to variadic functions"];
+ [LogObject log: 2 message: "attribute %s only applies to variadic functions", "'format'"];
+ [LogObject log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [LogObject debug: "attribute only applies to variadic functions"];
+ [LogObject debug: "attribute %s only applies to variadic functions", "'format'"];
+ [LogObject debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm
new file mode 100644
index 00000000000..af051a61d34
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm
@@ -0,0 +1,34 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (id) method1 __attribute__ ((noreturn));
+- (id) method2 __attribute__ ((noreturn));
++ (id) method3 __attribute__ ((noreturn));
+- (id) method4 __attribute__ ((noreturn));
+@end
+
+@implementation MyClass
++ (id) method1
+{
+ return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
+} /* { dg-warning ".noreturn. function does return" } */
+- (id) method2
+{
+ return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
+} /* { dg-warning ".noreturn. function does return" } */
++ (id) method3
+{
+ abort ();
+}
+- (id) method4
+{
+ abort ();
+}
+@end
diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm
new file mode 100644
index 00000000000..ecaa36c21f8
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm
@@ -0,0 +1,34 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface NSArray
+{
+ Class isa;
+}
++ (id) arrayWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */
++ (id) arrayWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
+
+- (id) initWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */
+- (id) initWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
+@end
+
+void test (id object)
+{
+ NSArray *array;
+
+ array = [NSArray arrayWithObject: object];
+ array = [NSArray arrayWithObjects: object, nil];
+ array = [NSArray arrayWithObjects: object, object, nil];
+ array = [NSArray arrayWithObjects: object]; /* { dg-warning "not enough variable arguments" } */
+ array = [NSArray arrayWithObjects: object, object]; /* { dg-warning "missing sentinel" } */
+
+ [array initWithObject: object];
+ [array initWithObjects: object, nil];
+ [array initWithObjects: object, object, nil];
+ [array initWithObjects: object]; /* { dg-warning "not enough variable arguments" } */
+ [array initWithObjects: object, object]; /* { dg-warning "missing sentinel" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-10.mm b/gcc/testsuite/obj-c++.dg/property/at-property-10.mm
index f130292bb0f..83494ec3bcc 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-10.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-10.mm
@@ -12,7 +12,7 @@
Class isa;
int a;
}
-@property int a;
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-11.mm b/gcc/testsuite/obj-c++.dg/property/at-property-11.mm
index 36da7bf2794..82880521680 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-11.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-11.mm
@@ -12,7 +12,7 @@
Class isa;
int a;
}
-@property int a;
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-12.mm b/gcc/testsuite/obj-c++.dg/property/at-property-12.mm
new file mode 100644
index 00000000000..8d28bde9668
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-12.mm
@@ -0,0 +1,46 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do run } */
+
+/* Test atomic, assign synthesized methods. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+ id b;
+}
+@property int a;
+@property (assign) id b;
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@synthesize b;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40;
+ if (object.a != 40)
+ abort ();
+
+ object.b = object;
+ if (object.b != object)
+ abort ();
+
+ return (0);
+}
+
+
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-13.mm b/gcc/testsuite/obj-c++.dg/property/at-property-13.mm
new file mode 100644
index 00000000000..5a5dcbbf63c
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-13.mm
@@ -0,0 +1,71 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do run } */
+
+/* Test retain and copy synthesized methods. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int copy_count;
+ id a;
+ id b;
+}
+@property (copy) id a;
+@property (retain) id b;
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+- (id) copyWithZone: (void *)zone;
+- (int) copyCount;
+- (id) autorelease;
+- (oneway void) release;
+- (id) retain;
+@end
+
+/* This class implements copyWithZone, which doesn't do anything other
+ than increasing a counter of how many copies were made. */
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+- (id) copyWithZone: (void *)zone { copy_count++; return self; }
+- (int) copyCount { return copy_count; }
+- (id) autorelease { return self; }
+- (oneway void) release { return; }
+- (id) retain { return self; }
+@synthesize a;
+@synthesize b;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+ MyRootClass *argument = [[MyRootClass alloc] init];
+
+ /* This should copy argument. */
+ object.a = argument;
+ if (object.a != argument)
+ abort ();
+
+ /* Test that it was copied. */
+ if ([object.a copyCount] != 1)
+ abort ();
+
+ /* We just test that the retain accessors seem to work and that they
+ don't copy. We don't test that retain was actually called,
+ because if garbage collection is enabled, it may never be
+ called! */
+ object.b = argument;
+ if (object.b != argument)
+ abort ();
+
+ /* Test that it was not copied. */
+ if ([object.b copyCount] != 1)
+ abort ();
+
+ return (0);
+}
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-6.mm b/gcc/testsuite/obj-c++.dg/property/at-property-6.mm
index 3f1f0d3abe0..8b7346b95af 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-6.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-6.mm
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property int a;
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-7.mm b/gcc/testsuite/obj-c++.dg/property/at-property-7.mm
index cae04dee498..bace2420e57 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-7.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-7.mm
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property (getter = getA) int a;
+@property (getter = getA, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-8.mm b/gcc/testsuite/obj-c++.dg/property/at-property-8.mm
index ec37052989a..a290dd3df35 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-8.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-8.mm
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property (setter = writeA:) int a;
+@property (setter = writeA:, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-9.mm b/gcc/testsuite/obj-c++.dg/property/at-property-9.mm
index 12e9ffde872..be52e37f5d0 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-9.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-9.mm
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property (getter = giveMeA, setter = writeA:) int a;
+@property (getter = giveMeA, setter = writeA:, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm b/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm
new file mode 100644
index 00000000000..1bcb28820a6
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm
@@ -0,0 +1,37 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+/* Test that properties can be deprecated. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+}
+@property int a __attribute__((deprecated));
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */
+ if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */
+ abort ();
+
+ return (0);
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-attribute-2.m b/gcc/testsuite/objc.dg/attributes/method-attribute-2.m
index f9a184cdf41..4a56b3aa8f6 100644
--- a/gcc/testsuite/objc.dg/attributes/method-attribute-2.m
+++ b/gcc/testsuite/objc.dg/attributes/method-attribute-2.m
@@ -14,7 +14,7 @@
@end
@implementation obj
-- (int) depmth __attribute__((deprecated)) { return var; }
+- (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes can not be specified in @implementation context" } */
- (int) depmtharg:(int) iarg { return var + iarg ; }
- (int) unusedarg:(int) __attribute__((unused)) uarg { return var; }
- (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }
diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m
new file mode 100644
index 00000000000..8343856a5c6
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m
@@ -0,0 +1,33 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) method;
+- (int) method;
++ (int) deprecatedClassMethod __attribute__((deprecated));
+- (int) deprecatedInstanceMethod __attribute__((deprecated));
+@end
+
+/* Test that deprecation warnings are produced, but not if the
+ receiver is of type 'id'. */
+void foo (void)
+{
+ Class c;
+ id object;
+ MyClass *another_object;
+
+ [c method];
+ [object method];
+ [c deprecatedClassMethod];
+ [object deprecatedInstanceMethod];
+
+ [object method];
+ [another_object method];
+ [MyClass deprecatedClassMethod]; /* { dg-warning "is deprecated" } */
+ [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m
new file mode 100644
index 00000000000..1e5d87f3e63
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m
@@ -0,0 +1,23 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((deprecated));
+- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((deprecated));
+@end
+
+/* Test that deprecation warnings are produced even if the method is
+ also marked with another attribute too (this is to test the
+ processing of multiple attributes). */
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */
+ [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m
new file mode 100644
index 00000000000..5c715a20b68
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m
@@ -0,0 +1,21 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+/* Test that __attribute__ ((__deprecated__)) works as well as __attribute__ ((deprecated)). */
+@interface MyClass
+{
+ Class isa;
+}
++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((__deprecated__));
+- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((__deprecated__));
+@end
+
+void foo (void)
+{
+ MyClass *object = nil;
+
+ [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */
+ [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-format-1.m b/gcc/testsuite/objc.dg/attributes/method-format-1.m
new file mode 100644
index 00000000000..0a078ff0a3a
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-format-1.m
@@ -0,0 +1,43 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface LogObject
+{
+ Class isa;
+}
++ (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3)));
+- (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3)));
+
++ (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2)));
+- (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2)));
+
+/* Just make sure a missing or invalid attribute won't crash the compiler. */
+- (void) log2: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2))); /* { dg-error "wrong" } */
++ (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */
+- (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */
++ (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */
+- (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */
+@end
+
+void test (LogObject *object)
+{
+ [object log: 2 message: "attribute only applies to variadic functions"];
+ [object log: 2 message: "attribute %s only applies to variadic functions", "'format'"];
+ [object log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [object debug: "attribute only applies to variadic functions"];
+ [object debug: "attribute %s only applies to variadic functions", "'format'"];
+ [object debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [LogObject log: 2 message: "attribute only applies to variadic functions"];
+ [LogObject log: 2 message: "attribute %s only applies to variadic functions", "'format'"];
+ [LogObject log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+
+ [LogObject debug: "attribute only applies to variadic functions"];
+ [LogObject debug: "attribute %s only applies to variadic functions", "'format'"];
+ [LogObject debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */
+}
diff --git a/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m b/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m
new file mode 100644
index 00000000000..af051a61d34
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m
@@ -0,0 +1,34 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface MyClass
+{
+ Class isa;
+}
++ (id) method1 __attribute__ ((noreturn));
+- (id) method2 __attribute__ ((noreturn));
++ (id) method3 __attribute__ ((noreturn));
+- (id) method4 __attribute__ ((noreturn));
+@end
+
+@implementation MyClass
++ (id) method1
+{
+ return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
+} /* { dg-warning ".noreturn. function does return" } */
+- (id) method2
+{
+ return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
+} /* { dg-warning ".noreturn. function does return" } */
++ (id) method3
+{
+ abort ();
+}
+- (id) method4
+{
+ abort ();
+}
+@end
diff --git a/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m b/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m
new file mode 100644
index 00000000000..ecaa36c21f8
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m
@@ -0,0 +1,34 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+#include <objc/objc.h>
+#include <stdlib.h>
+
+@interface NSArray
+{
+ Class isa;
+}
++ (id) arrayWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */
++ (id) arrayWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
+
+- (id) initWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */
+- (id) initWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
+@end
+
+void test (id object)
+{
+ NSArray *array;
+
+ array = [NSArray arrayWithObject: object];
+ array = [NSArray arrayWithObjects: object, nil];
+ array = [NSArray arrayWithObjects: object, object, nil];
+ array = [NSArray arrayWithObjects: object]; /* { dg-warning "not enough variable arguments" } */
+ array = [NSArray arrayWithObjects: object, object]; /* { dg-warning "missing sentinel" } */
+
+ [array initWithObject: object];
+ [array initWithObjects: object, nil];
+ [array initWithObjects: object, object, nil];
+ [array initWithObjects: object]; /* { dg-warning "not enough variable arguments" } */
+ [array initWithObjects: object, object]; /* { dg-warning "missing sentinel" } */
+}
diff --git a/gcc/testsuite/objc.dg/property/at-property-10.m b/gcc/testsuite/objc.dg/property/at-property-10.m
index bc6380cd5a6..1a7a0430899 100644
--- a/gcc/testsuite/objc.dg/property/at-property-10.m
+++ b/gcc/testsuite/objc.dg/property/at-property-10.m
@@ -12,7 +12,10 @@
Class isa;
int a;
}
-@property int a;
+/* Use the simplest synthesized accessor (assign, nonatomic) as we are
+ not testing the synthesized accessors in this test, just the
+ property syntax. */
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-11.m b/gcc/testsuite/objc.dg/property/at-property-11.m
index 84857e0659a..2526a9cc1de 100644
--- a/gcc/testsuite/objc.dg/property/at-property-11.m
+++ b/gcc/testsuite/objc.dg/property/at-property-11.m
@@ -12,7 +12,10 @@
Class isa;
int a;
}
-@property int a;
+/* Use the simplest synthesized accessor (assign, nonatomic) as we are
+ not testing the synthesized accessors in this test, just the
+ property syntax. */
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-12.m b/gcc/testsuite/objc.dg/property/at-property-12.m
new file mode 100644
index 00000000000..e96b198282c
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/at-property-12.m
@@ -0,0 +1,46 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do run } */
+
+/* Test atomic, assign synthesized methods. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+ id b;
+}
+@property int a;
+@property (assign) id b;
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@synthesize b;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40;
+ if (object.a != 40)
+ abort ();
+
+ object.b = object;
+ if (object.b != object)
+ abort ();
+
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/objc.dg/property/at-property-13.m b/gcc/testsuite/objc.dg/property/at-property-13.m
new file mode 100644
index 00000000000..dfdb02f7127
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/at-property-13.m
@@ -0,0 +1,71 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do run } */
+
+/* Test retain and copy synthesized methods. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int copy_count;
+ id a;
+ id b;
+}
+@property (copy) id a;
+@property (retain) id b;
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+- (id) copyWithZone: (void *)zone;
+- (int) copyCount;
+- (id) autorelease;
+- (oneway void) release;
+- (id) retain;
+@end
+
+/* This class implements copyWithZone, which doesn't do anything other
+ than increasing a counter of how many copies were made. */
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+- (id) copyWithZone: (void *)zone { copy_count++; return self; }
+- (int) copyCount { return copy_count; }
+- (id) autorelease { return self; }
+- (oneway void) release { return; }
+- (id) retain { return self; }
+@synthesize a;
+@synthesize b;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+ MyRootClass *argument = [[MyRootClass alloc] init];
+
+ /* This should copy argument. */
+ object.a = argument;
+ if (object.a != argument)
+ abort ();
+
+ /* Test that it was copied. */
+ if ([object.a copyCount] != 1)
+ abort ();
+
+ /* We just test that the retain accessors seem to work and that they
+ don't copy. We don't test that retain was actually called,
+ because if garbage collection is enabled, it may never be
+ called! */
+ object.b = argument;
+ if (object.b != argument)
+ abort ();
+
+ /* Test that it was not copied. */
+ if ([object.b copyCount] != 1)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/property/at-property-6.m b/gcc/testsuite/objc.dg/property/at-property-6.m
index a97c0b05f67..079995c526a 100644
--- a/gcc/testsuite/objc.dg/property/at-property-6.m
+++ b/gcc/testsuite/objc.dg/property/at-property-6.m
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property int a;
+@property (nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-7.m b/gcc/testsuite/objc.dg/property/at-property-7.m
index dce27640781..6f182d0730e 100644
--- a/gcc/testsuite/objc.dg/property/at-property-7.m
+++ b/gcc/testsuite/objc.dg/property/at-property-7.m
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property (getter = getA) int a;
+@property (getter = getA, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-8.m b/gcc/testsuite/objc.dg/property/at-property-8.m
index eb158893724..94ed86e7f8b 100644
--- a/gcc/testsuite/objc.dg/property/at-property-8.m
+++ b/gcc/testsuite/objc.dg/property/at-property-8.m
@@ -13,7 +13,7 @@
Class isa;
int a;
}
-@property (setter = writeA:) int a;
+@property (setter = writeA:, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-9.m b/gcc/testsuite/objc.dg/property/at-property-9.m
index 203eb3003fd..6e2d118882f 100644
--- a/gcc/testsuite/objc.dg/property/at-property-9.m
+++ b/gcc/testsuite/objc.dg/property/at-property-9.m
@@ -13,7 +13,10 @@
Class isa;
int a;
}
-@property (getter = giveMeA, setter = writeA:) int a;
+/* Use the simplest synthesized accessor (assign, nonatomic) as we are
+ not testing the synthesized accessors in this test, just the
+ property syntax. */
+@property (getter = giveMeA, setter = writeA:, nonatomic) int a;
+ (id) initialize;
+ (id) alloc;
- (id) init;
diff --git a/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m b/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m
new file mode 100644
index 00000000000..c38854ff38d
--- /dev/null
+++ b/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m
@@ -0,0 +1,37 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */
+/* { dg-do compile } */
+
+/* Test that properties can be deprecated. */
+
+#include <stdlib.h>
+#include <objc/objc.h>
+#include <objc/runtime.h>
+
+@interface MyRootClass
+{
+ Class isa;
+ int a;
+}
+@property int a __attribute__((deprecated));
++ (id) initialize;
++ (id) alloc;
+- (id) init;
+@end
+
+@implementation MyRootClass
++ (id) initialize { return self; }
++ (id) alloc { return class_createInstance (self, 0); }
+- (id) init { return self; }
+@synthesize a;
+@end
+
+int main (void)
+{
+ MyRootClass *object = [[MyRootClass alloc] init];
+
+ object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */
+ if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */
+ abort ();
+
+ return 0;
+}