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 
foo(void)9 void foo(void) // expected-warning {{no previous prototype for function}}
10 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
11 {
12  // A diagnostic without DefaultIgnore, and not part of a group.
13  (void) L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
14 
15 #pragma clang diagnostic warning "-Weverything" // Should not change anyhting.
16 #define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}
17  (void) L'cd'; // expected-warning {{extraneous characters in character constant ignored}}
18 
19 #pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.
20 #define UNUSED_MACRO2 1 // no warning
21  (void) L'ef'; // no warning here
22 
23 #pragma clang diagnostic warning "-Weverything" // Revert back to warnings.
24 #define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}
25  (void) L'gh'; // expected-warning {{extraneous characters in character constant ignored}}
26 
27 #pragma clang diagnostic error "-Weverything"  // Give errors now.
28 #define UNUSED_MACRO4 1 // expected-error{{macro is not used}}
29  (void) L'ij'; // expected-error {{extraneous characters in character constant ignored}}
30 }
31