~shimon/dismaltc

ref: 1ed81693aae22a7be0136e601ee14b226cce74d4 dismaltc/clang/test/Misc/warn-sysheader.cpp -rw-r--r-- 1.2 KiB
1ed81693Itoh Shimon oops, re-enabled more tests. 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Test that -Wsystem-headers works with default and custom mappings like -Werror.
// Keep run lines at the bottom for line number stability.

#ifdef IS_SYSHEADER
#pragma clang system_header

int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.

#warning "custom message"

#if defined(A) || defined(B)
// expected-warning@9 {{"custom message"}}
#elif defined(C)
// expected-warning@7 {{use of old-style cast}}
// expected-warning@9 {{"custom message"}}
#elif defined(D)
// expected-error@7 {{use of old-style cast}}
// expected-error@9 {{"custom message"}}
#elif defined(E)
// expected-error@7 {{use of old-style cast}}
// expected-warning@9 {{"custom message"}}
#endif

#else
#define IS_SYSHEADER
#include __FILE__
#endif

// RUN: %clang_cc1 -verify -fsyntax-only -DA %s
// RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s
// RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s
// RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s
// RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s