[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / Preprocessor / pushable-diagnostics.c
blob9eaf87d58f8201192cdc4b2fae74b275f0b5db47
1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
3 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
5 #pragma clang diagnostic puhs // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
7 int a = 'df'; // expected-warning{{multi-character character constant}}
9 #pragma clang diagnostic push
10 #pragma clang diagnostic ignored "-Wmultichar"
12 int b = 'df'; // no warning.
13 #pragma clang diagnostic pop
15 int c = 'df'; // expected-warning{{multi-character character constant}}
17 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
19 // Test -Weverything
21 void ppo0(void){} // first verify that we do not give anything on this
22 #pragma clang diagnostic push // now push
24 #pragma clang diagnostic warning "-Weverything"
25 void ppr1(void){} // expected-warning {{no previous prototype for function 'ppr1'}}
26 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
28 #pragma clang diagnostic push // push again
29 #pragma clang diagnostic ignored "-Weverything" // Set to ignore in this level.
30 void pps2(void){}
31 #pragma clang diagnostic warning "-Weverything" // Set to warning in this level.
32 void ppt2(void){} // expected-warning {{no previous prototype for function 'ppt2'}}
33 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
34 #pragma clang diagnostic error "-Weverything" // Set to error in this level.
35 void ppt3(void){} // expected-error {{no previous prototype for function 'ppt3'}}
36 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
37 #pragma clang diagnostic pop // pop should go back to warning level
39 void pps1(void){} // expected-warning {{no previous prototype for function 'pps1'}}
40 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
43 #pragma clang diagnostic pop // Another pop should disble it again
44 void ppu(void){}