diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
commit | 2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9 (patch) | |
tree | b118381a0a883a762ddd56c0e91608d937ee8bdf /libstdc++-v3 | |
parent | bd21c04269deded2c7476ceca1100a26f28ea526 (diff) | |
parent | baeec7cc83b19b46d1c73523f06efa7ea2b30390 (diff) | |
download | gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.zip gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.gz gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 24 | ||||
-rw-r--r-- | libstdc++-v3/include/std/iostream | 6 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_alloc.cc | 20 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/debug.cc | 21 |
4 files changed, 54 insertions, 17 deletions
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 <jwakely@redhat.com> + + * 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 <jwakely@redhat.com> + + * 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 <jwakely@redhat.com> + + * include/std/iostream: Use markdown in Doxygen comment. + 2022-10-12 François Dumont <fdumont@gcc.gnu.org> * include/debug/string: Add using _Base::compare. 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 <em>standard stream - * objects</em>. For other declarations, see + * The `<iostream>` 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. */ 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); } 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 <cstdlib> // for std::abort #include <cctype> // for std::isspace. #include <cstring> // for std::strstr. +#include <climits> // for INT_MAX #include <algorithm> // 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; } |