1 // RUN: %clang_cc1 -fsyntax-only -Wextra-semi-stmt -verify %s
3 // RUN: %clang_cc1 -x c++ -Wextra-semi-stmt -fixit %t
4 // RUN: %clang_cc1 -x c++ -Wextra-semi-stmt -Werror %t
6 #define GOODMACRO(varname) int varname
7 #define BETTERMACRO(varname) GOODMACRO(varname);
8 #define NULLMACRO(varname)
16 ; // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
19 // This removal of extra semi also consumes all the comments.
28 {}; // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
31 ; // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
35 ; // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
44 BETTERMACRO(v3
;) // Extra ';', but within macro expansion, so ignored.
46 BETTERMACRO(v4
); // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
48 BETTERMACRO(v5
;); // expected-warning {{empty expression statement has no effect; remove unnecessary ';' to silence this warning}}
52 NULLMACRO(v7
); // OK. This could be either GOODMACRO() or BETTERMACRO() situation, so we can't know we can drop it.