diff options
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/altivec.c | 8 | ||||
-rw-r--r-- | test/Parser/attributes.c | 4 | ||||
-rw-r--r-- | test/Parser/builtin_types_compatible.c | 2 | ||||
-rw-r--r-- | test/Parser/check-syntax-1.m | 4 | ||||
-rw-r--r-- | test/Parser/cxx-altivec.cpp | 9 | ||||
-rw-r--r-- | test/Parser/cxx-casting.cpp | 9 | ||||
-rw-r--r-- | test/Parser/cxx-class.cpp | 2 | ||||
-rw-r--r-- | test/Parser/cxx-friend.cpp | 6 | ||||
-rw-r--r-- | test/Parser/cxx-template-decl.cpp | 2 | ||||
-rw-r--r-- | test/Parser/declarators.c | 2 | ||||
-rw-r--r-- | test/Parser/implicit-casts.c | 2 | ||||
-rw-r--r-- | test/Parser/objc-init.m | 3 | ||||
-rw-r--r-- | test/Parser/objc-quirks.m | 18 |
13 files changed, 49 insertions, 22 deletions
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c index c2a32cfa390e0..ed144573fcd29 100644 --- a/test/Parser/altivec.c +++ b/test/Parser/altivec.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s __vector char vv_c; __vector signed char vv_sc; @@ -40,6 +40,8 @@ vector int f__r(); void f_a(vector int a); void f_a2(int b, vector int a); +vector int v = (vector int)(-1); + // These should have warnings. __vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} __vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} @@ -81,8 +83,8 @@ void f() { gccvector unsigned int gv = v; gccvector int gvi = (gccvector int)v; __attribute__((vector_size(8))) unsigned int gv8; - gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} - av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}} + gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} v = gccv; __vector unsigned int tv = gccv; diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c index ca606f5391ae9..b2873638cdba8 100644 --- a/test/Parser/attributes.c +++ b/test/Parser/attributes.c @@ -52,3 +52,7 @@ int foo42(void) { void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void); void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn)); + + +// PR6287 +void __attribute__((returns_twice)) returns_twice_test(); diff --git a/test/Parser/builtin_types_compatible.c b/test/Parser/builtin_types_compatible.c index 325615c7ee91d..ac81e7b08dc95 100644 --- a/test/Parser/builtin_types_compatible.c +++ b/test/Parser/builtin_types_compatible.c @@ -35,7 +35,7 @@ static void test() struct xx { int a; } x, y; c = __builtin_choose_expr(a+3-7, b, x); // expected-error{{'__builtin_choose_expr' requires a constant expression}} - c = __builtin_choose_expr(0, b, x); // expected-error{{incompatible type assigning 'struct xx', expected 'int'}} + c = __builtin_choose_expr(0, b, x); // expected-error{{assigning to 'int' from incompatible type 'struct xx'}} c = __builtin_choose_expr(5+3-7, b, x); y = __builtin_choose_expr(4+3-7, b, x); diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m index 085ff4cf67a1b..db37793c560f2 100644 --- a/test/Parser/check-syntax-1.m +++ b/test/Parser/check-syntax-1.m @@ -11,9 +11,7 @@ typedef float CGFloat; // rdar: // 7822196 @interface A -(void) x; // expected-error {{method type specifier must start with '-' or '+'}} \ - // expected-warning {{type specifier missing, defaults to 'int' [-Wimplicit-int]}} \ - // expected-error {{cannot declare variable inside @interface or @protocol}} +(void) x; // expected-error {{method type specifier must start with '-' or '+'}} (int)im; // expected-error {{method type specifier must start with '-' or '+'}} \ - ok; @end diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index 3610c0e049303..66d4f3263b9ae 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s - +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s // This is the same as the C version: __vector char vv_c; @@ -42,6 +41,8 @@ vector int f__r(); void f_a(vector int a); void f_a2(int b, vector int a); +vector int v = (vector int)(-1); + // These should have warnings. __vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} __vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} @@ -81,8 +82,8 @@ void f() { gccvector unsigned int gv = v; gccvector int gvi = (gccvector int)v; __attribute__((vector_size(8))) unsigned int gv8; - gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} - av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}} + gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} v = gccv; __vector unsigned int tv = gccv; diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp index c8b4716aa356c..98d962ad0998f 100644 --- a/test/Parser/cxx-casting.cpp +++ b/test/Parser/cxx-casting.cpp @@ -5,8 +5,6 @@ char *const_cast_test(const char *var) return const_cast<char*>(var); } -#if 0 -// FIXME: Uncomment when C++ is supported more. struct A { virtual ~A() {} }; @@ -18,7 +16,6 @@ struct B *dynamic_cast_test(struct A *a) { return dynamic_cast<struct B*>(a); } -#endif char *reinterpret_cast_test() { @@ -34,3 +31,9 @@ char postfix_expr_test() { return reinterpret_cast<char*>(0xdeadbeef)[0]; } + +// This was being incorrectly tentatively parsed. +namespace test1 { + template <class T> class A {}; + void foo() { A<int>(*(A<int>*)0); } +} diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 576e57d0716a9..4abbbc5b9b580 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -8,7 +8,7 @@ protected: struct S {}; enum {}; - int; // expected-error {{declaration does not declare anything}} + int; // expected-warning {{declaration does not declare anything}} int : 1, : 2; public: diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp index 2fe30cd3e4282..59350b5663676 100644 --- a/test/Parser/cxx-friend.cpp +++ b/test/Parser/cxx-friend.cpp @@ -21,9 +21,9 @@ class B { // 'A' here should refer to the declaration above. friend class A; - friend C; // expected-error {{must specify 'class' to befriend}} - friend U; // expected-error {{must specify 'union' to befriend}} - friend int; // expected-error {{friends can only be classes or functions}} + friend C; // expected-warning {{must specify 'class' to befriend}} + friend U; // expected-warning {{must specify 'union' to befriend}} + friend int; // expected-warning {{non-class type 'int' cannot be a friend}} friend void myfunc(); diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index 3f8f1ec9d0be9..3a97efac19ed4 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -6,7 +6,7 @@ template x; // expected-error {{C++ requires a type specifier for al // expected-error {{does not refer}} export template x; // expected-error {{expected '<' after 'template'}} export template<class T> class x0; // expected-warning {{exported templates are unsupported}} -template < ; // expected-error {{parse error}} expected-error {{declaration does not declare anything}} +template < ; // expected-error {{parse error}} expected-warning {{declaration does not declare anything}} template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \ // expected-error{{extraneous}} template <template <typename> > struct Err2; // expected-error {{expected 'class' before '>'}} \ diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c index 91803c1c5d79e..31712af26c745 100644 --- a/test/Parser/declarators.c +++ b/test/Parser/declarators.c @@ -53,7 +53,7 @@ myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum' float *test7() { // We should recover 'b' by parsing it with a valid type of "struct xyz", which // allows us to diagnose other bad things done with y, such as this. - return &b.y; // expected-warning {{incompatible pointer types returning 'int *', expected 'float *'}} + return &b.y; // expected-warning {{incompatible pointer types returning 'int *' from a function with result type 'float *'}} } struct xyz test8() { return a; } // a should be be marked invalid, no diag. diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c index 900b4ece8bab2..a2b31f929fb3a 100644 --- a/test/Parser/implicit-casts.c +++ b/test/Parser/implicit-casts.c @@ -14,7 +14,7 @@ void test2() { } int test3() { int a[2]; - a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int ()', expected 'int'}} + a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning to 'int' from 'int ()'}} return 0; } short x; void test4(char c) { x += c; } diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m index 0c23aebc878c9..32ba948f472de 100644 --- a/test/Parser/objc-init.m +++ b/test/Parser/objc-init.m @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic +// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s // rdar://5707001 @interface NSNumber; @@ -14,7 +15,7 @@ void test1() { id objects[] = {[NSNumber METH]}; } -void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}} +void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}} id objects[] = {[x METH]}; } diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m index 62984a458f364..b6671d1cf9477 100644 --- a/test/Parser/objc-quirks.m +++ b/test/Parser/objc-quirks.m @@ -8,3 +8,21 @@ int @"s" = 5; // expected-error {{prefix attribute must be}} @interface A }; // expected-error {{missing @end}} expected-error {{expected external declaration}} + + + +// PR6811 +// 'super' isn't an expression, it is a magic context-sensitive keyword. +@interface A2 { + id isa; +} +- (void)a; +@end + +@interface B2 : A2 @end +@implementation B2 +- (void)a +{ + [(super) a]; // expected-error {{use of undeclared identifier 'super'}} +} +@end |