1 // RUN: %clang_cc1 %s -verify 2 // RUN: %clang_cc1 %s -verify=expected,space -Wcompound-token-split 3 // RUN: %clang_cc1 %s -verify=expected,space -Wall 4 5 #ifdef LSQUARE 6 [ // expected-note {{second '[' token is here}} 7 #else 8 9 #define VAR(type, name, init) type name = (init) 10 11 void f() { 12 VAR(int, x, {}); // #1 13 // expected-warning@#1 {{'(' and '{' tokens introducing statement expression appear in different macro expansion contexts}} 14 // expected-note-re@#1 {{{{^}}'{' token is here}} 15 // 16 // FIXME: It would be nice to suppress this when we already warned about the opening '({'. 17 // expected-warning@#1 {{'}' and ')' tokens terminating statement expression appear in different macro expansion contexts}} 18 // expected-note-re@#1 {{{{^}}')' token is here}} 19 // 20 // expected-error@#1 {{cannot initialize a variable of type 'int' with an rvalue of type 'void'}} 21 } 22 23 #define RPAREN ) 24 25 int f2() { 26 int n = ({ 1; }RPAREN; // expected-warning {{'}' and ')' tokens terminating statement expression appear in different macro expansion contexts}} expected-note {{')' token is here}} 27 return n; 28 } 29 30 [ // expected-warning-re {{{{^}}'[' tokens introducing attribute appear in different source files}} 31 #define LSQUARE 32 #include __FILE__ 33 noreturn ]] void g(); 34 35 [[noreturn] ] void h(); // space-warning-re {{{{^}}']' tokens terminating attribute are separated by whitespace}} 36 37 struct X {}; 38 int X:: *p; // space-warning {{'::' and '*' tokens forming pointer to member type are separated by whitespace}} 39 40 #endif 41