libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

atomic.version.pass.cpp (3782B)


      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_macro_components.py
     11 // and should not be edited manually.
     12 
     13 // UNSUPPORTED: libcpp-has-no-threads
     14 
     15 // <atomic>
     16 
     17 // Test the feature test macros defined by <atomic>
     18 
     19 /*  Constant                                Value
     20     __cpp_lib_atomic_is_always_lock_free    201603L [C++17]
     21     __cpp_lib_atomic_ref                    201806L [C++2a]
     22     __cpp_lib_char8_t                       201811L [C++2a]
     23 */
     24 
     25 #include <atomic>
     26 #include "test_macros.h"
     27 
     28 #if TEST_STD_VER < 14
     29 
     30 # ifdef __cpp_lib_atomic_is_always_lock_free
     31 #   error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
     32 # endif
     33 
     34 # ifdef __cpp_lib_atomic_ref
     35 #   error "__cpp_lib_atomic_ref should not be defined before c++2a"
     36 # endif
     37 
     38 # ifdef __cpp_lib_char8_t
     39 #   error "__cpp_lib_char8_t should not be defined before c++2a"
     40 # endif
     41 
     42 #elif TEST_STD_VER == 14
     43 
     44 # ifdef __cpp_lib_atomic_is_always_lock_free
     45 #   error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
     46 # endif
     47 
     48 # ifdef __cpp_lib_atomic_ref
     49 #   error "__cpp_lib_atomic_ref should not be defined before c++2a"
     50 # endif
     51 
     52 # ifdef __cpp_lib_char8_t
     53 #   error "__cpp_lib_char8_t should not be defined before c++2a"
     54 # endif
     55 
     56 #elif TEST_STD_VER == 17
     57 
     58 # if !defined(_LIBCPP_HAS_NO_THREADS)
     59 #   ifndef __cpp_lib_atomic_is_always_lock_free
     60 #     error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
     61 #   endif
     62 #   if __cpp_lib_atomic_is_always_lock_free != 201603L
     63 #     error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
     64 #   endif
     65 # else
     66 #   ifdef __cpp_lib_atomic_is_always_lock_free
     67 #     error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
     68 #   endif
     69 # endif
     70 
     71 # ifdef __cpp_lib_atomic_ref
     72 #   error "__cpp_lib_atomic_ref should not be defined before c++2a"
     73 # endif
     74 
     75 # ifdef __cpp_lib_char8_t
     76 #   error "__cpp_lib_char8_t should not be defined before c++2a"
     77 # endif
     78 
     79 #elif TEST_STD_VER > 17
     80 
     81 # if !defined(_LIBCPP_HAS_NO_THREADS)
     82 #   ifndef __cpp_lib_atomic_is_always_lock_free
     83 #     error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
     84 #   endif
     85 #   if __cpp_lib_atomic_is_always_lock_free != 201603L
     86 #     error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
     87 #   endif
     88 # else
     89 #   ifdef __cpp_lib_atomic_is_always_lock_free
     90 #     error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
     91 #   endif
     92 # endif
     93 
     94 # if !defined(_LIBCPP_VERSION)
     95 #   ifndef __cpp_lib_atomic_ref
     96 #     error "__cpp_lib_atomic_ref should be defined in c++2a"
     97 #   endif
     98 #   if __cpp_lib_atomic_ref != 201806L
     99 #     error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
    100 #   endif
    101 # else // _LIBCPP_VERSION
    102 #   ifdef __cpp_lib_atomic_ref
    103 #     error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
    104 #   endif
    105 # endif
    106 
    107 # if defined(__cpp_char8_t)
    108 #   ifndef __cpp_lib_char8_t
    109 #     error "__cpp_lib_char8_t should be defined in c++2a"
    110 #   endif
    111 #   if __cpp_lib_char8_t != 201811L
    112 #     error "__cpp_lib_char8_t should have the value 201811L in c++2a"
    113 #   endif
    114 # else
    115 #   ifdef __cpp_lib_char8_t
    116 #     error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
    117 #   endif
    118 # endif
    119 
    120 #endif // TEST_STD_VER > 17
    121 
    122 int main() {}