gnu-flags.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE
  2. // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu
  3. // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL \
  4. // RUN: -Wgnu-zero-variadic-macro-arguments \
  5. // RUN: -Wgnu-imaginary-constant -Wgnu-binary-literal -Wgnu-zero-line-directive
  6. // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \
  7. // RUN: -Wno-gnu-zero-variadic-macro-arguments \
  8. // RUN: -Wno-gnu-imaginary-constant -Wno-gnu-binary-literal -Wno-gnu-zero-line-directive
  9. // Additional disabled tests:
  10. // %clang_cc1 -fsyntax-only -verify %s -DZEROARGS -Wgnu-zero-variadic-macro-arguments
  11. // %clang_cc1 -fsyntax-only -verify %s -DIMAGINARYCONST -Wgnu-imaginary-constant
  12. // %clang_cc1 -fsyntax-only -verify %s -DBINARYLITERAL -Wgnu-binary-literal
  13. // %clang_cc1 -fsyntax-only -verify %s -DLINE0 -Wgnu-zero-line-directive
  14. #if NONE
  15. // expected-no-diagnostics
  16. #endif
  17. #if ALL || ZEROARGS
  18. // expected-warning@+9 {{must specify at least one argument for '...' parameter of variadic macro}}
  19. // expected-note@+4 {{macro 'efoo' defined here}}
  20. // expected-warning@+3 {{token pasting of ',' and __VA_ARGS__ is a GNU extension}}
  21. #endif
  22. #define efoo(format, args...) foo(format , ##args)
  23. void foo( const char* c )
  24. {
  25. efoo("6");
  26. }
  27. #if ALL || IMAGINARYCONST
  28. // expected-warning@+3 {{imaginary constants are a GNU extension}}
  29. #endif
  30. float _Complex c = 1.if;
  31. #if ALL || BINARYLITERAL
  32. // expected-warning@+3 {{binary integer literals are a GNU extension}}
  33. #endif
  34. int b = 0b0101;
  35. // This case is handled differently because lit has a bug whereby #line 0 is reported to be on line 4294967295
  36. // http://llvm.org/bugs/show_bug.cgi?id=16952
  37. #if ALL || LINE0
  38. #line 0 // expected-warning {{#line directive with zero argument is a GNU extension}}
  39. #else
  40. #line 0
  41. #endif
  42. // WARNING: Do not add more tests after the #line 0 line! Add them before the LINE0 test