Home | History | Annotate | Download | only in Preprocessor
      1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
      2 
      3 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
      4 
      5 #pragma clang diagnostic puhs // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
      6 
      7 int a = 'df'; // expected-warning{{multi-character character constant}}
      8 
      9 #pragma clang diagnostic push
     10 #pragma clang diagnostic ignored "-Wmultichar"
     11 
     12 int b = 'df'; // no warning.
     13 #pragma clang diagnostic pop
     14 
     15 int c = 'df';  // expected-warning{{multi-character character constant}}
     16 
     17 #pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
     18 
     19 // Test -Weverything
     20 
     21 void ppo0(){} // first verify that we do not give anything on this
     22 #pragma clang diagnostic push // now push
     23 
     24 #pragma clang diagnostic warning "-Weverything"
     25 void ppr1(){} // expected-warning {{no previous prototype for function 'ppr1'}}
     26 
     27 #pragma clang diagnostic push // push again
     28 #pragma clang diagnostic ignored "-Weverything"  // Set to ignore in this level.
     29 void pps2(){}
     30 #pragma clang diagnostic warning "-Weverything"  // Set to warning in this level.
     31 void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
     32 #pragma clang diagnostic error "-Weverything"  // Set to error in this level.
     33 void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
     34 #pragma clang diagnostic pop // pop should go back to warning level
     35 
     36 void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
     37 
     38 
     39 #pragma clang diagnostic pop // Another pop should disble it again
     40 void ppu(){}
     41 
     42