[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Lexer / builtin_redef.c
blob457e0b8af28e5c06b1ac278165cf51f802773229
1 // RUN: %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -D__STDC__=1 -U__STDC_HOSTED__ -E 2>&1 | FileCheck %s --check-prefix=CHECK-OUT
2 // RUN: %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -D__STDC__=1 -U__STDC_HOSTED__ -E 2>&1 | FileCheck %s --check-prefix=CHECK-WARN
3 // RUN: not %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -D__STDC__=1 -U__STDC_HOSTED__ -E 2>&1 -pedantic-errors | FileCheck %s --check-prefix=CHECK-ERR
5 // CHECK-WARN: <command line>:{{.*}} warning: redefining builtin macro
6 // CHECK-WARN-NEXT: #define __TIME__ 1234
7 // CHECK-WARN: <command line>:{{.*}} warning: undefining builtin macro
8 // CHECK-WARN-NEXT: #undef __DATE__
9 // CHECK-WARN: <command line>:{{.*}} warning: redefining builtin macro
10 // CHECK-WARN-NEXT: #define __STDC__ 1
11 // CHECK-WARN: <command line>:{{.*}} warning: undefining builtin macro
12 // CHECK-WARN-NEXT: #undef __STDC_HOSTED__
14 // CHECK-ERR: <command line>:{{.*}} error: redefining builtin macro
15 // CHECK-ERR-NEXT: #define __TIME__ 1234
16 // CHECK-ERR: <command line>:{{.*}} error: undefining builtin macro
17 // CHECK-ERR-NEXT: #undef __DATE__
18 // CHECK-ERR: <command line>:{{.*}} error: redefining builtin macro
19 // CHECK-ERR-NEXT: #define __STDC__ 1
20 // CHECK-ERR: <command line>:{{.*}} error: undefining builtin macro
21 // CHECK-ERR-NEXT: #undef __STDC_HOSTED__
23 int n = __TIME__;
24 __DATE__
26 #define __FILE__ "my file"
27 // CHECK-WARN: :[[@LINE-1]]:9: warning: redefining builtin macro
28 // CHECK-ERR: :[[@LINE-2]]:9: error: redefining builtin macro
30 // CHECK-OUT: int n = 1234;
31 // CHECK-OUT: __DATE__