shared_mutex.version.pass.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. // UNSUPPORTED: libcpp-has-no-threads
  12. // <shared_mutex>
  13. // Test the feature test macros defined by <shared_mutex>
  14. /* Constant Value
  15. __cpp_lib_shared_mutex 201505L [C++17]
  16. __cpp_lib_shared_timed_mutex 201402L [C++14]
  17. */
  18. #include <shared_mutex>
  19. #include "test_macros.h"
  20. #if TEST_STD_VER < 14
  21. # ifdef __cpp_lib_shared_mutex
  22. # error "__cpp_lib_shared_mutex should not be defined before c++17"
  23. # endif
  24. # ifdef __cpp_lib_shared_timed_mutex
  25. # error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
  26. # endif
  27. #elif TEST_STD_VER == 14
  28. # ifdef __cpp_lib_shared_mutex
  29. # error "__cpp_lib_shared_mutex should not be defined before c++17"
  30. # endif
  31. # if !defined(_LIBCPP_HAS_NO_THREADS)
  32. # ifndef __cpp_lib_shared_timed_mutex
  33. # error "__cpp_lib_shared_timed_mutex should be defined in c++14"
  34. # endif
  35. # if __cpp_lib_shared_timed_mutex != 201402L
  36. # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
  37. # endif
  38. # else
  39. # ifdef __cpp_lib_shared_timed_mutex
  40. # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
  41. # endif
  42. # endif
  43. #elif TEST_STD_VER == 17
  44. # if !defined(_LIBCPP_HAS_NO_THREADS)
  45. # ifndef __cpp_lib_shared_mutex
  46. # error "__cpp_lib_shared_mutex should be defined in c++17"
  47. # endif
  48. # if __cpp_lib_shared_mutex != 201505L
  49. # error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
  50. # endif
  51. # else
  52. # ifdef __cpp_lib_shared_mutex
  53. # error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
  54. # endif
  55. # endif
  56. # if !defined(_LIBCPP_HAS_NO_THREADS)
  57. # ifndef __cpp_lib_shared_timed_mutex
  58. # error "__cpp_lib_shared_timed_mutex should be defined in c++17"
  59. # endif
  60. # if __cpp_lib_shared_timed_mutex != 201402L
  61. # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
  62. # endif
  63. # else
  64. # ifdef __cpp_lib_shared_timed_mutex
  65. # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
  66. # endif
  67. # endif
  68. #elif TEST_STD_VER > 17
  69. # if !defined(_LIBCPP_HAS_NO_THREADS)
  70. # ifndef __cpp_lib_shared_mutex
  71. # error "__cpp_lib_shared_mutex should be defined in c++2a"
  72. # endif
  73. # if __cpp_lib_shared_mutex != 201505L
  74. # error "__cpp_lib_shared_mutex should have the value 201505L in c++2a"
  75. # endif
  76. # else
  77. # ifdef __cpp_lib_shared_mutex
  78. # error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
  79. # endif
  80. # endif
  81. # if !defined(_LIBCPP_HAS_NO_THREADS)
  82. # ifndef __cpp_lib_shared_timed_mutex
  83. # error "__cpp_lib_shared_timed_mutex should be defined in c++2a"
  84. # endif
  85. # if __cpp_lib_shared_timed_mutex != 201402L
  86. # error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a"
  87. # endif
  88. # else
  89. # ifdef __cpp_lib_shared_timed_mutex
  90. # error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
  91. # endif
  92. # endif
  93. #endif // TEST_STD_VER > 17
  94. int main(int, char**) { return 0; }