From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1075) id D756F3858D35; Wed, 28 Jun 2023 09:47:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D756F3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687945647; bh=RGLRK9CLughmBUPKBn33R0G7E6a+aAXw+47mh7UVo74=; h=From:To:Subject:Date:From; b=YgXGb+rJkn9JejwtOas3qm6zk6Fm8HXurryNjCoWki4gisDadFHnmxU7uKGsG51IA LeAIoBPJfFILBvCIk4eu2lu3tdrPNhjAE6p0LAtLuXDoPb6E6iigUORwkoKFfgQB+P ZJFW1TSbVs4VoFfDelazU3F4wxbGtH3eAMrP3jmQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jan Hubicka To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-2157] Add cold attribute to throw wrappers and terminate X-Act-Checkin: gcc X-Git-Author: Jan Hubicka X-Git-Refname: refs/heads/master X-Git-Oldrev: 51c8cbc6bba387f953d9be48c4a4c8b657dd54a5 X-Git-Newrev: 45c53768b6fa3d737ae818e31d3c50da62e0ad2b Message-Id: <20230628094727.D756F3858D35@sourceware.org> Date: Wed, 28 Jun 2023 09:47:27 +0000 (GMT) List-Id: https://gcc.gnu.org/g:45c53768b6fa3d737ae818e31d3c50da62e0ad2b commit r14-2157-g45c53768b6fa3d737ae818e31d3c50da62e0ad2b Author: Jan Hubicka Date: Wed Jun 28 11:45:15 2023 +0200 Add cold attribute to throw wrappers and terminate PR middle-end/109849 * include/bits/c++config (std::__terminate): Mark cold. * include/bits/functexcept.h: Mark everything as cold. * libsupc++/exception: Mark terminate and unexpected as cold. Diff: --- libstdc++-v3/include/bits/c++config | 2 +- libstdc++-v3/include/bits/functexcept.h | 34 ++++++++++++++++----------------- libstdc++-v3/libsupc++/exception | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 009a017b048..dd47f274d5f 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -320,7 +320,7 @@ namespace std extern "C++" __attribute__ ((__noreturn__, __always_inline__)) inline void __terminate() _GLIBCXX_USE_NOEXCEPT { - void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__)); + void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__)); terminate(); } #pragma GCC visibility pop diff --git a/libstdc++-v3/include/bits/functexcept.h b/libstdc++-v3/include/bits/functexcept.h index 89972baf2c9..c43ca82b953 100644 --- a/libstdc++-v3/include/bits/functexcept.h +++ b/libstdc++-v3/include/bits/functexcept.h @@ -57,61 +57,61 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Helper for exception objects in void - __throw_bad_cast(void) __attribute__((__noreturn__)); + __throw_bad_cast(void) __attribute__((__noreturn__,__cold__)); void - __throw_bad_typeid(void) __attribute__((__noreturn__)); + __throw_bad_typeid(void) __attribute__((__noreturn__,__cold__)); // Helpers for exception objects in void - __throw_logic_error(const char*) __attribute__((__noreturn__)); + __throw_logic_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_domain_error(const char*) __attribute__((__noreturn__)); + __throw_domain_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_invalid_argument(const char*) __attribute__((__noreturn__)); + __throw_invalid_argument(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_length_error(const char*) __attribute__((__noreturn__)); + __throw_length_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_out_of_range(const char*) __attribute__((__noreturn__)); + __throw_out_of_range(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)) + __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__,__cold__)) __attribute__((__format__(__gnu_printf__, 1, 2))); void - __throw_runtime_error(const char*) __attribute__((__noreturn__)); + __throw_runtime_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_range_error(const char*) __attribute__((__noreturn__)); + __throw_range_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_overflow_error(const char*) __attribute__((__noreturn__)); + __throw_overflow_error(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_underflow_error(const char*) __attribute__((__noreturn__)); + __throw_underflow_error(const char*) __attribute__((__noreturn__,__cold__)); // Helpers for exception objects in void - __throw_ios_failure(const char*) __attribute__((__noreturn__)); + __throw_ios_failure(const char*) __attribute__((__noreturn__,__cold__)); void - __throw_ios_failure(const char*, int) __attribute__((__noreturn__)); + __throw_ios_failure(const char*, int) __attribute__((__noreturn__,__cold__)); // Helpers for exception objects in void - __throw_system_error(int) __attribute__((__noreturn__)); + __throw_system_error(int) __attribute__((__noreturn__,__cold__)); // Helpers for exception objects in void - __throw_future_error(int) __attribute__((__noreturn__)); + __throw_future_error(int) __attribute__((__noreturn__,__cold__)); // Helpers for exception objects in void - __throw_bad_function_call() __attribute__((__noreturn__)); + __throw_bad_function_call() __attribute__((__noreturn__,__cold__)); #else // ! HOSTED diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index a34386e6026..00a6347ebe5 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -75,7 +75,7 @@ namespace std _GLIBCXX_VISIBILITY(default) /** The runtime will call this function if %exception handling must be * abandoned for any reason. It can also be called by the user. */ - void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__)); + void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__)); #if __cplusplus < 201703L || (__cplusplus <= 202002L && _GLIBCXX_USE_DEPRECATED) /// If you write a replacement %unexpected handler, it must be of this type. @@ -104,7 +104,7 @@ namespace std _GLIBCXX_VISIBILITY(default) * @deprecated Removed from the C++ standard in C++17 */ _GLIBCXX11_DEPRECATED - void unexpected() __attribute__ ((__noreturn__)); + void unexpected() __attribute__ ((__noreturn__,__cold__)); #endif /** [18.6.4]/1: 'Returns true after completing evaluation of a