public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585]
@ 2024-06-22 20:24 Shengdun Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Shengdun Wang @ 2024-06-22 20:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: Shengdun Wang

From: Shengdun Wang <uwgghhbcad@gmail.com>

__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..8842bf85cee 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*,
+                         [[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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585]
  2024-06-22 21:11 Shengdun Wang
@ 2024-06-25 12:57 ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-06-25 12:57 UTC (permalink / raw)
  To: Shengdun Wang; +Cc: gcc-patches

Please read https://gcc.gnu.org/contribute.html#patches and ensure
you've included everything, for example ...

On 22/06/24 17:11 -0400, Shengdun Wang wrote:
>__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:

This is missing a description of the change.

The PR number should be in the summary line, and the ChangeLog entry.

Patches for libstdc++ should be CC'd to the libstdc++ list:
https://gcc.gnu.org/lists.html

No DCO sign-off:
https://gcc.gnu.org/contribute.html#legal



>---
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585]
@ 2024-06-22 21:11 Shengdun Wang
  2024-06-25 12:57 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Shengdun Wang @ 2024-06-22 21:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: Shengdun Wang

__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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585]
@ 2024-06-22 20:18 Shengdun Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Shengdun Wang @ 2024-06-22 20:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: Shengdun Wang

From: Shengdun Wang <uwgghhbcad@gmail.com>

__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..9ea57ff7e1b 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*,
+                         [[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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-25 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-22 20:24 [PATCH] libstdc++: Fix --disable-libstdcxx-verbose abi break [PR115585] Shengdun Wang
  -- strict thread matches above, loose matches on Subject: below --
2024-06-22 21:11 Shengdun Wang
2024-06-25 12:57 ` Jonathan Wakely
2024-06-22 20:18 Shengdun Wang

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).