Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/Wmultistatement-macros-8.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* PR c/80116 */ | |
2 /* { dg-options "-Wmultistatement-macros" } */ | |
3 /* { dg-do compile } */ | |
4 | |
5 #define SWAP(x, y) \ | |
6 tmp = x; /* { dg-warning "macro expands to multiple statements" } */ \ | |
7 x = y; \ | |
8 y = tmp | |
9 | |
10 #define M1 \ | |
11 for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ \ | |
12 SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ | |
13 | |
14 #define M2 \ | |
15 for (i = 0; i < 1; ++i) \ | |
16 x++ | |
17 | |
18 #define M3 \ | |
19 for (i = 0; i < 1; ++i) \ | |
20 x++;; | |
21 | |
22 #define M4 \ | |
23 for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ \ | |
24 L1: \ | |
25 SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ | |
26 | |
27 #define INC \ | |
28 x++;; | |
29 | |
30 int x, y, tmp; | |
31 | |
32 void | |
33 fn0 (void) | |
34 { | |
35 int i; | |
36 for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ | |
37 SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ | |
38 | |
39 for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ | |
40 L: | |
41 SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ | |
42 goto L; | |
43 } | |
44 | |
45 void | |
46 fn1 (void) | |
47 { | |
48 int i; | |
49 M1; /* { dg-message "in expansion of macro .M1." } */ | |
50 M2; | |
51 M3; | |
52 M4; /* { dg-message "in expansion of macro .M4." } */ | |
53 goto L1; | |
54 } | |
55 | |
56 void | |
57 fn2 (void) | |
58 { | |
59 for (int i = 0; i < 1; ++i) | |
60 INC | |
61 | |
62 for (int i = 0; i < 1; ++i) | |
63 ({ x = 10; x++; }); | |
64 } |