]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/Wunused-result.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Wunused-result.c
1 /* PR c/99972 - missing -Wunused-result on a call to a locally redeclared
2 warn_unused_result function
3 { dg-do compile }
4 { dg-options "-Wall" } */
5
6 void gwur_local_local (void)
7 {
8 __attribute__ ((warn_unused_result)) int fwur1 (void);
9
10 fwur1 (); // { dg-warning "\\\[-Wunused-result" }
11 }
12
13 void hwur_local_local (void)
14 {
15 /* Verify the attribute from the declaration above is copied/merged
16 into the declaration below. */
17 int fwur1 (void);
18
19 fwur1 (); // { dg-warning "\\\[-Wunused-result" }
20 }
21
22
23 void gwur_local_global (void)
24 {
25 __attribute__ ((warn_unused_result)) int fwur2 (void);
26
27 fwur2 (); // { dg-warning "\\\[-Wunused-result" }
28 }
29
30 int fwur2 (void);
31
32 void hwur_local_global (void)
33 {
34 fwur2 (); // { dg-warning "\\\[-Wunused-result" }
35 }
36
37
38 __attribute__ ((warn_unused_result)) int fwur3 (void);
39
40 void gwur_global_local (void)
41 {
42 fwur3 (); // { dg-warning "\\\[-Wunused-result" }
43 }
44
45 void hwur_global_local (void)
46 {
47 int fwur3 (void);
48
49 fwur3 (); // { dg-warning "\\\[-Wunused-result" }
50 }