PR tree-optimization/86401
[official-gcc.git] / gcc / testsuite / c-c++-common / Wmultistatement-macros-9.c
blob350c4f9ffd03d4dd2fd438cb888a10f16c048fa4
1 /* PR c/80116 */
2 /* { dg-options "-Wmultistatement-macros" } */
3 /* { dg-do compile } */
5 #define SWAP(x, y) \
6 tmp = x; /* { dg-warning "macro expands to multiple statements" } */ \
7 x = y; \
8 y = tmp
10 #define M1 \
11 while (x) /* { dg-message "not guarded by this 'while' claus" } */ \
12 SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */
14 #define M2 \
15 while (x) \
16 x++
18 #define M3 \
19 while (x) \
20 x++;;
22 #define M4 \
23 while (x) /* { dg-message "not guarded by this 'while' claus" } */ \
24 L1: \
25 SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */
27 #define INC \
28 x++;;
30 int x, y, tmp;
32 void
33 fn0 (void)
35 while (x) /* { dg-message "not guarded by this 'while' claus" } */
36 SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */
38 while (x) /* { dg-message "not guarded by this 'while' claus" } */
40 SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */
41 goto L;
44 void
45 fn1 (void)
47 M1; /* { dg-message "in expansion of macro .M1." } */
48 M2;
49 M3;
50 M4; /* { dg-message "in expansion of macro .M4." } */
51 goto L1;
54 void
55 fn2 (void)
57 while (x)
58 INC
60 while (x)
61 ({ x = 10; x++; });