Debian Codegraph @

gcc/testsuite/gcc.dg/gnu23-typeof-1.c

raw
1 /* Test __typeof__ propagation of noreturn function attributes with -std=gnu23:
2 these are part of the type of a function pointer with GNU __typeof__, but
3 not with C23 typeof. */
4 /* { dg-do link } */
5 /* { dg-options "-std=gnu23 -O2" } */
6
7 _Noreturn void f (void);
8
9 __typeof__ (&f) volatile p;
10 __typeof__ (&p) volatile pp;
11
12 void link_failure (void);
13
14 void
15 g (void)
16 {
17 (*p) ();
18 link_failure ();
19 }
20
21 void
22 h (void)
23 {
24 (**pp) ();
25 link_failure ();
26 }
27
28 volatile int flag;
29 volatile int x;
30
31 int
32 main (void)
33 {
34 if (flag)
35 g ();
36 if (flag)
37 h ();
38 return x;
39 }