summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-05 19:23:33 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-05 19:23:33 +0000
commita26d8862530306e79ae1c57f3962b60dc5eaddd9 (patch)
tree886a6b036431bb61a6e71747b4fc19d2517d00f2 /gcc/testsuite/obj-c++.dg
parentae718d66b613819ca53a6dffbfce517ae200bc89 (diff)
downloadgcc-a26d8862530306e79ae1c57f3962b60dc5eaddd9.tar.gz
In gcc/: 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/: 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> * c-parser.c (c_parser_objc_method_definition): Updated comment. In gcc/cp/: 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/31125 * parser.c (cp_parser_objc_class_interface): If no identifier follows an @interface token, stop parsing the interface after printing an error. (cp_parser_objc_class_implementation): If no identifier follows an @implementation token, stop parsing the implementation after printing an error. 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/23707 * parser.c (cp_parser_objc_method_keyword_params): If the required colon is not found while parsing parameters, stop parsing them. 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/31126 * parser.c (cp_parser_objc_class_ivars): Do not eat the EOF or @end after detecting it. Print an error if @end is found without a '}'. (cp_parser_objc_method_prototype_list): Do not eat the EOF after detecting it. Fixed reading the next token when continuing because of an error in a method signature. Print an error if EOF is found without an '@end'. (cp_parser_objc_method_definition_list): Same change. 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> Merge from apple/trunk branch on FSF servers: 2005-10-17 Fariborz Jahanian <fjahanian@apple.com> Radar 4290840 * parser.c (cp_parser_objc_method_keyword_params): Check for valid method parameters and issue error. (cp_parser_objc_method_definition_list): Check for invalid tokens which cannot start a function definition. 2005-10-14 Fariborz Jahanian <fjahanian@apple.com> Radar 4294425 * parser.c (cp_parser_objc_message_args): Check for missing message arguments and syntax error. 2005-10-13 Fariborz Jahanian <fjahanian@apple.com> Radar 4261146 * parser.c (cp_parser_objc_class_ivars): Check for @end/eof while looking for '}'. 2005-08-15 Ziemowit Laski <zlaski@apple.com> Radar 4093475 * parser.c (cp_parser_objc_interstitial_code): Catch stray '{' and '}' tokens and issue appropriate errors. 2005-08-02 Ziemowit Laski <zlaski@apple.com> Radar 4185810 (cp_parser_statement_seq_opt): In addition to '}' and end-of-file, a statement sequence may also be terminated by a stray '@end'. In gcc/objc/: 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2005-10-17 Fariborz Jahanian <fjahanian@apple.com> Radar 4290840 * objc-act.c (objc_start_method_definition): Check for error_mark_node for the selector name and make a quick exit. In gcc/testsuite/: 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 * obj-c++.dg/syntax-error-9.mm: New. 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/31126 * obj-c++.dg/syntax-error-8.mm: New. 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2005-10-17 Fariborz Jahanian <fjahanian@apple.com> Radar 4290840 * obj-c++.dg/syntax-error-7.mm: New 2005-10-14 Fariborz Jahanian <fjahanian@apple.com> Radar 4294425 * obj-c++.dg/syntax-error-6.mm: New 2005-10-13 Fariborz Jahanian <fjahanian@apple.com> Radar 4261146 * obj-c++.dg/syntax-error-5.mm: New 2005-08-15 Ziemowit Laski <zlaski@apple.com> Radar 4093475 * obj-c++.dg/syntax-error-[3-4].mm: New. 2005-08-02 Ziemowit Laski <zlaski@apple.com> Radar 4185810 * obj-c++.dg/syntax-error-[1-2].mm: New. From-SVN: r164997
Diffstat (limited to 'gcc/testsuite/obj-c++.dg')
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-1.mm26
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-10.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-2.mm16
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-3.mm10
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-4.mm15
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-5.mm13
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-6.mm12
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-7.mm13
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-8.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/syntax-error-9.mm3
10 files changed, 110 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-1.mm b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm
new file mode 100644
index 00000000000..13f3c275cce
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-1.mm
@@ -0,0 +1,26 @@
+/* Graceful handling of a syntax error. */
+/* { dg-do compile } */
+
+#include <objc/Object.h>
+
+class foo {
+ public:
+ foo();
+ virtual ~foo();
+};
+
+
+extern void NXLog(const char *, ...);
+
+@interface Test2 : Object {
+}
+- (void) foo2;
+@end
+
+@implementation Test2
+- (void) foo2
+ NXLog("Hello, world!"); /* { dg-error "expected .\{. before .NXLog." } */
+} /* { dg-error "stray .\}. between Objective\\-C\\+\\+ methods" } */
+@end
+
+/* { dg-error "expected constructor, destructor, or type conversion before" "" { target *-*-* } 22 } */
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-10.mm b/gcc/testsuite/obj-c++.dg/syntax-error-10.mm
new file mode 100644
index 00000000000..e45abccfc7d
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-10.mm
@@ -0,0 +1 @@
+@interface /* { dg-error "expected identifier" } */
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-2.mm b/gcc/testsuite/obj-c++.dg/syntax-error-2.mm
new file mode 100644
index 00000000000..ba8804a89e2
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-2.mm
@@ -0,0 +1,16 @@
+/* Recover gracefully from a syntax error. */
+
+@implementation Whatever /* { dg-warning "cannot find interface declaration for .Whatever." } */
+
+- (void) function
+{
+ if( 1 )
+ {
+ else /* { dg-error "expected .\}. before .else." } */
+ {
+ }
+}
+
+- (void) another {}
+
+@end
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-3.mm b/gcc/testsuite/obj-c++.dg/syntax-error-3.mm
new file mode 100644
index 00000000000..34f914bad28
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-3.mm
@@ -0,0 +1,10 @@
+/* Yet another stray infinite loop... */
+/* { dg-do compile } */
+
+@interface Foo
+{
+ int x;
+ int y;
+}
+- (int) foo ; { /* { dg-error "stray .\{. between Objective\\-C\\+\\+ methods" } */
+@end
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-4.mm b/gcc/testsuite/obj-c++.dg/syntax-error-4.mm
new file mode 100644
index 00000000000..0df061839b4
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-4.mm
@@ -0,0 +1,15 @@
+/* Yet another stray infinite loop... */
+/* { dg-do compile } */
+
+@interface t
+{
+}
+- (void)go;
+@end
+@implementation t
+- (void)go
+{
+ }
+} /* { dg-error "stray .\}. between Objective\\-C\\+\\+ methods" } */
+@end
+
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-5.mm b/gcc/testsuite/obj-c++.dg/syntax-error-5.mm
new file mode 100644
index 00000000000..f0d06052081
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-5.mm
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+typedef struct S { int i; } NSDictionary;
+
+@interface A
+{
+}
+@end
+
+@interface B : A
+{
+ NSDictionary * _userInfo;
+@end /* { dg-error "expected .\}. before .end." } */
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-6.mm b/gcc/testsuite/obj-c++.dg/syntax-error-6.mm
new file mode 100644
index 00000000000..21423ec7eb7
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-6.mm
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+@interface NSButton
+- (int) state;
+@end
+
+void FOO()
+{
+ NSButton * mCopyAcrobatCB;
+
+ [ [ mCopyAcrobatCB state ] == 0 ] != 1; /* { dg-error "objective\\-c\\+\\+" } */
+}
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-7.mm b/gcc/testsuite/obj-c++.dg/syntax-error-7.mm
new file mode 100644
index 00000000000..eef5bc75c62
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-7.mm
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+@interface Foo
+-(void) someMethod;
+@end
+
+@implementation Foo
+-(void)
+-(void) someMethod /* { dg-error "expected before .-." } */
+{
+}
+@end /* { dg-error "incomplete implementation of class" } */
+/* { dg-error "method definition for ..someMethod. not found" "" { target *-*-* } 12 } */
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-8.mm b/gcc/testsuite/obj-c++.dg/syntax-error-8.mm
new file mode 100644
index 00000000000..731ffda5f5e
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-8.mm
@@ -0,0 +1 @@
+@interface A /* { dg-error "expected ..end." } */ \ No newline at end of file
diff --git a/gcc/testsuite/obj-c++.dg/syntax-error-9.mm b/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
new file mode 100644
index 00000000000..97706d5b1aa
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
@@ -0,0 +1,3 @@
+@implementation SaturnDoc /* { dg-warning "cannot find interface declaration" } */
+- read: (void*)aStream ggg /* { dg-error "expected .:. at end of input" } */
+/* { dg-error "expected ..end. at end of input" "" { target *-*-* } 2 } */ \ No newline at end of file