update libcxx to latest LLVM release/17.x

upstream commit 0176e8729ea4a2cff1ec6689c7620a9f37ce9904
This commit is contained in:
Andrew Kelley 2023-09-13 11:34:46 -07:00
parent 2145cc0dd1
commit c442fbf82a
6 changed files with 33 additions and 14 deletions

View file

@ -208,19 +208,16 @@
// HARDENING { // HARDENING {
// TODO(hardening): remove this in LLVM 18. # ifndef _LIBCPP_ENABLE_ASSERTIONS
// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes) # define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
// equivalent to setting the hardened mode. # endif
# ifdef _LIBCPP_ENABLE_ASSERTIONS # if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead." # error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
# endif
# if _LIBCPP_ENABLE_ASSERTIONS
# define _LIBCPP_ENABLE_HARDENED_MODE 1
# endif
# endif # endif
// NOTE: These modes are experimental and are not stable yet in LLVM 17. Please refrain from using them and use the
// documented libc++ "safe" mode instead.
//
// Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes // Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes
// security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with // security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with
// `_LIBCPP_ENABLE_DEBUG_MODE`. // `_LIBCPP_ENABLE_DEBUG_MODE`.
@ -275,6 +272,11 @@
# error "Only one of _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled." # error "Only one of _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled."
# endif # endif
# if _LIBCPP_ENABLE_ASSERTIONS && (_LIBCPP_ENABLE_HARDENED_MODE || _LIBCPP_ENABLE_DEBUG_MODE)
# error \
"_LIBCPP_ENABLE_ASSERTIONS is mutually exclusive with _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE."
# endif
// Hardened mode checks. // Hardened mode checks.
// clang-format off // clang-format off
@ -303,6 +305,18 @@
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message) # define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) # define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
// Safe mode checks.
# elif _LIBCPP_ENABLE_ASSERTIONS
// All checks enabled.
# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
// Disable all checks if hardening is not enabled. // Disable all checks if hardening is not enabled.
# else # else

View file

@ -245,6 +245,9 @@ __handle_replacement_field(_Iterator __begin, _Iterator __end,
using _CharT = iter_value_t<_Iterator>; using _CharT = iter_value_t<_Iterator>;
__format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx); __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
if (__r.__last == __end)
std::__throw_format_error("The argument index should end with a ':' or a '}'");
bool __parse = *__r.__last == _CharT(':'); bool __parse = *__r.__last == _CharT(':');
switch (*__r.__last) { switch (*__r.__last) {
case _CharT(':'): case _CharT(':'):

View file

@ -10,6 +10,7 @@
#define _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H #define _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H
#include <__config> #include <__config>
#include <__locale> // for locale_t
#include <clocale> #include <clocale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

View file

@ -22,7 +22,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_nothrow_constructible) // GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611
#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC)
template < class _Tp, class... _Args> template < class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible

View file

@ -31,7 +31,7 @@
# include <sys/time.h> // for gettimeofday and timeval # include <sys/time.h> // for gettimeofday and timeval
#endif #endif
#if defined(__APPLE__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) #if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
# define _LIBCPP_HAS_CLOCK_GETTIME # define _LIBCPP_HAS_CLOCK_GETTIME
#endif #endif

View file

@ -29,7 +29,7 @@
# include <sys/time.h> // for gettimeofday and timeval # include <sys/time.h> // for gettimeofday and timeval
#endif #endif
#if defined(__APPLE__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) #if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
# define _LIBCPP_HAS_CLOCK_GETTIME # define _LIBCPP_HAS_CLOCK_GETTIME
#endif #endif