brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · dbc3825 Raw
34 lines · cpp
1// Test that -Wsystem-headers works with default and custom mappings like -Werror.2// Keep run lines at the bottom for line number stability.3 4#ifdef IS_SYSHEADER5#pragma clang system_header6 7int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.8 9#warning "custom message"10 11#if defined(A) || defined(B)12// expected-warning@9 {{"custom message"}}13#elif defined(C)14// expected-warning@7 {{use of old-style cast}}15// expected-warning@9 {{"custom message"}}16#elif defined(D)17// expected-error@7 {{use of old-style cast}}18// expected-error@9 {{"custom message"}}19#elif defined(E)20// expected-error@7 {{use of old-style cast}}21// expected-warning@9 {{"custom message"}}22#endif23 24#else25#define IS_SYSHEADER26#include __FILE__27#endif28 29// RUN: %clang_cc1 -verify -fsyntax-only -DA %s30// RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s31// RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s32// RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s33// RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s34