blob: b28c1cdce962f4cb97f5e4d9f73ad6a351951ac8 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlsson2d85f8b2007-10-10 20:50:11 +00002
3void f1(int a) {
4 if (a); // expected-warning {{if statement has empty body}}
5}
6
7void f2(int a) {
8 if (a) {}
9}
Chris Lattnerb96728d2007-10-29 05:08:52 +000010
11void f3() {
12 if (1)
13 xx; // expected-error {{use of undeclared identifier}}
14 return; // no empty body warning.
15}
16
Ted Kremenekb3198172010-09-16 00:37:05 +000017// Don't warn about an empty body if is expanded from a macro.
18void f4(int i) {
19 #define BODY ;
20 if (i == i) // expected-warning{{self-comparison always evaluates to true}}
21 BODY
22 #undef BODY
23}
24