22__config.patch 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. diff --git a/include/__config b/include/__config
  2. index d32ad24..1bb99ee 100644
  3. --- a/include/__config
  4. +++ b/include/__config
  5. @@ -39,13 +39,25 @@
  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. +#endif
  19. +
  20. #ifdef __cplusplus
  21. // Warn if a compiler version is used that is not supported anymore
  22. // LLVM RELEASE Update the minimum compiler versions
  23. # if defined(_LIBCPP_CLANG_VER)
  24. # if _LIBCPP_CLANG_VER < 1600
  25. -# warning "Libc++ only supports Clang 16 and later"
  26. +// we temporary allow old clang-s # warning "Libc++ only supports Clang 16 and later"
  27. # endif
  28. # elif defined(_LIBCPP_APPLE_CLANG_VER)
  29. # if _LIBCPP_APPLE_CLANG_VER < 1500
  30. @@ -94,7 +106,7 @@
  31. # define _LIBCPP_OBJECT_FORMAT_ELF 1
  32. # elif defined(__MACH__)
  33. # define _LIBCPP_OBJECT_FORMAT_MACHO 1
  34. -# elif defined(_WIN32)
  35. +# elif defined(_WIN32) || defined(__CYGWIN__)
  36. # define _LIBCPP_OBJECT_FORMAT_COFF 1
  37. # elif defined(__wasm__)
  38. # define _LIBCPP_OBJECT_FORMAT_WASM 1
  39. @@ -819,7 +831,7 @@ typedef __char32_t char32_t;
  40. // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
  41. // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
  42. // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
  43. -# ifndef _LIBCPP_NO_ABI_TAG
  44. +# if !defined(_LIBCPP_NO_ABI_TAG) && !defined(__CUDACC__)
  45. # define _LIBCPP_HIDE_FROM_ABI \
  46. _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
  47. __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
  48. @@ -1101,7 +1113,8 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  49. defined(__APPLE__) || \
  50. defined(__MVS__) || \
  51. defined(_AIX) || \
  52. - defined(__EMSCRIPTEN__)
  53. + defined(__EMSCRIPTEN__) || \
  54. + defined(__CYGWIN__)
  55. // clang-format on
  56. # define _LIBCPP_HAS_THREAD_API_PTHREAD
  57. # elif defined(__Fuchsia__)
  58. @@ -1267,6 +1280,10 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  59. # define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
  60. # endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
  61. +// Yandex-specific: We build our own libc++, so it has everything available
  62. +# define _LIBCPP_DISABLE_AVAILABILITY
  63. +// End of Yandex-specific
  64. +
  65. // clang-format off
  66. # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh\")") _Pragma("push_macro(\"move\")") _Pragma("push_macro(\"erase\")")
  67. # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh\")") _Pragma("pop_macro(\"move\")") _Pragma("pop_macro(\"erase\")")
  68. @@ -1452,6 +1469,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  69. # define _LIBCPP_NO_DESTROY
  70. # endif
  71. +# if !__has_builtin(__builtin_is_constant_evaluated) || (defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER < 900) || \
  72. + __CUDACC_VER_MAJOR__ == 10
  73. +# define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
  74. +# endif
  75. +
  76. # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
  77. # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))
  78. # else
  79. @@ -1473,6 +1495,12 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
  80. # define _LIBCPP_LIFETIMEBOUND
  81. # endif
  82. +# if defined(_LIBCPP_COMPILER_CLANG_BASED)
  83. +# define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]]
  84. +# else
  85. +# define _LIBCPP_REINITIALIZES_OBJECT
  86. +# endif
  87. +
  88. # if __has_attribute(__nodebug__)
  89. # define _LIBCPP_NODEBUG __attribute__((__nodebug__))
  90. # else