1*67e74705SXin Li // Test that -Wsystem-headers works with default and custom mappings like -Werror. 2*67e74705SXin Li // Keep run lines at the bottom for line number stability. 3*67e74705SXin Li 4*67e74705SXin Li #ifdef IS_SYSHEADER 5*67e74705SXin Li #pragma clang system_header 6*67e74705SXin Li f()7*67e74705SXin Liint f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing. 8*67e74705SXin Li 9*67e74705SXin Li #warning "custom message" 10*67e74705SXin Li 11*67e74705SXin Li #if defined(A) || defined(B) 12*67e74705SXin Li // expected-warning@9 {{"custom message"}} 13*67e74705SXin Li #elif defined(C) 14*67e74705SXin Li // expected-warning@7 {{use of old-style cast}} 15*67e74705SXin Li // expected-warning@9 {{"custom message"}} 16*67e74705SXin Li #elif defined(D) 17*67e74705SXin Li // expected-error@7 {{use of old-style cast}} 18*67e74705SXin Li // expected-error@9 {{"custom message"}} 19*67e74705SXin Li #elif defined(E) 20*67e74705SXin Li // expected-error@7 {{use of old-style cast}} 21*67e74705SXin Li // expected-warning@9 {{"custom message"}} 22*67e74705SXin Li #endif 23*67e74705SXin Li 24*67e74705SXin Li #else 25*67e74705SXin Li #define IS_SYSHEADER 26*67e74705SXin Li #include __FILE__ 27*67e74705SXin Li #endif 28*67e74705SXin Li 29*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -DA %s 30*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s 31*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s 32*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s 33*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s 34