Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / Wmultistatement-macros-2.c
blob9fef90177eb25f9aa5d0b5aa64ae07f13985e0b7
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 STUFF \
11 if (0) {} else x = y
13 #define STUFF2 \
14 if (0) {} else x = y; x++
16 #define STUFF3 \
17 if (x) \
18 {} \
19 else /* { dg-message "not guarded by this 'else' clause" } */ \
20 SWAP(x, y) /* { dg-message "in expansion of macro .SWAP." } */
22 #define SET(X, Y) \
23 (X) = (Y)
25 #define STUFF4 \
26 if (x) \
27 {} \
28 else \
29 SET(x, y); \
30 SET(x, y)
32 #define STUFF5 \
33 { tmp = x; x = y; }
35 #define STUFF6 \
36 x++;;
38 int x, y, tmp;
40 void
41 fn1 (void)
43 if (x)
46 else /* { dg-message "not guarded by this 'else' clause" } */
47 SWAP(x, y); /* { dg-message "in expansion of macro .SWAP." } */
50 void
51 fn2 (void)
53 SWAP(x, y);
56 void
57 fn3 (void)
59 if (x)
62 else
64 SWAP(x, y);
68 void
69 fn4 (void)
71 if (x)
74 else
75 ({ x = 10; x++; });
78 void
79 fn5 (void)
81 if (x)
84 else /* { dg-message "not guarded by this 'else' clause" } */
85 L1:
86 SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */
87 goto L1;
90 void
91 fn6 (void)
93 if (x)
96 else
97 SET (x, y);
98 SET (tmp, x);
101 void
102 fn7 (void)
104 STUFF;
107 void
108 fn8 (void)
110 STUFF2;
113 void
114 fn9 (void)
116 STUFF3; /* { dg-message "in expansion of macro .STUFF3." } */
119 void
120 fn10 (void)
122 STUFF4;
125 void
126 fn11 (void)
128 if (x)
129 STUFF5;
132 void
133 fn12 (void)
135 if (x)
136 STUFF6;