diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-07-15 17:07:12 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-07-15 17:07:12 +0000 |
commit | f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8 (patch) | |
tree | 5e946d69177464379cb1a38ac18206180d763639 /test/Sema | |
parent | 1928da94b55683957759d5c5ff4593a118773394 (diff) | |
download | FreeBSD-src-f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8.zip FreeBSD-src-f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8.tar.gz |
Update clang to r108428.
Diffstat (limited to 'test/Sema')
-rw-r--r-- | test/Sema/block-call.c | 5 | ||||
-rw-r--r-- | test/Sema/block-return.c | 5 | ||||
-rw-r--r-- | test/Sema/exprs.c | 5 | ||||
-rw-r--r-- | test/Sema/i-c-e.c | 3 | ||||
-rw-r--r-- | test/Sema/return.c | 5 | ||||
-rw-r--r-- | test/Sema/struct-cast.c | 2 | ||||
-rw-r--r-- | test/Sema/switch.c | 6 |
7 files changed, 20 insertions, 11 deletions
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c index 28e6c68..27e4cfc 100644 --- a/test/Sema/block-call.c +++ b/test/Sema/block-call.c @@ -13,10 +13,9 @@ int main() { int (^IFP) () = PFR; // OK - const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int const (^)()' with an expression of type 'int (^)()'}} \ - // expected-warning{{type qualifier on return type has no effect}} + const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int const (^)()' with an expression of type 'int (^)()'}} - const int (^CICC) () = CIC; // expected-warning{{type qualifier on return type has no effect}} + const int (^CICC) () = CIC; int * const (^IPCC) () = 0; diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c index 33fd183..5a4ec01 100644 --- a/test/Sema/block-return.c +++ b/test/Sema/block-return.c @@ -109,10 +109,9 @@ void foo6() { void foo7() { - const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}} \ - // expected-warning{{type qualifier on return type has no effect}} + const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}} - const int (^CC) (void) = ^const int{ const int i = 1; return i; }; // expected-warning{{type qualifier on return type has no effect}} + const int (^CC) (void) = ^const int{ const int i = 1; return i; }; int i; diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index b22b522..9d3da90 100644 --- a/test/Sema/exprs.c +++ b/test/Sema/exprs.c @@ -142,3 +142,8 @@ void test19() { *(volatile int*)0 = 0; // Ok. } +int test20(int x) { + return x && 4; // expected-warning {{use of logical && with constant operand; switch to bitwise & or remove constant}} + + return x && sizeof(int) == 4; // no warning. +} diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c index c86a93f..eb77bbe 100644 --- a/test/Sema/i-c-e.c +++ b/test/Sema/i-c-e.c @@ -51,7 +51,8 @@ char z[__builtin_constant_p(4) ? 1 : -1]; // Comma tests int comma1[0?1,2:3]; // expected-warning {{expression result unused}} -int comma2[1||(1,2)]; // expected-warning {{expression result unused}} +int comma2[1||(1,2)]; // expected-warning {{expression result unused}} \ + // expected-warning {{use of logical || with constant operand}} int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} \ // expected-warning {{expression result unused}} diff --git a/test/Sema/return.c b/test/Sema/return.c index 2d23e08..54c3406 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -1,4 +1,4 @@ -// RUN: %clang %s -fsyntax-only -Wreturn-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value +// RUN: %clang %s -fsyntax-only -Wignored-qualifiers -Wreturn-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value // clang emits the following warning by default. // With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the @@ -239,3 +239,6 @@ int test_static_inline(int x) { } static inline int si_forward() {} // expected-warning{{control reaches end of non-void function}} +// Test warnings on ignored qualifiers on return types. +const int ignored_c_quals(); // expected-warning{{'const' type qualifier on return type has no effect}} +const volatile int ignored_cv_quals(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}} diff --git a/test/Sema/struct-cast.c b/test/Sema/struct-cast.c index 3456665..30ef892 100644 --- a/test/Sema/struct-cast.c +++ b/test/Sema/struct-cast.c @@ -5,7 +5,7 @@ struct S { int two; }; -struct S const foo(void); // expected-warning{{type qualifier on return type has no effect}} +struct S const foo(void); struct S tmp; diff --git a/test/Sema/switch.c b/test/Sema/switch.c index bb48229..4e39e0f 100644 --- a/test/Sema/switch.c +++ b/test/Sema/switch.c @@ -50,12 +50,14 @@ void test4() } switch (cond) { - case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} + case g() && 0: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} \ + expected-warning {{use of logical && with constant operand}} break; } switch (cond) { - case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} + case 0 ... g() || 1: // expected-error {{expression is not an integer constant expression}} // expected-note {{subexpression not valid in an integer constant expression}} \\ + expected-warning {{use of logical || with constant operand}} break; } } |