1 // Test that -Wsystem-headers works with default and custom mappings like -Werror.
2 // Keep run lines at the bottom for line number stability.
5 #pragma clang system_header
7 int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.
9 #warning "custom message"
11 #if defined(A) || defined(B)
12 // expected-warning@9 {{"custom message"}}
14 // expected-warning@7 {{use of old-style cast}}
15 // expected-warning@9 {{"custom message"}}
17 // expected-error@7 {{use of old-style cast}}
18 // expected-error@9 {{"custom message"}}
20 // expected-error@7 {{use of old-style cast}}
21 // expected-warning@9 {{"custom message"}}
29 // RUN: %clang_cc1 -verify -fsyntax-only -DA %s
30 // RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s
31 // RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s
32 // RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s
33 // RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s