22__config.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. diff --git a/include/__config b/include/__config
  2. index e431997..3b1c3a6 100644
  3. --- a/include/__config
  4. +++ b/include/__config
  5. @@ -28,13 +28,35 @@
  6. # define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
  7. #endif
  8. +// Move outside #ifdef __cplusplus because this needs to work in both C and C++ headers.
  9. +#if defined(__apple_build_version__)
  10. +# define _LIBCPP_COMPILER_CLANG_BASED
  11. +# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
  12. +#elif defined(__clang__)
  13. +# define _LIBCPP_COMPILER_CLANG
  14. +# define _LIBCPP_COMPILER_CLANG_BASED
  15. +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
  16. +#elif defined(__GNUC__)
  17. +# define _LIBCPP_COMPILER_GCC
  18. +#elif defined(_MSC_VER)
  19. +# define _LIBCPP_COMPILER_MSVC
  20. +
  21. +# if _MSVC_LANG == 201705L
  22. +# define _LIBCPP_STD_VER 20
  23. +# elif _MSVC_LANG == 201703L
  24. +# define _LIBCPP_STD_VER 17
  25. +# else
  26. +# define _LIBCPP_STD_VER 14
  27. +# endif
  28. +#endif
  29. +
  30. #ifdef __cplusplus
  31. // Warn if a compiler version is used that is not supported anymore
  32. // LLVM RELEASE Update the minimum compiler versions
  33. # if defined(_LIBCPP_CLANG_VER)
  34. # if _LIBCPP_CLANG_VER < 1500
  35. -# warning "Libc++ only supports Clang 15 and later"
  36. +// we temporary allow old clang-s # warning "Libc++ only supports Clang 15 and later"
  37. # endif
  38. # elif defined(_LIBCPP_APPLE_CLANG_VER)
  39. # if _LIBCPP_APPLE_CLANG_VER < 1500
  40. @@ -87,7 +109,7 @@
  41. # define _LIBCPP_OBJECT_FORMAT_ELF 1
  42. # elif defined(__MACH__)
  43. # define _LIBCPP_OBJECT_FORMAT_MACHO 1
  44. -# elif defined(_WIN32)
  45. +# elif defined(_WIN32) || defined(__CYGWIN__)
  46. # define _LIBCPP_OBJECT_FORMAT_COFF 1
  47. # elif defined(__wasm__)
  48. # define _LIBCPP_OBJECT_FORMAT_WASM 1
  49. @@ -772,7 +794,7 @@ typedef __char32_t char32_t;
  50. // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
  51. // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
  52. // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
  53. -# ifndef _LIBCPP_NO_ABI_TAG
  54. +# if !defined(_LIBCPP_NO_ABI_TAG) && !defined(__CUDACC__)
  55. # define _LIBCPP_HIDE_FROM_ABI \
  56. _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
  57. __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
  58. @@ -1075,7 +1097,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  59. defined(__APPLE__) || \
  60. defined(__MVS__) || \
  61. defined(_AIX) || \
  62. - defined(__EMSCRIPTEN__)
  63. + defined(__EMSCRIPTEN__) || \
  64. + defined(__CYGWIN__)
  65. // clang-format on
  66. # define _LIBCPP_HAS_THREAD_API_PTHREAD
  67. # elif defined(__Fuchsia__)
  68. @@ -1211,6 +1234,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  69. # define _LIBCPP_CONSTINIT
  70. # endif
  71. +# if !__has_builtin(__builtin_is_constant_evaluated) || (defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER < 900) || __CUDACC_VER_MAJOR__ == 10
  72. +# define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
  73. +# endif
  74. +
  75. # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
  76. # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))
  77. # else
  78. @@ -1232,6 +1259,12 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  79. # define _LIBCPP_LIFETIMEBOUND
  80. # endif
  81. +# if defined(_LIBCPP_COMPILER_CLANG_BASED)
  82. +# define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]]
  83. +# else
  84. +# define _LIBCPP_REINITIALIZES_OBJECT
  85. +# endif
  86. +
  87. # if __has_attribute(__nodebug__)
  88. # define _LIBCPP_NODEBUG __attribute__((__nodebug__))
  89. # else
  90. @@ -1289,6 +1322,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  91. # define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
  92. # endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
  93. +// Yandex-specific: We build our own libc++, so it has everything available
  94. +# define _LIBCPP_DISABLE_AVAILABILITY
  95. +// End of Yandex-specific
  96. +
  97. // clang-format off
  98. # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh()\")") _Pragma("push_macro(\"move(int, int)\")") _Pragma("push_macro(\"erase()\")")
  99. # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh()\")") _Pragma("pop_macro(\"move(int, int)\")") _Pragma("pop_macro(\"erase()\")")