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