blob: 175eb165f3e148be96cfc3ea3b9093a20ca9ae01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* Test #elifdef and #elifndef in GNU11. */
/* { dg-do preprocess } */
/* { dg-options "-std=gnu11 -pedantic" } */
#define A
#undef B
#if 0
#elifdef A /* { dg-warning "#elifdef before C23 is a GCC extension" } */
#define M1 1
#endif
#if M1 != 1
#error "#elifdef A did not apply"
#endif
#if 0
#elifdef B
#error "#elifdef B applied"
#endif
#if 0
#elifndef A
#error "#elifndef A applied"
#endif
#if 0
#elifndef B /* { dg-warning "#elifndef before C23 is a GCC extension" } */
#define M2 2
#endif
#if M2 != 2
#error "#elifndef B did not apply"
#endif
#if 0
#elifdef A /* { dg-warning "#elifdef before C23 is a GCC extension" } */
#else
#error "#elifdef A did not apply"
#endif
#if 0
#elifndef B /* { dg-warning "#elifndef before C23 is a GCC extension" } */
#else
#error "#elifndef B did not apply"
#endif
#if 1
#elifdef A /* { dg-warning "#elifdef before C23 is a GCC extension" } */
#endif
#if 1
#elifndef B /* { dg-warning "#elifndef before C23 is a GCC extension" } */
#endif
/* As with #elif, the syntax of the new directives is relaxed after a
non-skipped group. */
#if 1
#elifdef x * y /* { dg-warning "#elifdef before C23 is a GCC extension" } */
#endif
#if 1
#elifndef ! /* { dg-warning "#elifndef before C23 is a GCC extension" } */
#endif
|