File: Wmultistatement-macros-13.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A8-2019-q3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 571,828 kB
  • sloc: ansic: 2,937,651; cpp: 881,644; ada: 597,189; makefile: 65,528; asm: 56,499; xml: 46,621; exp: 24,747; sh: 19,684; python: 7,256; pascal: 4,370; awk: 3,497; perl: 2,695; yacc: 316; ml: 285; f90: 234; lex: 198; objc: 194; haskell: 119
file content (104 lines) | stat: -rw-r--r-- 2,788 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* PR c/81448 */
/* { dg-do compile } */
/* { dg-options "-Wmultistatement-macros" } */

extern int i;

#define BAD4 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define BAD5 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define BAD6 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define BAD7 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define BAD8 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define BAD9 i++; i++ /* { dg-warning "macro expands to multiple statements" } */
#define IF if (1) /* { dg-message "not guarded by this 'if' clause" } */
#define IF2 IF /* { dg-message "in expansion of macro .IF." } */
#define BADB7 BAD7 /* { dg-message "in expansion of macro .BAD7." } */
#define BADB8 BAD8 /* { dg-message "in expansion of macro .BAD8." } */
#define BADB9 BAD9 /* { dg-message "in expansion of macro .BAD9." } */

#define FN0				\
void fn0 (void)				\
{					\
  IF					\
    i++;				\
  return;				\
}

#define FN1				\
void fn1 (void)				\
{					\
  IF2					\
    i++;				\
  return;				\
}

#define FN2				\
void fn2 (void)				\
{					\
  if (1)				\
    i++;				\
  return;				\
}

#define TOP FN3
#define FN3				\
void fn3 (void)				\
{					\
  IF					\
    i++;				\
  return;				\
}

#define TOP2 FN4 /* { dg-message "in expansion of macro .FN4." } */
#define FN4				\
void fn4 (void)				\
{					\
  IF2 /* { dg-message "in expansion of macro .IF2." } */ \
    BAD4; /* { dg-message "in expansion of macro .BAD4." } */ \
}

#define FN5				\
void fn5 (void)				\
{					\
  IF /* { dg-message "in expansion of macro .IF." } */	\
    BAD5; /* { dg-message "in expansion of macro .BAD5." } */ \
}

#define FN6				\
void fn6 (void)				\
{					\
  if (1) /* { dg-message "not guarded by this 'if' clause" } */ \
    BAD6; /* { dg-message "in expansion of macro .BAD6." } */ \
}

#define FN7				\
void fn7 (void)				\
{					\
  if (1) /* { dg-message "not guarded by this 'if' clause" } */	\
    BADB7; /* { dg-message "in expansion of macro .BADB7." } */ \
}

#define FN8				\
void fn8 (void)				\
{					\
  IF2 /* { dg-message "in expansion of macro .IF2." } */ \
    BADB8; /* { dg-message "in expansion of macro .BADB8." } */ \
}

#define FN9				\
void fn9 (void)				\
{					\
  IF /* { dg-message "in expansion of macro .IF." } */ \
    BADB9; /* { dg-message "in expansion of macro .BADB9." } */	\
}

FN0
FN1
FN2
TOP
TOP2 /* { dg-message "in expansion of macro .TOP2." } */
FN5 /* { dg-message "in expansion of macro .FN5." } */
FN6 /* { dg-message "in expansion of macro .FN6." } */
FN7 /* { dg-message "in expansion of macro .FN7." } */
FN8 /* { dg-message "in expansion of macro .FN8." } */
FN9 /* { dg-message "in expansion of macro .FN9." } */