15796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner// RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
25796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner// rdar://2362963
35796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
45796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#if FOO    // ok.
55796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#endif
65796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
75796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic warning "-Wundef"
85796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
95796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#if FOO    // expected-warning {{'FOO' is not defined}}
105796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#endif
115796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
125796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic ignored "-Wun" "def"
135796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
145796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#if FOO    // ok.
155796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#endif
165796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
175796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic error "-Wundef"
185796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
195796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#if FOO    // expected-error {{'FOO' is not defined}}
205796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#endif
215796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
225796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
235796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#define foo error
246493a4d7129673f7878da2382dedf4f9abc57e4cDouglas Gregor#pragma GCC diagnostic foo "-Wundef"  // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
255796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
2697f8461a2c553f68a258612d2322e4281c3f0915Andy Gibbs#pragma GCC diagnostic error 42  // expected-error {{expected string literal in pragma diagnostic}}
275796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
285796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic error "-Wundef" 42  // expected-warning {{unexpected token in pragma diagnostic}}
295796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic error "invalid-name"  // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
305796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
315796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner#pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
325796df9464762134d8edf4bd4edc673db311ffd4Chris Lattner
33