]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/Wnonnull-6.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Wnonnull-6.c
CommitLineData
da879e01
MS
1/* Verify that attribute nonnull on global and local function declarations
2 or those to pointers to functions is merged.
3 { dg-do compile }
4 { dg-options "-Wall" } */
5
6void fnonnull_local_local (void)
7{
8 extern __attribute__ ((nonnull)) void fnonnull1 (void*);
9
10 fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
11}
12
13void gnonnull_local_local (void)
14{
15 extern void fnonnull1 (void*);
16
17 fnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
18}
19
20
21void fnonnull_local_global (void)
22{
23 extern __attribute__ ((nonnull)) void fnonnull2 (void*);
24
25 fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
26}
27
28extern void fnonnull2 (void*);
29
30void gnonnull_local_global (void)
31{
32 fnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
33}
34
35
36extern __attribute__ ((nonnull)) void fnonnull3 (void*);
37
38void fnonnull_global_local (void)
39{
40 fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
41}
42
43void gnonnull_global_local (void)
44{
45 extern void fnonnull3 (void*);
46
47 fnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
48}
49
50
51void pfnonnull_local_local (void)
52{
53 extern __attribute__ ((nonnull)) void (*pfnonnull1) (void*);
54
55 pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" }
56}
57
58void gpnonnull_local_local (void)
59{
60 extern void (*pfnonnull1) (void*);
61
62 pfnonnull1 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } }
63}
64
65
66void pfnonnull_local_global (void)
67{
68 extern __attribute__ ((nonnull)) void (*pfnonnull2) (void*);
69
70 pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" }
71}
72
73extern void (*pfnonnull2) (void*);
74
75void gpnonnull_local_global (void)
76{
77 pfnonnull2 (0); // { dg-warning "\\\[-Wnonnull" "pr?????" { xfail *-*-* } }
78}
79
80
81extern __attribute__ ((nonnull)) void (*pfnonnull3) (void*);
82
83void pfnonnull_global_local (void)
84{
85 pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
86}
87
88void gpnonnull_global_local (void)
89{
90 extern void (*pfnonnull3) (void*);
91
92 pfnonnull3 (0); // { dg-warning "\\\[-Wnonnull" }
93}