gcc/testsuite/gcc.dg/c23-unreachable-1.c
raw| 1 | /* Test unreachable in <stddef.h> for C23. */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-std=c23 -pedantic-errors -O2" } */ |
| 4 | |
| 5 | #include <stddef.h> |
| 6 | |
| 7 | #ifndef unreachable |
| 8 | #error "unreachable not defined" |
| 9 | #endif |
| 10 | |
| 11 | extern void *p; |
| 12 | extern __typeof__ (unreachable ()) *p; |
| 13 | |
| 14 | volatile int x = 1; |
| 15 | |
| 16 | extern void not_defined (void); |
| 17 | |
| 18 | extern void exit (int); |
| 19 | |
| 20 | int |
| 21 | main () |
| 22 | { |
| 23 | if (x == 2) |
| 24 | { |
| 25 | unreachable (); |
| 26 | not_defined (); |
| 27 | } |
| 28 | exit (0); |
| 29 | } |