brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · abec804 Raw
75 lines · c
1// expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}2#if UNSAFE_MACRO3#endif4 5// expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}6#if defined(UNSAFE_MACRO)7#endif8 9// expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}10#ifdef UNSAFE_MACRO11#endif12 13// expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}14#ifndef UNSAFE_MACRO15#endif16 17// expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}18const int x = UNSAFE_MACRO;19 20// expected-warning@+1{{macro 'UNSAFE_MACRO_2' has been marked as unsafe for use in headers}}21const int y = UNSAFE_MACRO_2;22 23// not-expected-warning@+1{{macro 'UNSAFE_MACRO_2' has been marked as unsafe for use in headers}}24#undef UNSAFE_MACRO_225// not-expected-warning@+1{{macro 'UNSAFE_MACRO_2' has been marked as unsafe for use in headers}}26#define UNSAFE_MACRO_2 227 28// not-expected-warning@+1{{macro 'UNSAFE_MACRO_2' has been marked as unsafe for use in headers}}29const int z = UNSAFE_MACRO_2;30 31 32// Test that we diagnose on #elif.33#if 034#elif UNSAFE_MACRO35// expected-warning@-1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}36#endif37 38 39// Test that we diagnose on #elifdef.40#ifdef baz41#elifdef UNSAFE_MACRO42// expected-warning@-1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}43// expected-warning@-2{{use of a '#elifdef' directive is a C23 extension}}44#endif45 46// Test that we diagnose on #elifndef.47#ifdef baz48#elifndef UNSAFE_MACRO49#endif50// expected-warning@-2{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}51// expected-warning@-3{{use of a '#elifndef' directive is a C23 extension}}52 53// FIXME: These cases are currently not handled because clang doesn't expand54// conditions on skipped #elif* blocks. See the FIXME notes in55// Preprocessor::SkipExcludedConditionalBlock.56 57#define frobble58 59#ifdef frobble60// not-expected-warning@+2{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}61// expected-warning@+1{{use of a '#elifndef' directive is a C23 extension}}62#elifndef UNSAFE_MACRO63#endif64 65#ifdef frobble66// not-expected-warning@+2{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}67// expected-warning@+1{{use of a '#elifdef' directive is a C23 extension}}68#elifdef UNSAFE_MACRO69#endif70 71#if 172// not-expected-warning@+1{{macro 'UNSAFE_MACRO' has been marked as unsafe for use in headers: Don't use this!}}73#elif UNSAFE_MACRO74#endif75