blob: 6e05d8e1450ef9ceebeea813d5c5fe55f702538b [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
Chris Lattnerfb42a182009-07-12 21:18:45 +00002
3#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
4
Douglas Gregor3cc26482010-08-30 15:15:34 +00005#pragma clang diagnostic puhs // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
Chris Lattnerfb42a182009-07-12 21:18:45 +00006
John McCall18a2c2c2010-11-09 22:22:12 +00007int a = 'df'; // expected-warning{{multi-character character constant}}
Chris Lattnerfb42a182009-07-12 21:18:45 +00008
9#pragma clang diagnostic push
10#pragma clang diagnostic ignored "-Wmultichar"
11
John McCall18a2c2c2010-11-09 22:22:12 +000012int b = 'df'; // no warning.
Chris Lattnerfb42a182009-07-12 21:18:45 +000013#pragma clang diagnostic pop
14
John McCall18a2c2c2010-11-09 22:22:12 +000015int c = 'df'; // expected-warning{{multi-character character constant}}
Chris Lattnerfb42a182009-07-12 21:18:45 +000016
17#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
Sunil Srivastava5239de72016-02-13 01:44:05 +000018
19// Test -Weverything
20
21void 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"
25void 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.
29void pps2(){}
30#pragma clang diagnostic warning "-Weverything" // Set to warning in this level.
31void ppt2(){} // expected-warning {{no previous prototype for function 'ppt2'}}
32#pragma clang diagnostic error "-Weverything" // Set to error in this level.
33void ppt3(){} // expected-error {{no previous prototype for function 'ppt3'}}
34#pragma clang diagnostic pop // pop should go back to warning level
35
36void pps1(){} // expected-warning {{no previous prototype for function 'pps1'}}
37
38
39#pragma clang diagnostic pop // Another pop should disble it again
40void ppu(){}
41