annotate clang/test/Preprocessor/_Pragma-in-macro-arg.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -verify -Wconversion
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #define P(X) _Pragma(#X)
anatofuz
parents:
diff changeset
4 #define V(X) X
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 #define X \
anatofuz
parents:
diff changeset
7 P(clang diagnostic push) \
anatofuz
parents:
diff changeset
8 P(clang diagnostic ignored "-Wconversion") \
anatofuz
parents:
diff changeset
9 ) = 1.2; \
anatofuz
parents:
diff changeset
10 P(clang diagnostic pop)
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 void f() {
anatofuz
parents:
diff changeset
13 int a = 1.2; // expected-warning {{changes value}}
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 // Note, we intentionally enter a tentatively-parsed context here to trigger
anatofuz
parents:
diff changeset
16 // regular use of lookahead. This would go wrong if _Pragma checking in macro
anatofuz
parents:
diff changeset
17 // argument pre-expansion also tries to use token lookahead.
anatofuz
parents:
diff changeset
18 int (b
anatofuz
parents:
diff changeset
19 V(X)
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 int c = 1.2; // expected-warning {{changes value}}
anatofuz
parents:
diff changeset
22 }