From 6e8ce5d651b88cf9e91780105ca36dea83871d38 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 12 Oct 2022 12:07:14 +0100 Subject: libstdc++: Use markdown in Doxygen comment This makes the comment easier to read in the source, without altering the Doxygen output. libstdc++-v3/ChangeLog: * include/std/iostream: Use markdown in Doxygen comment. --- libstdc++-v3/include/std/iostream | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/include/std/iostream b/libstdc++-v3/include/std/iostream index 02e9c30..70318a4 100644 --- a/libstdc++-v3/include/std/iostream +++ b/libstdc++-v3/include/std/iostream @@ -48,13 +48,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name Standard Stream Objects * - * The <iostream> header declares the eight standard stream - * objects. For other declarations, see + * The `` header declares the eight *standard stream objects*. + * For other declarations, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html * and the @link iosfwd I/O forward declarations @endlink * * They are required by default to cooperate with the global C - * library's @c FILE streams, and to be available during program + * library's `FILE` streams, and to be available during program * startup and termination. For more information, see the section of the * manual linked to above. */ -- cgit v1.1 From cf0b7e9787c3686c47219a725f2cbcaa19faaaca Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 12 Oct 2022 11:59:33 +0100 Subject: libstdc++: Simplify print_raw function for debug assertions Replace two uses of print_raw where it's clearer to just use fprintf directly. Then the only remaining use of print_raw is as the print_func argument of pretty_print. When called by pretty_print the count is either a positive integer or -1, so we can simplify print_raw itself. Remove the default argument, because it's never used. Remove the check for nbc == 0, which never happens (but would be harmless if it did). Replace the conditional expression with a single call to fprintf, using INT_MAX as the maximum length. libstdc++-v3/ChangeLog: * src/c++11/debug.cc (print_raw): Simplify. (print_word): Print indentation by calling fprintf directly. (_Error_formatter::_M_error): Print unindented string by calling fprintf directly. --- libstdc++-v3/src/c++11/debug.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc index abc4124..f2b25fb 100644 --- a/libstdc++-v3/src/c++11/debug.cc +++ b/libstdc++-v3/src/c++11/debug.cc @@ -37,6 +37,7 @@ #include // for std::abort #include // for std::isspace. #include // for std::strstr. +#include // for INT_MAX #include // for std::min. @@ -609,14 +610,11 @@ namespace { print_word(ctx, word, Length - 1); } void - print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc = -1) + print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc) { - if (nbc != 0) - { - ctx._M_column += (nbc > 0) - ? fprintf(stderr, "%.*s", (int)nbc, str) - : fprintf(stderr, "%s", str); - } + if (nbc == -1) + nbc = INT_MAX; + ctx._M_column += fprintf(stderr, "%.*s", (int)nbc, str); } void @@ -645,12 +643,9 @@ namespace || (ctx._M_column + visual_length < ctx._M_max_length) || (visual_length >= ctx._M_max_length && ctx._M_column == 1)) { - // If this isn't the first line, indent + // If this isn't the first line, indent. if (ctx._M_column == 1 && !ctx._M_first_line) - { - const char spacing[PrintContext::_S_indent + 1] = " "; - print_raw(ctx, spacing, PrintContext::_S_indent); - } + ctx._M_column += fprintf(stderr, "%*c", PrintContext::_S_indent, ' '); int written = fprintf(stderr, "%.*s", (int)length, word); @@ -1166,7 +1161,7 @@ namespace __gnu_debug PrintContext ctx; if (_M_file) { - print_raw(ctx, _M_file); + ctx._M_column += fprintf(stderr, "%s", _M_file); print_literal(ctx, ":"); go_to_next_line = true; } -- cgit v1.1 From 0dd9dd1fdfca1219bbe3ac460b50c6776b427119 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 12 Oct 2022 23:04:53 +0100 Subject: libstdc++: Disable all emergency EH pool code if obj-count == 0 For a zero-sized static pool we can completely elide all code for the EH pool. We no longer need to adjust the static buffer size to ensure at least one free_entry can be created in it, because we no longer use a static buffer at all if obj_count == 0. If the buffer exists, obj_count >= 1 and the buffer will be much larger than sizeof(free_entry). libstdc++-v3/ChangeLog: * libsupc++/eh_alloc.cc [USE_POOL]: New macro. [!USE_POOL] (__gnu_cxx::__freeres, pool): Do not define. [_GLIBCXX_EH_POOL_STATIC] (pool::arena): Do not use std::max. (__cxxabiv1::__cxa_allocate_exception) [!USE_POOL]: Do not use pool. (__cxxabiv1::__cxa_free_exception) [!USE_POOL]: Likewise. (__cxxabiv1::__cxa_allocate_dependent_exception) [!USE_POOL]: Likewise. (__cxxabiv1::__cxa_free_dependent_exception) [!USE_POOL]: Likewise. --- libstdc++-v3/libsupc++/eh_alloc.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc index 81b8a15..e93f14c 100644 --- a/libstdc++-v3/libsupc++/eh_alloc.cc +++ b/libstdc++-v3/libsupc++/eh_alloc.cc @@ -101,12 +101,21 @@ using namespace __cxxabiv1; #ifdef _GLIBCXX_EH_POOL_NOBJS # if _GLIBCXX_EH_POOL_NOBJS > MAX_OBJ_COUNT # warning "_GLIBCXX_EH_POOL_NOBJS value is too large; ignoring it" +# elif _GLIBCXX_EH_POOL_NOBJS < 0 +# warning "_GLIBCXX_EH_POOL_NOBJS value is negative; ignoring it" # else # undef EMERGENCY_OBJ_COUNT # define EMERGENCY_OBJ_COUNT _GLIBCXX_EH_POOL_NOBJS # endif #endif +#if defined _GLIBCXX_EH_POOL_STATIC && EMERGENCY_OBJ_COUNT == 0 +# define USE_POOL 0 +#else +# define USE_POOL 1 +#endif + +#if USE_POOL namespace __gnu_cxx { void __freeres() noexcept; @@ -161,7 +170,7 @@ namespace #ifdef _GLIBCXX_EH_POOL_STATIC static constexpr std::size_t arena_size = buffer_size_in_bytes(EMERGENCY_OBJ_COUNT, EMERGENCY_OBJ_SIZE); - alignas(void*) char arena[std::max(arena_size, sizeof(free_entry))]; + alignas(void*) char arena[arena_size]; #else char *arena = nullptr; std::size_t arena_size = 0; @@ -374,6 +383,7 @@ namespace __gnu_cxx #endif } } +#endif // USE_POOL extern "C" void * __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) noexcept @@ -382,8 +392,10 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) noexcept void *ret = malloc (thrown_size); +#if USE_POOL if (!ret) ret = emergency_pool.allocate (thrown_size); +#endif if (!ret) std::terminate (); @@ -398,9 +410,11 @@ extern "C" void __cxxabiv1::__cxa_free_exception(void *vptr) noexcept { char *ptr = (char *) vptr - sizeof (__cxa_refcounted_exception); +#if USE_POOL if (emergency_pool.in_pool (ptr)) [[__unlikely__]] emergency_pool.free (ptr); else +#endif free (ptr); } @@ -410,8 +424,10 @@ __cxxabiv1::__cxa_allocate_dependent_exception() noexcept { void *ret = malloc (sizeof (__cxa_dependent_exception)); +#if USE_POOL if (!ret) ret = emergency_pool.allocate (sizeof (__cxa_dependent_exception)); +#endif if (!ret) std::terminate (); @@ -426,8 +442,10 @@ extern "C" void __cxxabiv1::__cxa_free_dependent_exception (__cxa_dependent_exception *vptr) noexcept { +#if USE_POOL if (emergency_pool.in_pool (vptr)) [[__unlikely__]] emergency_pool.free (vptr); else +#endif free (vptr); } -- cgit v1.1 From baeec7cc83b19b46d1c73523f06efa7ea2b30390 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 15 Oct 2022 00:17:38 +0000 Subject: Daily bump. --- libstdc++-v3/ChangeLog | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a78e198..8166bc9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,27 @@ +2022-10-14 Jonathan Wakely + + * libsupc++/eh_alloc.cc [USE_POOL]: New macro. + [!USE_POOL] (__gnu_cxx::__freeres, pool): Do not define. + [_GLIBCXX_EH_POOL_STATIC] (pool::arena): Do not use std::max. + (__cxxabiv1::__cxa_allocate_exception) [!USE_POOL]: Do not use + pool. + (__cxxabiv1::__cxa_free_exception) [!USE_POOL]: Likewise. + (__cxxabiv1::__cxa_allocate_dependent_exception) [!USE_POOL]: + Likewise. + (__cxxabiv1::__cxa_free_dependent_exception) [!USE_POOL]: + Likewise. + +2022-10-14 Jonathan Wakely + + * src/c++11/debug.cc (print_raw): Simplify. + (print_word): Print indentation by calling fprintf directly. + (_Error_formatter::_M_error): Print unindented string by calling + fprintf directly. + +2022-10-14 Jonathan Wakely + + * include/std/iostream: Use markdown in Doxygen comment. + 2022-10-12 François Dumont * include/debug/string: Add using _Base::compare. -- cgit v1.1