1 /* Test pragma pop_macro and push_macro directives from
2 http://msdn.microsoft.com/en-us/library/hsttss76.aspx */
4 // pop_macro: Sets the value of the macro_name macro to the value on the top of
5 // the stack for this macro.
6 // #pragma pop_macro("macro_name")
7 // push_macro: Saves the value of the macro_name macro on the top of the stack
9 // #pragma push_macro("macro_name")
11 // RUN: %clang_cc1 -fms-extensions -E %s -o - | FileCheck %s
18 #pragma push_macro("Y")
19 #pragma push_macro("X")
23 #pragma pop_macro("X")
25 #pragma pop_macro("Y")
28 // Have a stray 'push' to show we don't crash when having imbalanced
30 #pragma push_macro("Y")
34 // The sequence push, define/undef, pop caused problems if macro was not
35 // previously defined.
36 #pragma push_macro("PREVIOUSLY_UNDEFINED1")
37 #undef PREVIOUSLY_UNDEFINED1
38 #pragma pop_macro("PREVIOUSLY_UNDEFINED1")
39 #ifndef PREVIOUSLY_UNDEFINED1
43 #pragma push_macro("PREVIOUSLY_UNDEFINED2")
44 #define PREVIOUSLY_UNDEFINED2
45 #pragma pop_macro("PREVIOUSLY_UNDEFINED2")
46 #ifndef PREVIOUSLY_UNDEFINED2
50 // CHECK: int pmx0 = 1
51 // CHECK: int pmy0 = 2
52 // CHECK: int pmx1 = 1
53 // CHECK: int pmx2 = 2
54 // CHECK: int pmx3 = 1
55 // CHECK: int pmy1 = 3
56 // CHECK: int pmy2 = 4