atomic.version.pass.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // WARNING: This test was generated by generate_feature_test_macros_tests.py and
  11. // should not be edited manually.
  12. // <atomic>
  13. // Test the feature test macros defined by <atomic>
  14. /* Constant Value
  15. __cpp_lib_atomic_is_always_lock_free 201603L [C++17]
  16. __cpp_lib_atomic_ref 201806L [C++2a]
  17. __cpp_lib_char8_t 201811L [C++2a]
  18. */
  19. #include <atomic>
  20. #include "test_macros.h"
  21. #if TEST_STD_VER < 14
  22. # ifdef __cpp_lib_atomic_is_always_lock_free
  23. # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
  24. # endif
  25. # ifdef __cpp_lib_atomic_ref
  26. # error "__cpp_lib_atomic_ref should not be defined before c++2a"
  27. # endif
  28. # ifdef __cpp_lib_char8_t
  29. # error "__cpp_lib_char8_t should not be defined before c++2a"
  30. # endif
  31. #elif TEST_STD_VER == 14
  32. # ifdef __cpp_lib_atomic_is_always_lock_free
  33. # error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
  34. # endif
  35. # ifdef __cpp_lib_atomic_ref
  36. # error "__cpp_lib_atomic_ref should not be defined before c++2a"
  37. # endif
  38. # ifdef __cpp_lib_char8_t
  39. # error "__cpp_lib_char8_t should not be defined before c++2a"
  40. # endif
  41. #elif TEST_STD_VER == 17
  42. # ifndef __cpp_lib_atomic_is_always_lock_free
  43. # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
  44. # endif
  45. # if __cpp_lib_atomic_is_always_lock_free != 201603L
  46. # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
  47. # endif
  48. # ifdef __cpp_lib_atomic_ref
  49. # error "__cpp_lib_atomic_ref should not be defined before c++2a"
  50. # endif
  51. # ifdef __cpp_lib_char8_t
  52. # error "__cpp_lib_char8_t should not be defined before c++2a"
  53. # endif
  54. #elif TEST_STD_VER > 17
  55. # ifndef __cpp_lib_atomic_is_always_lock_free
  56. # error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
  57. # endif
  58. # if __cpp_lib_atomic_is_always_lock_free != 201603L
  59. # error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
  60. # endif
  61. # if !defined(_LIBCPP_VERSION)
  62. # ifndef __cpp_lib_atomic_ref
  63. # error "__cpp_lib_atomic_ref should be defined in c++2a"
  64. # endif
  65. # if __cpp_lib_atomic_ref != 201806L
  66. # error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
  67. # endif
  68. # else // _LIBCPP_VERSION
  69. # ifdef __cpp_lib_atomic_ref
  70. # error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
  71. # endif
  72. # endif
  73. # if defined(__cpp_char8_t)
  74. # ifndef __cpp_lib_char8_t
  75. # error "__cpp_lib_char8_t should be defined in c++2a"
  76. # endif
  77. # if __cpp_lib_char8_t != 201811L
  78. # error "__cpp_lib_char8_t should have the value 201811L in c++2a"
  79. # endif
  80. # else
  81. # ifdef __cpp_lib_char8_t
  82. # error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
  83. # endif
  84. # endif
  85. #endif // TEST_STD_VER > 17
  86. int main() {}