Home | History | Annotate | Download | only in Preprocessor
      1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-undef %s
      2 // rdar://2362963
      3 
      4 #if FOO    // ok.
      5 #endif
      6 
      7 #pragma GCC diagnostic warning "-Wundef"
      8 
      9 #if FOO    // expected-warning {{'FOO' is not defined}}
     10 #endif
     11 
     12 #pragma GCC diagnostic ignored "-Wun" "def"
     13 
     14 #if FOO    // ok.
     15 #endif
     16 
     17 #pragma GCC diagnostic error "-Wundef"
     18 
     19 #if FOO    // expected-error {{'FOO' is not defined}}
     20 #endif
     21 
     22 
     23 #define foo error
     24 #pragma GCC diagnostic foo "-Wundef"  // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
     25 
     26 #pragma GCC diagnostic error 42  // expected-error {{expected string literal in pragma diagnostic}}
     27 
     28 #pragma GCC diagnostic error "-Wundef" 42  // expected-warning {{unexpected token in pragma diagnostic}}
     29 #pragma GCC diagnostic error "invalid-name"  // expected-warning {{pragma diagnostic expected option name (e.g. "-Wundef")}}
     30 
     31 #pragma GCC diagnostic error "-Winvalid-name"  // expected-warning {{unknown warning group '-Winvalid-name', ignored}}
     32 
     33