1 /* PR preprocessor/92296 */
2 /* { dg-do preprocess } */
3 /* { dg-options "-Wno-builtin-macro-redefined" } */
4 
5 #pragma push_macro("__TIMESTAMP__")
6 #undef __TIMESTAMP__
7 #define __TIMESTAMP__ "Thu Oct 31 12:00:00 2019"
8 timestamp1 = __TIMESTAMP__
9 #pragma pop_macro("__TIMESTAMP__")
10 timestamp2 = __TIMESTAMP__
11 
12 #pragma push_macro("__TIME__")
13 #undef __TIME__
14 #define __TIME__ "12:00:00"
15 time1 = __TIME__
16 #pragma pop_macro("__TIME__")
17 time2 = __TIME__
18 
19 #pragma push_macro("__DATE__")
20 #undef __DATE__
21 #define __DATE__ "Oct 31 2019"
22 date1 = __DATE__
23 #pragma pop_macro("__DATE__")
24 date2 = __DATE__
25 
26 #pragma push_macro("__FILE__")
27 #undef __FILE__
28 #define __FILE__ "pr92296-3.c"
29 file1 = __FILE__	/* { dg-final { scan-file pr92296-2.i "file1 = \"pr92296-3.c\"" } } */
30 #pragma pop_macro("__FILE__")
31 file2 = __FILE__	/* { dg-final { scan-file-not pr92296-2.i "file2 = \"pr92296-3.c\"" } } */
32 
33 #pragma push_macro("__BASE_FILE__")
34 #undef __BASE_FILE__
35 #define __BASE_FILE__ "pr92296-4.c"
36 filebase1 = __BASE_FILE__	/* { dg-final { scan-file pr92296-2.i "filebase1 = \"pr92296-4.c\"" } } */
37 #pragma pop_macro("__BASE_FILE__")
38 filebase2 = __BASE_FILE__	/* { dg-final { scan-file-not pr92296-2.i "filebase2 = \"pr92296-4.c\"" } } */
39 
40 #pragma push_macro("__LINE__")
41 #undef __LINE__		/* { dg-warning "undefining" } */
42 #define __LINE__ 142
43 line1 = __LINE__	/* { dg-final { scan-file pr92296-2.i "line1 = 142" } } */
44 #pragma pop_macro("__LINE__")
45 line2 = __LINE__	/* { dg-final { scan-file pr92296-2.i "line2 = 45" } } */
46 
47 #pragma push_macro("__INCLUDE_LEVEL__")
48 #undef __INCLUDE_LEVEL__	/* { dg-warning "undefining" } */
49 #define __INCLUDE_LEVEL__ 42
50 includelevel1 = __INCLUDE_LEVEL__	/* { dg-final { scan-file pr92296-2.i "includelevel1 = 42" } } */
51 #pragma pop_macro("__INCLUDE_LEVEL__")
52 includelevel2 = __INCLUDE_LEVEL__	/* { dg-final { scan-file pr92296-2.i "includelevel2 = 0" } } */
53 
54 #pragma push_macro("__COUNTER__")
55 #undef __COUNTER__	/* { dg-warning "undefining" } */
56 #define __COUNTER__ 172
57 counter1 = __COUNTER__	/* { dg-final { scan-file pr92296-2.i "counter1 = 172" } } */
58 #pragma pop_macro("__COUNTER__")
59 counter2 = __COUNTER__	/* { dg-final { scan-file-not pr92296-2.i "counter2 = 172" } } */
60 
61 #pragma push_macro("__has_attribute")
62 #undef __has_attribute	/* { dg-warning "undefining" } */
63 #define __has_attribute(x) 0
64 hasattr1 = __has_attribute(noreturn)	/* { dg-final { scan-file pr92296-2.i "hasattr1 = 0" } } */
65 #pragma pop_macro("__has_attribute")
66 hasattr2 = __has_attribute(noreturn)	/* { dg-final { scan-file-not pr92296-2.i "hasattr2 = 0" } } */
67 
68 #pragma push_macro("__has_cpp_attribute")
69 #undef __has_cpp_attribute	/* { dg-warning "undefining" } */
70 #define __has_cpp_attribute(x) 0
71 hasattrcpp1 = __has_cpp_attribute(noreturn)	/* { dg-final { scan-file pr92296-2.i "hasattrcpp1 = 0" } } */
72 #pragma pop_macro("__has_cpp_attribute")
73 hasattrcpp2 = __has_cpp_attribute(noreturn)	/* { dg-final { scan-file-not pr92296-2.i "hasattrcpp2 = 0" } } */
74 
75 #pragma push_macro("__has_builtin")
76 #undef __has_builtin	/* { dg-warning "undefining" } */
77 #define __has_builtin(x) 0
78 hasbuiltin1 = __has_builtin(__builtin_expect)	/* { dg-final { scan-file pr92296-2.i "hasbuiltin1 = 0" } } */
79 #pragma pop_macro("__has_builtin")
80 hasbuiltin2 = __has_builtin(__builtin_expect)	/* { dg-final { scan-file pr92296-2.i "hasbuiltin2 = 1" } } */
81