2007-10-11 08:18:28 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify %s
|
2007-06-27 13:58:33 +08:00
|
|
|
|
|
|
|
int foo(int X, int Y);
|
|
|
|
|
|
|
|
void bar(volatile int *VP, int *P, int A,
|
|
|
|
_Complex double C, volatile _Complex double VC) {
|
|
|
|
|
2007-08-27 12:08:11 +08:00
|
|
|
VP == P; // expected-warning {{expression result unused}}
|
2007-08-27 01:32:59 +08:00
|
|
|
(void)A;
|
2007-06-27 13:58:33 +08:00
|
|
|
(void)foo(1,2); // no warning.
|
|
|
|
|
|
|
|
A == foo(1, 2); // expected-warning {{expression result unused}}
|
|
|
|
|
|
|
|
foo(1,2)+foo(4,3); // expected-warning {{expression result unused}}
|
|
|
|
|
|
|
|
|
|
|
|
*P; // expected-warning {{expression result unused}}
|
|
|
|
*VP; // no warning.
|
|
|
|
P[4]; // expected-warning {{expression result unused}}
|
|
|
|
VP[4]; // no warning.
|
|
|
|
|
|
|
|
// FIXME: SEMA explodes on these.
|
|
|
|
//__real__ C;
|
|
|
|
//__real__ VC;
|
|
|
|
}
|
|
|
|
|
2007-08-27 01:32:59 +08:00
|
|
|
extern void t1();
|
|
|
|
extern void t2();
|
|
|
|
void t3(int c) {
|
|
|
|
c ? t1() : t2();
|
|
|
|
}
|
|
|
|
|
2007-09-01 05:49:55 +08:00
|
|
|
// This shouldn't warn: the expr at the end of the stmtexpr really is used.
|
|
|
|
int stmt_expr(int x, int y) {
|
|
|
|
return ({int _a = x, _b = y; _a > _b ? _a : _b; });
|
|
|
|
}
|
|
|
|
|
2008-05-20 05:24:43 +08:00
|
|
|
void nowarn(unsigned char* a, unsigned char* b)
|
|
|
|
{
|
|
|
|
unsigned char c = 1;
|
|
|
|
*a |= c, *b += c;
|
|
|
|
}
|