• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only %s -verify
2 #ifndef __has_warning
3 #error Should have __has_warning
4 #endif
5 
6 #if __has_warning("not valid") // expected-warning {{__has_warning expected option name}}
7 #endif
8 
9 // expected-warning@+2 {{Should have -Wparentheses}}
10 #if __has_warning("-Wparentheses")
11 #warning Should have -Wparentheses
12 #endif
13 
14 #if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}}
15 #endif
16 
17 // expected-warning@+3 {{Not a valid warning flag}}
18 #if __has_warning("-Wnot-a-valid-warning-flag-at-all")
19 #else
20 #warning Not a valid warning flag
21 #endif
22