29 lines · c
1// RUN: %clang_cc1 %s -E -CC -verify2// RUN: %clang_cc1 %s -E -CC -DPEDANTIC -pedantic -verify3 4#define FOO && 15#if defined FOO FOO6#endif7 8#define A9#define B defined(A)10#if B // expected-warning{{macro expansion producing 'defined' has undefined behavior}}11#endif12 13#define m_foo14#define TEST(a) (defined(m_##a) && a)15 16#if defined(PEDANTIC)17// expected-warning@+4{{macro expansion producing 'defined' has undefined behavior}}18#endif19 20// This shouldn't warn by default, only with pedantic:21#if TEST(foo)22#endif23 24 25// Only one diagnostic for this case:26#define INVALID defined(27#if INVALID // expected-error{{macro name missing}}28#endif29