diff options
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/const-eval.c | 2 | ||||
| -rw-r--r-- | clang/test/Sema/expr-comma-c89.c | 6 | ||||
| -rw-r--r-- | clang/test/Sema/expr-comma.c | 8 | ||||
| -rw-r--r-- | clang/test/Sema/i-c-e.c | 7 | ||||
| -rw-r--r-- | clang/test/Sema/warn-unused-value.c | 16 |
5 files changed, 25 insertions, 14 deletions
diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c index 9c537250a93..c132b347d7b 100644 --- a/clang/test/Sema/const-eval.c +++ b/clang/test/Sema/const-eval.c @@ -74,5 +74,5 @@ const _Bool constbool = 0; EVAL_EXPR(35, constbool) EVAL_EXPR(36, constbool) -EVAL_EXPR(37, (1,2.0) == 2.0) +EVAL_EXPR(37, (1,2.0) == 2.0) // expected-warning {{expression result unused}} EVAL_EXPR(38, __builtin_expect(1,1) == 1) diff --git a/clang/test/Sema/expr-comma-c89.c b/clang/test/Sema/expr-comma-c89.c index d0883ba202f..dc427028d0d 100644 --- a/clang/test/Sema/expr-comma-c89.c +++ b/clang/test/Sema/expr-comma-c89.c @@ -11,7 +11,7 @@ int B[sizeof((a.c)) == 17 ? 1 : -1]; // comma does array/function promotion in c99. -int X[sizeof(0, (foo().c)) == sizeof(char*) ? 1 : -1]; -int Y[sizeof(0, (a,b).c) == sizeof(char*) ? 1 : -1]; -int Z[sizeof(0, (a=b).c) == sizeof(char*) ? 1 : -1]; +int X[sizeof(0, (foo().c)) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression result unused}} +int Y[sizeof(0, (a,b).c) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression result unused}} expected-warning {{expression result unused}} +int Z[sizeof(0, (a=b).c) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression result unused}} diff --git a/clang/test/Sema/expr-comma.c b/clang/test/Sema/expr-comma.c index d3e4020af63..b004fc1ba3e 100644 --- a/clang/test/Sema/expr-comma.c +++ b/clang/test/Sema/expr-comma.c @@ -11,7 +11,7 @@ int B[sizeof((a.c)) == 17 ? 1 : -1]; // comma does not promote array/function in c90 unless they are lvalues. -int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1]; -int X[sizeof(0, (foo().c)) == 17 ? 1 : -1]; -int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1]; -int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1]; +int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1]; // expected-warning {{expression result unused}} +int X[sizeof(0, (foo().c)) == 17 ? 1 : -1]; // expected-warning {{expression result unused}} +int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1]; // expected-warning {{expression result unused}} // expected-warning {{expression result unused}} +int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1]; // expected-warning {{expression result unused}} diff --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c index 97d9f43cfba..c86a93fed82 100644 --- a/clang/test/Sema/i-c-e.c +++ b/clang/test/Sema/i-c-e.c @@ -50,9 +50,10 @@ char y[__builtin_constant_p(expr) ? -1 : 1]; char z[__builtin_constant_p(4) ? 1 : -1]; // Comma tests -int comma1[0?1,2:3]; -int comma2[1||(1,2)]; -int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} +int comma1[0?1,2:3]; // expected-warning {{expression result unused}} +int comma2[1||(1,2)]; // expected-warning {{expression result unused}} +int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} \ + // expected-warning {{expression result unused}} // Pointer + __builtin_constant_p char pbcp[__builtin_constant_p(4) ? (intptr_t)&expr : 0]; // expected-error {{variable length array declaration not allowed at file scope}} diff --git a/clang/test/Sema/warn-unused-value.c b/clang/test/Sema/warn-unused-value.c index 16b787f7744..1a7e745785b 100644 --- a/clang/test/Sema/warn-unused-value.c +++ b/clang/test/Sema/warn-unused-value.c @@ -18,9 +18,9 @@ void pr4806() { i,foo(); // expected-warning {{expression result unused}} foo(),i; // expected-warning {{expression result unused}} - i,j,foo(); // expected-warning {{expression result unused}} - i,foo(),j; // expected-warning {{expression result unused}} - foo(),i,j; // expected-warning {{expression result unused}} + i,j,foo(); // expected-warning {{expression result unused}} expected-warning {{expression result unused}} + i,foo(),j; // expected-warning {{expression result unused}} expected-warning {{expression result unused}} + foo(),i,j; // expected-warning {{expression result unused}} expected-warning {{expression result unused}} i++; @@ -63,6 +63,16 @@ int test_logical_bar() { (x = test_logical_foo1()) || // no-warning (x = test_logical_foo2()) || // no-warning (x = test_logical_foo3()); // no-warning + + x || test_logical_foo1(); // no-warning + return x; } +struct s0 { int f0; }; + +void f0(int a); +void f1(struct s0 *a) { + // rdar://8139785 + f0((int)(a->f0 + 1, 10)); // expected-warning {{expression result unused}} +} |

