aboutsummaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-07-15 17:07:12 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-07-15 17:07:12 +0000
commit4e58654b47e89efbb1a8ca032c08fd354c3b0b61 (patch)
tree5e946d69177464379cb1a38ac18206180d763639 /test/Sema
parent4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (diff)
downloadsrc-4e58654b47e89efbb1a8ca032c08fd354c3b0b61.tar.gz
src-4e58654b47e89efbb1a8ca032c08fd354c3b0b61.zip
Update clang to r108428.
Notes
Notes: svn path=/vendor/clang/dist/; revision=210128
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/block-call.c5
-rw-r--r--test/Sema/block-return.c5
-rw-r--r--test/Sema/exprs.c5
-rw-r--r--test/Sema/i-c-e.c3
-rw-r--r--test/Sema/return.c5
-rw-r--r--test/Sema/struct-cast.c2
-rw-r--r--test/Sema/switch.c6
7 files changed, 20 insertions, 11 deletions
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c
index 28e6c68a8006..27e4cfc6d46b 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 33fd183be069..5a4ec010d3a2 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 b22b5220f285..9d3da908549f 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 c86a93fed829..eb77bbe3b990 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 2d23e0803967..54c340634d39 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 3456665a8c55..30ef89242afc 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 bb4822916cc7..4e39e0f0c2d5 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;
}
}