1 | // RUN: %clang_cc1 -Weverything -fsyntax-only -verify %s |
2 | |
3 | // Test that the pragma overrides command line option -Weverythings, |
4 | |
5 | // a diagnostic with DefaultIgnore. This is part of a group 'unused-macro' |
6 | // but -Weverything forces it |
7 | #define UNUSED_MACRO1 1 // expected-warning{{macro is not used}} |
8 | |
9 | void foo() // expected-warning {{no previous prototype for function}} |
10 | { |
11 | // A diagnostic without DefaultIgnore, and not part of a group. |
12 | (void) L'ab'; // expected-warning {{extraneous characters in character constant ignored}} |
13 | |
14 | #pragma clang diagnostic warning "-Weverything" // Should not change anyhting. |
15 | #define UNUSED_MACRO2 1 // expected-warning{{macro is not used}} |
16 | (void) L'cd'; // expected-warning {{extraneous characters in character constant ignored}} |
17 | |
18 | #pragma clang diagnostic ignored "-Weverything" // Ignore warnings now. |
19 | #define UNUSED_MACRO2 1 // no warning |
20 | (void) L'ef'; // no warning here |
21 | |
22 | #pragma clang diagnostic warning "-Weverything" // Revert back to warnings. |
23 | #define UNUSED_MACRO3 1 // expected-warning{{macro is not used}} |
24 | (void) L'gh'; // expected-warning {{extraneous characters in character constant ignored}} |
25 | |
26 | #pragma clang diagnostic error "-Weverything" // Give errors now. |
27 | #define UNUSED_MACRO4 1 // expected-error{{macro is not used}} |
28 | (void) L'ij'; // expected-error {{extraneous characters in character constant ignored}} |
29 | } |
30 | |