| 1 |
/* PR c/80076 */ |
| 2 |
/* { dg-options "-Wmisleading-indentation" } */ |
| 3 |
|
| 4 |
void foo(void); |
| 5 |
|
| 6 |
void test01(int flag) { |
| 7 |
#define bar() foo() /* { dg-message "this statement" } */ |
| 8 |
if (flag) /* { dg-warning "does not guard" } */ |
| 9 |
foo(); |
| 10 |
bar(); /* { dg-message "in expansion of macro" } */ |
| 11 |
#undef bar |
| 12 |
} |
| 13 |
|
| 14 |
void test02(int flag) { |
| 15 |
#define bar() foo() |
| 16 |
if (flag) /* { dg-warning "does not guard" } */ |
| 17 |
bar(); |
| 18 |
foo(); /* { dg-message "this statement" } */ |
| 19 |
#undef bar |
| 20 |
} |
| 21 |
|
| 22 |
void test03(int flag) { |
| 23 |
#define bar() foo() /* { dg-message "this statement" } */ |
| 24 |
if (flag) /* { dg-warning "does not guard" } */ |
| 25 |
bar(); |
| 26 |
bar(); /* { dg-message "in expansion of macro" } */ |
| 27 |
#undef bar |
| 28 |
} |
| 29 |
|
| 30 |
void test04(int flag, int num) { |
| 31 |
#define bar() \ |
| 32 |
{ \ |
| 33 |
if (flag) \ |
| 34 |
num = 0; \ |
| 35 |
num = 1; \ |
| 36 |
} |
| 37 |
bar(); |
| 38 |
/* { dg-warning "does not guard" "" { target *-*-* } .-5 } */ |
| 39 |
/* { dg-message "this statement" "" { target *-*-* } .-4 } */ |
| 40 |
#undef bar |
| 41 |
} |
| 42 |
|
| 43 |
void test05(int flag, int num) { |
| 44 |
#define baz() (num = 1) |
| 45 |
#define bar() \ |
| 46 |
{ \ |
| 47 |
if (flag) \ |
| 48 |
num = 0; \ |
| 49 |
baz(); \ |
| 50 |
} |
| 51 |
#define wrapper bar |
| 52 |
wrapper(); |
| 53 |
/* { dg-warning "does not guard" "" { target *-*-* } .-6 } */ |
| 54 |
/* { dg-message "this statement" "" { target *-*-* } .-10 } */ |
| 55 |
#undef bar |
| 56 |
} |