Debian Codegraph @

clang/test/Preprocessor/warn-macro-undef-true.c

raw
1 // RUN: %clang_cc1 %s -Eonly -std=c89 -verify=undef-true
2 // RUN: %clang_cc1 %s -Eonly -std=c99 -verify=undef-true
3 // RUN: %clang_cc1 %s -Eonly -std=c11 -verify=undef-true
4 // RUN: %clang_cc1 %s -Eonly -std=c17 -verify=undef-true
5 // RUN: %clang_cc1 %s -Eonly -std=c23 -verify=undef-true
6
7 #if __STDC_VERSION__ >= 202311L
8 /* undef-true-no-diagnostics */
9 #endif
10
11 #define FOO true
12 #if FOO /* #1 */
13 #endif
14 #if __STDC_VERSION__ < 202311L
15 /* undef-true-warning@#1 {{'true' is not defined, evaluates to 0}} */
16 #endif
17
18 #if true /* #2 */
19 #endif
20 #if __STDC_VERSION__ < 202311L
21 /* undef-true-warning@#2 {{'true' is not defined, evaluates to 0}} */
22 #endif
23
24 #if false || true /* #3 */
25 #endif
26 #if __STDC_VERSION__ < 202311L
27 /* undef-true-warning@#3 {{'true' is not defined, evaluates to 0}} */
28 #endif
29
30 #define true 1
31
32 #define FOO true
33 #if FOO
34 #endif
35
36 #if true
37 #endif
38
39 #if false || true
40 #endif
41
42 #undef true
43
44 #define FOO true
45 #if FOO /* #4 */
46 #endif
47 #if __STDC_VERSION__ < 202311L
48 /* undef-true-warning@#4 {{'true' is not defined, evaluates to 0}} */
49 #endif
50
51 #if true /* #5 */
52 #endif
53 #if __STDC_VERSION__ < 202311L
54 /* undef-true-warning@#5 {{'true' is not defined, evaluates to 0}} */
55 #endif
56
57 #if false || true /* #6 */
58 #endif
59 #if __STDC_VERSION__ < 202311L
60 /* undef-true-warning@#6 {{'true' is not defined, evaluates to 0}} */
61 #endif
62
63 #define true true
64 #if true /* #7 */
65 #endif
66 #if __STDC_VERSION__ < 202311L
67 /* undef-true-warning@#7 {{'true' is not defined, evaluates to 0}} */
68 #endif
69 #undef true
70
71 /* Test that #pragma-enabled 'Wundef' can override 'Wundef-true' */
72 #pragma clang diagnostic warning "-Wundef"
73 #if true /* #8 */
74 #endif
75 #pragma clang diagnostic ignored "-Wundef"
76 #if __STDC_VERSION__ < 202311L
77 /* undef-true-warning@#8 {{'true' is not defined, evaluates to 0}} */
78 #endif