chrono.version.pass.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // WARNING: This test was generated by generate_feature_test_macro_components.py
  10. // and should not be edited manually.
  11. // <chrono>
  12. // Test the feature test macros defined by <chrono>
  13. /* Constant Value
  14. __cpp_lib_chrono 201611L [C++17]
  15. __cpp_lib_chrono_udls 201304L [C++14]
  16. */
  17. #include <chrono>
  18. #include "test_macros.h"
  19. #if TEST_STD_VER < 14
  20. # ifdef __cpp_lib_chrono
  21. # error "__cpp_lib_chrono should not be defined before c++17"
  22. # endif
  23. # ifdef __cpp_lib_chrono_udls
  24. # error "__cpp_lib_chrono_udls should not be defined before c++14"
  25. # endif
  26. #elif TEST_STD_VER == 14
  27. # ifdef __cpp_lib_chrono
  28. # error "__cpp_lib_chrono should not be defined before c++17"
  29. # endif
  30. # ifndef __cpp_lib_chrono_udls
  31. # error "__cpp_lib_chrono_udls should be defined in c++14"
  32. # endif
  33. # if __cpp_lib_chrono_udls != 201304L
  34. # error "__cpp_lib_chrono_udls should have the value 201304L in c++14"
  35. # endif
  36. #elif TEST_STD_VER == 17
  37. # ifndef __cpp_lib_chrono
  38. # error "__cpp_lib_chrono should be defined in c++17"
  39. # endif
  40. # if __cpp_lib_chrono != 201611L
  41. # error "__cpp_lib_chrono should have the value 201611L in c++17"
  42. # endif
  43. # ifndef __cpp_lib_chrono_udls
  44. # error "__cpp_lib_chrono_udls should be defined in c++17"
  45. # endif
  46. # if __cpp_lib_chrono_udls != 201304L
  47. # error "__cpp_lib_chrono_udls should have the value 201304L in c++17"
  48. # endif
  49. #elif TEST_STD_VER > 17
  50. # ifndef __cpp_lib_chrono
  51. # error "__cpp_lib_chrono should be defined in c++2a"
  52. # endif
  53. # if __cpp_lib_chrono != 201611L
  54. # error "__cpp_lib_chrono should have the value 201611L in c++2a"
  55. # endif
  56. # ifndef __cpp_lib_chrono_udls
  57. # error "__cpp_lib_chrono_udls should be defined in c++2a"
  58. # endif
  59. # if __cpp_lib_chrono_udls != 201304L
  60. # error "__cpp_lib_chrono_udls should have the value 201304L in c++2a"
  61. # endif
  62. #endif // TEST_STD_VER > 17
  63. int main(int, char**) { return 0; }