From: Shengdun Wang <euloanty@live.com>
To: gcc-patches@gcc.gnu.org
Cc: Shengdun Wang <euloanty@live.com>
Subject: [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585]
Date: Sat, 22 Jun 2024 17:11:13 -0400 [thread overview]
Message-ID: <SA1PR11MB71305D480B48400426C253D9B2CA2@SA1PR11MB7130.namprd11.prod.outlook.com> (raw)
__glibcxx_assert_fail is not defined when we disable
the libstdcxx-verbose. This causes ABI break when a
binary is compiled with verbose enabled.
libstdc++-v3/ChangeLog:
* src/c++11/assert_fail.cc:
---
libstdc++-v3/src/c++11/assert_fail.cc | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libstdc++-v3/src/c++11/assert_fail.cc b/libstdc++-v3/src/c++11/assert_fail.cc
index 6d99c7958f3..930cabd5ee6 100644
--- a/libstdc++-v3/src/c++11/assert_fail.cc
+++ b/libstdc++-v3/src/c++11/assert_fail.cc
@@ -22,23 +22,28 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
+#include <bits/c++config.h>
+#ifdef _GLIBCXX_VERBOSE_ASSERT
#include <cstdio> // for std::fprintf, stderr
+#endif
#include <cstdlib> // for std::abort
-#ifdef _GLIBCXX_VERBOSE_ASSERT
namespace std
{
[[__noreturn__]]
void
- __glibcxx_assert_fail(const char* file, int line,
- const char* function, const char* condition) noexcept
+ __glibcxx_assert_fail( [[maybe_unused]] const char* file,
+ [[maybe_unused]] int line,
+ [[maybe_unused]] const char* function,
+ [[maybe_unused]] const char* condition) noexcept
{
+#ifdef _GLIBCXX_VERBOSE_ASSERT
if (file && function && condition)
fprintf(stderr, "%s:%d: %s: Assertion '%s' failed.\n",
file, line, function, condition);
else if (function)
fprintf(stderr, "%s: Undefined behavior detected.\n", function);
+#endif
abort();
}
}
-#endif
--
2.45.2
next reply other threads:[~2024-06-22 21:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 21:11 Shengdun Wang [this message]
2024-06-25 12:57 ` Jonathan Wakely
-- strict thread matches above, loose matches on Subject: below --
2024-06-22 20:24 Shengdun Wang
2024-06-22 20:18 Shengdun Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SA1PR11MB71305D480B48400426C253D9B2CA2@SA1PR11MB7130.namprd11.prod.outlook.com \
--to=euloanty@live.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).