3 /* { dg-options "-w" } */
5 #define WUR __attribute__((warn_unused_result))
6 #define WURAI __attribute__((warn_unused_result, always_inline)) inline
7 typedef WUR
int (*fnt
) (void);
9 typedef struct { long i
; } A
;
10 typedef struct { long i
; long j
; } B
;
11 typedef struct { char big
[1024]; fnt fn
; } C
;
13 WUR
int check1 (void);
14 WUR
void check2 (void);
17 extern WURAI
int check3 (void) { return bar (); }
24 extern WURAI A
check7 (void) { return bar7 (); }
25 extern WURAI B
check8 (void) { return bar8 (); }
26 extern WURAI C
check9 (void) { return bar9 (); }
27 /* This is useful for checking whether return value of statement
28 expressions (returning int in this case) is used. */
29 extern WURAI
int check_int_result (int res
) { return res
; }
30 #define GU(v) ({ int e = 0; (v) = bar (); if ((v) < 23) e = 14; e; })
32 WUR
int check10 (void);
34 extern WURAI
int check11 (void) { return baz (); }
41 const fnt pcheck1
= check1
;
42 const fnt pcheck3
= check3
;
49 i
+= ({ check1 (); });
59 i
+= ({ check3 (); });
68 if (({ check4 (); }).i
)
78 if (({ check5 (); }).j
)
84 if (c
.big
[12] + c
.big
[29])
86 if (check6 ().big
[27])
88 if (({ check6 (); }).big
[0])
98 if (({ check7 (); }).i
)
108 if (({ check8 (); }).j
)
114 if (c
.big
[12] + c
.big
[29])
116 if (check9 ().big
[27])
118 if (({ check9 (); }).big
[0])
123 if (check_int_result (GU (j
)))
125 i
+= check_int_result (GU (j
));
126 i
+= ({ check_int_result (GU (j
)); });
127 check_int_result (GU (j
));
128 (void) check_int_result (GU (j
));
129 check_int_result (GU (j
)), bar ();
133 i
+= ({ fnptr (); });
141 i
+= ({ fnptr (); });
149 i
+= ({ fnptr (); });
156 i
+= ({ bar9 ().fn (); });
158 (void) bar9 ().fn ();
159 bar9 ().fn (), bar ();
160 if ((k
? check1
: check10
) ())
162 i
+= (k
? check1
: check10
) ();
163 i
+= ({ (k
? check1
: check10
) (); });
164 (k
? check1
: check10
) ();
165 (void) (k
? check1
: check10
) ();
166 (k
? check1
: check10
) (), bar ();
167 if ((k
? check3
: check11
) ())
169 i
+= (k
? check3
: check11
) ();
170 i
+= ({ (k
? check3
: check11
) (); });
171 (k
? check3
: check11
) ();
172 (void) (k
? check3
: check11
) ();
173 (k
? check3
: check11
) (), bar ();
177 i
+= ({ pcheck1 (); });
184 i
+= ({ pcheck3 (); });