PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / Wmultistatement-macros-13.c
blob9f42e268d9f11b507ff1557b006aafc81532839d
1 /* PR c/81448 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wmultistatement-macros" } */
5 extern int i;
7 #define BAD4 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
8 #define BAD5 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
9 #define BAD6 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
10 #define BAD7 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
11 #define BAD8 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
12 #define BAD9 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
13 #define IF if (1) /* { dg-message "not guarded by this 'if' clause" } */
14 #define IF2 IF /* { dg-message "in expansion of macro .IF." } */
15 #define BADB7 BAD7 /* { dg-message "in expansion of macro .BAD7." } */
16 #define BADB8 BAD8 /* { dg-message "in expansion of macro .BAD8." } */
17 #define BADB9 BAD9 /* { dg-message "in expansion of macro .BAD9." } */
19 #define FN0 \
20 void fn0 (void) \
21 { \
22 IF \
23 i++; \
24 return; \
27 #define FN1 \
28 void fn1 (void) \
29 { \
30 IF2 \
31 i++; \
32 return; \
35 #define FN2 \
36 void fn2 (void) \
37 { \
38 if (1) \
39 i++; \
40 return; \
43 #define TOP FN3
44 #define FN3 \
45 void fn3 (void) \
46 { \
47 IF \
48 i++; \
49 return; \
52 #define TOP2 FN4 /* { dg-message "in expansion of macro .FN4." } */
53 #define FN4 \
54 void fn4 (void) \
55 { \
56 IF2 /* { dg-message "in expansion of macro .IF2." } */ \
57 BAD4; /* { dg-message "in expansion of macro .BAD4." } */ \
60 #define FN5 \
61 void fn5 (void) \
62 { \
63 IF /* { dg-message "in expansion of macro .IF." } */ \
64 BAD5; /* { dg-message "in expansion of macro .BAD5." } */ \
67 #define FN6 \
68 void fn6 (void) \
69 { \
70 if (1) /* { dg-message "not guarded by this 'if' clause" } */ \
71 BAD6; /* { dg-message "in expansion of macro .BAD6." } */ \
74 #define FN7 \
75 void fn7 (void) \
76 { \
77 if (1) /* { dg-message "not guarded by this 'if' clause" } */ \
78 BADB7; /* { dg-message "in expansion of macro .BADB7." } */ \
81 #define FN8 \
82 void fn8 (void) \
83 { \
84 IF2 /* { dg-message "in expansion of macro .IF2." } */ \
85 BADB8; /* { dg-message "in expansion of macro .BADB8." } */ \
88 #define FN9 \
89 void fn9 (void) \
90 { \
91 IF /* { dg-message "in expansion of macro .IF." } */ \
92 BADB9; /* { dg-message "in expansion of macro .BADB9." } */ \
95 FN0
96 FN1
97 FN2
98 TOP
99 TOP2 /* { dg-message "in expansion of macro .TOP2." } */
100 FN5 /* { dg-message "in expansion of macro .FN5." } */
101 FN6 /* { dg-message "in expansion of macro .FN6." } */
102 FN7 /* { dg-message "in expansion of macro .FN7." } */
103 FN8 /* { dg-message "in expansion of macro .FN8." } */
104 FN9 /* { dg-message "in expansion of macro .FN9." } */