authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-13 11:34:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-19 09:37:53-07:00
logc442fbf82a67740d91664674650d27ddf3cd11d6
tree8cc3648f8c87d87c2d5cf5ff3e20e3d104cee4a1
parent2145cc0dd1f5ab651c65aeafcb2e258051ed1daa

update libcxx to latest LLVM release/17.x

upstream commit 0176e8729ea4a2cff1ec6689c7620a9f37ce9904

6 files changed, 33 insertions(+), 14 deletions(-)

lib/libcxx/include/__config+25-11
...@@ -208,19 +208,16 @@...@@ -208,19 +208,16 @@
208208
209// HARDENING {209// HARDENING {
210210
211// TODO(hardening): remove this in LLVM 18.211# ifndef _LIBCPP_ENABLE_ASSERTIONS
212// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)212# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
213// equivalent to setting the hardened mode.213# endif
214# ifdef _LIBCPP_ENABLE_ASSERTIONS214# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
215# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead."215# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
216# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1
217# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1"
218# endif
219# if _LIBCPP_ENABLE_ASSERTIONS
220# define _LIBCPP_ENABLE_HARDENED_MODE 1
221# endif
222# endif216# endif
223217
218// NOTE: These modes are experimental and are not stable yet in LLVM 17. Please refrain from using them and use the
219// documented libc++ "safe" mode instead.
220//
224// Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes221// Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes
225// security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with222// security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with
226// `_LIBCPP_ENABLE_DEBUG_MODE`.223// `_LIBCPP_ENABLE_DEBUG_MODE`.
...@@ -275,6 +272,11 @@...@@ -275,6 +272,11 @@
275# error "Only one of _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled."272# error "Only one of _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE can be enabled."
276# endif273# endif
277274
275# if _LIBCPP_ENABLE_ASSERTIONS && (_LIBCPP_ENABLE_HARDENED_MODE || _LIBCPP_ENABLE_DEBUG_MODE)
276# error \
277 "_LIBCPP_ENABLE_ASSERTIONS is mutually exclusive with _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_DEBUG_MODE."
278# endif
279
278// Hardened mode checks.280// Hardened mode checks.
279281
280// clang-format off282// clang-format off
...@@ -303,6 +305,18 @@...@@ -303,6 +305,18 @@
303# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)305# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)
304# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)306# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
305307
308// Safe mode checks.
309
310# elif _LIBCPP_ENABLE_ASSERTIONS
311
312// All checks enabled.
313# define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message) _LIBCPP_ASSERT(expression, message)
314# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message)
315# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message)
316# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message)
317# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)
318# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
319
306// Disable all checks if hardening is not enabled.320// Disable all checks if hardening is not enabled.
307321
308# else322# else
lib/libcxx/include/__format/format_functions.h+3
...@@ -245,6 +245,9 @@ __handle_replacement_field(_Iterator __begin, _Iterator __end,...@@ -245,6 +245,9 @@ __handle_replacement_field(_Iterator __begin, _Iterator __end,
245 using _CharT = iter_value_t<_Iterator>;245 using _CharT = iter_value_t<_Iterator>;
246 __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);246 __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx);
247247
248 if (__r.__last == __end)
249 std::__throw_format_error("The argument index should end with a ':' or a '}'");
250
248 bool __parse = *__r.__last == _CharT(':');251 bool __parse = *__r.__last == _CharT(':');
249 switch (*__r.__last) {252 switch (*__r.__last) {
250 case _CharT(':'):253 case _CharT(':'):
lib/libcxx/include/__locale_dir/locale_base_api/locale_guard.h+1
...@@ -10,6 +10,7 @@...@@ -10,6 +10,7 @@
10#define _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H10#define _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H
1111
12#include <__config>12#include <__config>
13#include <__locale> // for locale_t
13#include <clocale>14#include <clocale>
1415
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/__type_traits/is_nothrow_constructible.h+2-1
...@@ -22,7 +22,8 @@...@@ -22,7 +22,8 @@
2222
23_LIBCPP_BEGIN_NAMESPACE_STD23_LIBCPP_BEGIN_NAMESPACE_STD
2424
25#if __has_builtin(__is_nothrow_constructible)25// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611
26#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC)
2627
27template < class _Tp, class... _Args>28template < class _Tp, class... _Args>
28struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible29struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
lib/libcxx/src/chrono.cpp+1-1
...@@ -31,7 +31,7 @@...@@ -31,7 +31,7 @@
31# include <sys/time.h> // for gettimeofday and timeval31# include <sys/time.h> // for gettimeofday and timeval
32#endif32#endif
3333
34#if defined(__APPLE__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)34#if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
35# define _LIBCPP_HAS_CLOCK_GETTIME35# define _LIBCPP_HAS_CLOCK_GETTIME
36#endif36#endif
3737
lib/libcxx/src/filesystem/filesystem_clock.cpp+1-1
...@@ -29,7 +29,7 @@...@@ -29,7 +29,7 @@
29# include <sys/time.h> // for gettimeofday and timeval29# include <sys/time.h> // for gettimeofday and timeval
30#endif30#endif
3131
32#if defined(__APPLE__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)32#if defined(__APPLE__) || defined (__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
33# define _LIBCPP_HAS_CLOCK_GETTIME33# define _LIBCPP_HAS_CLOCK_GETTIME
34#endif34#endif
3535