extension-warning.c 575 B

123456789101112131415161718
  1. // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
  2. // The preprocessor shouldn't warn about extensions within macro bodies that
  3. // aren't expanded.
  4. #define TY typeof
  5. #define TY1 typeof(1)
  6. // But we should warn here
  7. TY1 x; // expected-warning {{extension}}
  8. TY(1) x; // FIXME: And we should warn here
  9. // Note: this warning intentionally doesn't trigger on keywords like
  10. // __attribute; the standard allows implementation-defined extensions
  11. // prefixed with "__".
  12. // Current list of keywords this can trigger on:
  13. // inline, restrict, asm, typeof, _asm
  14. void whatever() {}