annotate clang/test/Preprocessor/expr_liveness.c @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 /* RUN: %clang_cc1 -E %s -DNO_ERRORS -Werror -Wundef
anatofuz
parents:
diff changeset
2 RUN: not %clang_cc1 -E %s
anatofuz
parents:
diff changeset
3 */
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 #ifdef NO_ERRORS
anatofuz
parents:
diff changeset
6 /* None of these divisions by zero are in live parts of the expression, do not
anatofuz
parents:
diff changeset
7 emit any diagnostics. */
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #define MACRO_0 0
anatofuz
parents:
diff changeset
10 #define MACRO_1 1
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 #if MACRO_0 && 10 / MACRO_0
anatofuz
parents:
diff changeset
13 foo
anatofuz
parents:
diff changeset
14 #endif
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 #if MACRO_1 || 10 / MACRO_0
anatofuz
parents:
diff changeset
17 bar
anatofuz
parents:
diff changeset
18 #endif
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 #if 0 ? 124/0 : 42
anatofuz
parents:
diff changeset
21 #endif
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 // PR2279
anatofuz
parents:
diff changeset
24 #if 0 ? 1/0: 2
anatofuz
parents:
diff changeset
25 #else
anatofuz
parents:
diff changeset
26 #error
anatofuz
parents:
diff changeset
27 #endif
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 // PR2279
anatofuz
parents:
diff changeset
30 #if 1 ? 2 ? 3 : 4 : 5
anatofuz
parents:
diff changeset
31 #endif
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 // PR2284
anatofuz
parents:
diff changeset
34 #if 1 ? 0: 1 ? 1/0: 1/0
anatofuz
parents:
diff changeset
35 #endif
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 #else
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 /* The 1/0 is live, it should error out. */
anatofuz
parents:
diff changeset
41 #if 0 && 1 ? 4 : 1 / 0
anatofuz
parents:
diff changeset
42 baz
anatofuz
parents:
diff changeset
43 #endif
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 #endif
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 // rdar://6505352
anatofuz
parents:
diff changeset
49 // -Wundef should not warn about use of undefined identifier if not live.
anatofuz
parents:
diff changeset
50 #if (!defined(XXX) || XXX > 42)
anatofuz
parents:
diff changeset
51 #endif
anatofuz
parents:
diff changeset
52