xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/_Pragma-location.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fms-extensions -E | FileCheck %s
2*f4a2713aSLionel Sambuc // We use -fms-extensions to test both _Pragma and __pragma.
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // A long time ago the pragma lexer's buffer showed through in -E output.
5*f4a2713aSLionel Sambuc // CHECK-NOT: scratch space
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc #define push_p _Pragma ("pack(push)")
8*f4a2713aSLionel Sambuc push_p
9*f4a2713aSLionel Sambuc // CHECK: #pragma pack(push)
10*f4a2713aSLionel Sambuc 
__pragma(pack (push))11*f4a2713aSLionel Sambuc push_p _Pragma("pack(push)") __pragma(pack(push))
12*f4a2713aSLionel Sambuc // CHECK: #pragma pack(push)
13*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 11 "{{.*}}_Pragma-location.c"
14*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma pack(push)
15*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 11 "{{.*}}_Pragma-location.c"
16*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma pack(push)
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #define __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS _Pragma("clang diagnostic push") \
20*f4a2713aSLionel Sambuc _Pragma("clang diagnostic ignored \"-Wformat-extra-args\"")
21*f4a2713aSLionel Sambuc #define __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS _Pragma("clang diagnostic pop")
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc void test () {
24*f4a2713aSLionel Sambuc   1;_Pragma("clang diagnostic push") \
25*f4a2713aSLionel Sambuc   _Pragma("clang diagnostic ignored \"-Wformat-extra-args\"")
26*f4a2713aSLionel Sambuc   _Pragma("clang diagnostic pop")
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc   2;__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS
29*f4a2713aSLionel Sambuc   3;__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // CHECK: void test () {
33*f4a2713aSLionel Sambuc // CHECK-NEXT:   1;
34*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 24 "{{.*}}_Pragma-location.c"
35*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic push
36*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic ignored "-Wformat-extra-args"
37*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic pop
38*f4a2713aSLionel Sambuc 
39*f4a2713aSLionel Sambuc // CHECK:   2;
40*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 28 "{{.*}}_Pragma-location.c"
41*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic push
42*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 28 "{{.*}}_Pragma-location.c"
43*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic ignored "-Wformat-extra-args"
44*f4a2713aSLionel Sambuc // CHECK-NEXT:   3;
45*f4a2713aSLionel Sambuc // CHECK-NEXT: #line 29 "{{.*}}_Pragma-location.c"
46*f4a2713aSLionel Sambuc // CHECK-NEXT: #pragma clang diagnostic pop
47*f4a2713aSLionel Sambuc // CHECK-NEXT: }
48