warn-date-time.c 710 B

1234567891011121314151617181920212223
  1. // RUN: %clang_cc1 -Wdate-time -Wno-builtin-macro-redefined %s -verify -E
  2. // RUN: %clang_cc1 -Wdate-time -Wno-builtin-macro-redefined %s -DIS_SYSHEADER -verify -E
  3. // RUN: not %clang_cc1 -Werror=date-time -Wno-builtin-macro-redefined %s -DIS_SYSHEADER -E 2>&1 | grep 'error: expansion' | count 3
  4. #ifdef IS_HEADER
  5. #ifdef IS_SYSHEADER
  6. #pragma clang system_header
  7. #endif
  8. __TIME__ // expected-warning {{expansion of date or time macro is not reproducible}}
  9. __DATE__ // expected-warning {{expansion of date or time macro is not reproducible}}
  10. __TIMESTAMP__ // expected-warning {{expansion of date or time macro is not reproducible}}
  11. #define __TIME__
  12. __TIME__
  13. #else
  14. #define IS_HEADER
  15. #include __FILE__
  16. #endif