annotate clang/test/Misc/warn-sysheader.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900 (2020-02-13)
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // Test that -Wsystem-headers works with default and custom mappings like -Werror.
anatofuz
parents:
diff changeset
2 // Keep run lines at the bottom for line number stability.
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 #ifdef IS_SYSHEADER
anatofuz
parents:
diff changeset
5 #pragma clang system_header
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #warning "custom message"
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 #if defined(A) || defined(B)
anatofuz
parents:
diff changeset
12 // expected-warning@9 {{"custom message"}}
anatofuz
parents:
diff changeset
13 #elif defined(C)
anatofuz
parents:
diff changeset
14 // expected-warning@7 {{use of old-style cast}}
anatofuz
parents:
diff changeset
15 // expected-warning@9 {{"custom message"}}
anatofuz
parents:
diff changeset
16 #elif defined(D)
anatofuz
parents:
diff changeset
17 // expected-error@7 {{use of old-style cast}}
anatofuz
parents:
diff changeset
18 // expected-error@9 {{"custom message"}}
anatofuz
parents:
diff changeset
19 #elif defined(E)
anatofuz
parents:
diff changeset
20 // expected-error@7 {{use of old-style cast}}
anatofuz
parents:
diff changeset
21 // expected-warning@9 {{"custom message"}}
anatofuz
parents:
diff changeset
22 #endif
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 #else
anatofuz
parents:
diff changeset
25 #define IS_SYSHEADER
anatofuz
parents:
diff changeset
26 #include __FILE__
anatofuz
parents:
diff changeset
27 #endif
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 // RUN: %clang_cc1 -verify -fsyntax-only -DA %s
anatofuz
parents:
diff changeset
30 // RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s
anatofuz
parents:
diff changeset
31 // RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s
anatofuz
parents:
diff changeset
32 // RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s
anatofuz
parents:
diff changeset
33 // RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s