2010-09-20 07:03:35 +08:00
|
|
|
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
2007-07-25 00:58:17 +08:00
|
|
|
|
|
|
|
typedef unsigned __uint32_t;
|
|
|
|
|
|
|
|
#define __byte_swap_int_var(x) \
|
|
|
|
__extension__ ({ register __uint32_t __X = (x); \
|
|
|
|
__asm ("bswap %0" : "+r" (__X)); \
|
|
|
|
__X; })
|
|
|
|
|
|
|
|
int test(int _x) {
|
|
|
|
return (__byte_swap_int_var(_x));
|
|
|
|
}
|
2008-07-27 03:51:01 +08:00
|
|
|
|
|
|
|
// PR2374
|
|
|
|
int test2() { return ({L:5;}); }
|
2010-04-09 08:35:39 +08:00
|
|
|
int test3() { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
|
2008-07-27 03:51:01 +08:00
|
|
|
// expected-warning {{expression result unused}}
|
|
|
|
int test4() { return ({ ({5;}); }); }
|
|
|
|
int test5() { return ({L1: L2: L3: 5;}); }
|
|
|
|
int test6() { return ({5;}); }
|
|
|
|
void test7() { ({5;}); } // expected-warning {{expression result unused}}
|
|
|
|
|
2009-01-25 07:09:00 +08:00
|
|
|
// PR3062
|
2009-04-18 14:51:21 +08:00
|
|
|
int test8[({10;})]; // expected-error {{statement expression not allowed at file scope}}
|
|
|
|
|
|
|
|
// PR3912
|
|
|
|
void test9(const void *P) {
|
|
|
|
__builtin_prefetch(P);
|
|
|
|
}
|
2009-10-30 12:01:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
void *test10() {
|
|
|
|
bar:
|
|
|
|
return &&bar; // expected-warning {{returning address of label, which is local}}
|
|
|
|
}
|
2010-01-24 09:50:29 +08:00
|
|
|
|
|
|
|
// PR6034
|
|
|
|
void test11(int bit) {
|
2014-05-21 22:48:43 +08:00
|
|
|
switch (bit)
|
2010-01-24 09:50:29 +08:00
|
|
|
switch (env->fpscr) // expected-error {{use of undeclared identifier 'env'}}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2010-04-17 07:34:13 +08:00
|
|
|
|
|
|
|
// rdar://3271964
|
|
|
|
enum Numbers { kOne, kTwo, kThree, kFour};
|
|
|
|
int test12(enum Numbers num) {
|
|
|
|
switch (num == kOne) {// expected-warning {{switch condition has boolean value}}
|
|
|
|
default:
|
|
|
|
case kThree:
|
|
|
|
break;
|
|
|
|
}
|
2010-09-17 01:09:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum x { a, b, c, d, e, f, g };
|
|
|
|
|
|
|
|
void foo(enum x X) {
|
|
|
|
switch (X) { // expected-warning {{enumeration value 'g' not handled in switch}}
|
|
|
|
case a:
|
|
|
|
case b:
|
|
|
|
case c:
|
|
|
|
case d:
|
|
|
|
case e:
|
|
|
|
case f:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (X) { // expected-warning {{enumeration values 'f' and 'g' not handled in switch}}
|
|
|
|
case a:
|
|
|
|
case b:
|
|
|
|
case c:
|
|
|
|
case d:
|
|
|
|
case e:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (X) { // expected-warning {{enumeration values 'e', 'f', and 'g' not handled in switch}}
|
|
|
|
case a:
|
|
|
|
case b:
|
|
|
|
case c:
|
|
|
|
case d:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (X) { // expected-warning {{5 enumeration values not handled in switch: 'c', 'd', 'e'...}}
|
|
|
|
case a:
|
|
|
|
case b:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-08 03:37:16 +08:00
|
|
|
int test_pr8880() {
|
|
|
|
int first = 1;
|
2013-10-23 02:07:04 +08:00
|
|
|
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
|
2011-01-08 03:37:16 +08:00
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|