|
23 | 23 | # pragma system_header |
24 | 24 | #endif // no system header |
25 | 25 |
|
26 | | -#define _CCCL_HOST_STD_LIB_LIBSTDCXX() 0 |
27 | | -#define _CCCL_HOST_STD_LIB_LIBCXX() 0 |
28 | | -#define _CCCL_HOST_STD_LIB_STL() 0 |
| 26 | +#define _CCCL_HOST_STD_LIB_LIBSTDCXX() _CCCL_VERSION_INVALID() |
| 27 | +#define _CCCL_HOST_STD_LIB_LIBCXX() _CCCL_VERSION_INVALID() |
| 28 | +#define _CCCL_HOST_STD_LIB_STL() _CCCL_VERSION_INVALID() |
29 | 29 |
|
30 | 30 | // include a minimal header |
31 | 31 | #if _CCCL_HAS_INCLUDE(<version>) |
|
34 | 34 | # include <ciso646> |
35 | 35 | #endif // ^^^ _CCCL_HAS_INCLUDE(<ciso646>) ^^^ |
36 | 36 |
|
| 37 | +#define _CCCL_HOST_STD_LIB_MAKE_VERSION(_MAJOR, _MINOR) ((_MAJOR) * 100 + (_MINOR)) |
| 38 | +#define _CCCL_HOST_STD_LIB(...) _CCCL_VERSION_COMPARE(_CCCL_HOST_STD_LIB_, _CCCL_HOST_STD_LIB_##__VA_ARGS__) |
| 39 | + |
37 | 40 | #if defined(_MSVC_STL_VERSION) |
38 | 41 | # undef _CCCL_HOST_STD_LIB_STL |
39 | | -# define _CCCL_HOST_STD_LIB_STL() 1 |
| 42 | +# define _CCCL_HOST_STD_LIB_STL() (_MSVC_STL_VERSION, 0) |
40 | 43 | #elif defined(__GLIBCXX__) |
41 | 44 | # undef _CCCL_HOST_STD_LIB_LIBSTDCXX |
42 | | -# define _CCCL_HOST_STD_LIB_LIBSTDCXX() 1 |
| 45 | +# define _CCCL_HOST_STD_LIB_LIBSTDCXX() (_GLIBCXX_RELEASE, 0) |
43 | 46 | #elif defined(_LIBCPP_VERSION) |
44 | 47 | # undef _CCCL_HOST_STD_LIB_LIBCXX |
45 | | -# define _CCCL_HOST_STD_LIB_LIBCXX() 1 |
| 48 | +// since llvm-16, the version scheme has been changed from MMppp to MMmmpp |
| 49 | +# if _LIBCPP_VERSION / 10000 < 2 |
| 50 | +# define _CCCL_HOST_STD_LIB_LIBCXX() (_LIBCPP_VERSION / 1000, 0) |
| 51 | +# else |
| 52 | +# define _CCCL_HOST_STD_LIB_LIBCXX() (_LIBCPP_VERSION / 10000, (_LIBCPP_VERSION / 100) % 100) |
| 53 | +# endif |
46 | 54 | #endif // ^^^ _LIBCPP_VERSION ^^^ |
47 | 55 |
|
48 | | -#define _CCCL_HOST_STD_LIB(_X) _CCCL_HOST_STD_LIB_##_X() |
49 | 56 | #define _CCCL_HAS_HOST_STD_LIB() \ |
50 | | - (_CCCL_HOST_STD_LIB_LIBSTDCXX() || _CCCL_HOST_STD_LIB_LIBCXX() || _CCCL_HOST_STD_LIB_STL()) |
| 57 | + (_CCCL_HOST_STD_LIB(LIBSTDCXX) || _CCCL_HOST_STD_LIB(LIBCXX) || _CCCL_HOST_STD_LIB(STL)) |
51 | 58 |
|
52 | 59 | #endif // __CCCL_HOST_STD_LIB_H |
0 commit comments