disabled-cond-diags2.c 664 B

123456789101112131415161718192021222324252627
  1. // RUN: %clang_cc1 -Eonly -verify %s
  2. #if 0
  3. #if 1
  4. #endif junk // shouldn't produce diagnostics
  5. #endif
  6. #if 0
  7. #endif junk // expected-warning{{extra tokens at end of #endif directive}}
  8. #if 1 junk // expected-error{{token is not a valid binary operator in a preprocessor subexpression}}
  9. #X // shouldn't produce diagnostics (block #if condition not valid, so skipped)
  10. #else
  11. #X // expected-error{{invalid preprocessing directive}}
  12. #endif
  13. #if 0
  14. // diagnostics should not be produced until final #endif
  15. #X
  16. #include
  17. #if 1 junk
  18. #else junk
  19. #endif junk
  20. #line -2
  21. #error
  22. #warning
  23. #endif junk // expected-warning{{extra tokens at end of #endif directive}}