File: warn-macro-undef-true.c

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,235,796 kB
  • sloc: cpp: 7,617,614; ansic: 1,433,901; asm: 1,058,726; python: 252,096; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 10,032; ml: 5,111; perl: 4,720; awk: 3,523; makefile: 3,401; javascript: 2,272; xml: 892; fortran: 770
file content (78 lines) | stat: -rw-r--r-- 1,768 bytes parent folder | download | duplicates (4)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
// RUN: %clang_cc1 %s -Eonly -std=c89 -verify=undef-true
// RUN: %clang_cc1 %s -Eonly -std=c99 -verify=undef-true
// RUN: %clang_cc1 %s -Eonly -std=c11 -verify=undef-true
// RUN: %clang_cc1 %s -Eonly -std=c17 -verify=undef-true
// RUN: %clang_cc1 %s -Eonly -std=c23 -verify=undef-true

#if __STDC_VERSION__ >= 202311L
/* undef-true-no-diagnostics */
#endif

#define FOO true
#if FOO /* #1 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#1 {{'true' is not defined, evaluates to 0}} */
#endif

#if true /* #2 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#2 {{'true' is not defined, evaluates to 0}} */
#endif

#if false || true /* #3 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#3 {{'true' is not defined, evaluates to 0}} */
#endif

#define true 1

#define FOO true
#if FOO
#endif

#if true
#endif

#if false || true
#endif

#undef true

#define FOO true
#if FOO /* #4 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#4 {{'true' is not defined, evaluates to 0}} */
#endif

#if true /* #5 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#5 {{'true' is not defined, evaluates to 0}} */
#endif

#if false || true /* #6 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#6 {{'true' is not defined, evaluates to 0}} */
#endif

#define true true
#if true /* #7 */
#endif
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#7 {{'true' is not defined, evaluates to 0}} */
#endif
#undef true

/* Test that #pragma-enabled 'Wundef' can override 'Wundef-true' */
#pragma clang diagnostic warning "-Wundef"
#if true /* #8 */
#endif
#pragma clang diagnostic ignored "-Wundef"
#if __STDC_VERSION__ < 202311L
/* undef-true-warning@#8 {{'true' is not defined, evaluates to 0}} */
#endif