https://gcc.gnu.org/g:d348f8435f799b8bc982a09141e0c799488042cd

commit d348f8435f799b8bc982a09141e0c799488042cd
Author: Thomas Schwinge <tschwi...@baylibre.com>
Date:   Wed Feb 19 20:34:25 2025 +0100

    libstdc++: Avoid '-Wunused-parameter' for '__what' in function 'void 
std::__throw_format_error(const char*)'
    
    In a '-fno-exceptions' configuration:
    
        In file included from 
../../../../../source-gcc/libstdc++-v3/src/c++20/format.cc:29:
        [...]/build-gcc/[...]/libstdc++-v3/include/format: In function ‘void 
std::__throw_format_error(const char*)’:
        [...]/build-gcc/[...]/libstdc++-v3/include/format:200:36: error: unused 
parameter ‘__what’ [-Werror=unused-parameter]
          200 |   __throw_format_error(const char* __what)
              |                        ~~~~~~~~~~~~^~~~~~
    
            libstdc++-v3/
            * include/bits/c++config [!__cpp_exceptions]
            (_GLIBCXX_THROW_OR_ABORT): Reference '_EXC'.
    
    Co-authored-by: Jonathan Wakely <jwak...@redhat.com>
    (cherry picked from commit d87c0d5443ba860dcbc6be24921e0ffb463cc96f)

Diff:
---
 libstdc++-v3/ChangeLog.omp          | 9 +++++++++
 libstdc++-v3/include/bits/c++config | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/ChangeLog.omp b/libstdc++-v3/ChangeLog.omp
index 72a99a460be6..003bb8415da9 100644
--- a/libstdc++-v3/ChangeLog.omp
+++ b/libstdc++-v3/ChangeLog.omp
@@ -1,3 +1,12 @@
+2025-03-19  Thomas Schwinge  <tschwi...@baylibre.com>
+
+       Backported from trunk:
+       2025-03-06  Thomas Schwinge  <tschwi...@baylibre.com>
+                   Jonathan Wakely  <jwak...@redhat.com>
+
+       * include/bits/c++config [!__cpp_exceptions]
+       (_GLIBCXX_THROW_OR_ABORT): Reference '_EXC'.
+
 2025-02-27  Thomas Schwinge  <tschwi...@baylibre.com>
 
        Backported from trunk:
diff --git a/libstdc++-v3/include/bits/c++config 
b/libstdc++-v3/include/bits/c++config
index 773a99077e09..4277b3b64c04 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -233,7 +233,7 @@
 # if __cpp_exceptions
 #  define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
 # else
-#  define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort())
+#  define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort(), (void)(_EXC))
 # endif
 #endif

Reply via email to