1// RUN: %clang_cc1 %s -verify -Wconversion
2
3// Don't crash (rdar://11168596)
4#define A(desc) _Pragma("clang diagnostic push")  _Pragma("clang diagnostic ignored \"-Wparentheses\"") _Pragma("clang diagnostic pop")
5#define B(desc) A(desc)
6B(_Pragma("clang diagnostic ignored \"-Wparentheses\""))
7
8
9#define EMPTY(x)
10#define INACTIVE(x) EMPTY(x)
11
12#define ID(x) x
13#define ACTIVE(x) ID(x)
14
15// This should be ignored..
16INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))
17
18#define IGNORE_CONV _Pragma("clang diagnostic ignored \"-Wconversion\"") _Pragma("clang diagnostic ignored \"-Wconversion\"")
19
20// ..as should this.
21INACTIVE(IGNORE_CONV)
22
23#define IGNORE_POPPUSH(Pop, Push, W, D) Push W D Pop
24IGNORE_POPPUSH(_Pragma("clang diagnostic pop"), _Pragma("clang diagnostic push"),
25               _Pragma("clang diagnostic ignored \"-Wconversion\""), int q = (double)1.0);
26
27int x1 = (double)1.0; // expected-warning {{implicit conversion}}
28
29ACTIVE(_Pragma) ("clang diagnostic ignored \"-Wconversion\"")) // expected-error {{_Pragma takes a parenthesized string literal}} \
30                                      expected-error {{expected identifier or '('}} expected-error {{expected ')'}} expected-note {{to match this '('}}
31
32// This should disable the warning.
33ACTIVE(IGNORE_CONV)
34
35int x2 = (double)1.0;
36