]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Avoid '-Wunused-parameter' for '__what' in function 'void std::__throw_for...
authorThomas Schwinge <tschwinge@baylibre.com>
Wed, 19 Feb 2025 19:34:25 +0000 (20:34 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Wed, 19 Mar 2025 08:58:31 +0000 (09:58 +0100)
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 <jwakely@redhat.com>
(cherry picked from commit d87c0d5443ba860dcbc6be24921e0ffb463cc96f)

libstdc++-v3/ChangeLog.omp
libstdc++-v3/include/bits/c++config

index 72a99a460be67745c27e8f3241fd4a5dd10421db..003bb8415da9d529dadd37ee6325d66eff608578 100644 (file)
@@ -1,3 +1,12 @@
+2025-03-19  Thomas Schwinge  <tschwinge@baylibre.com>
+
+       Backported from trunk:
+       2025-03-06  Thomas Schwinge  <tschwinge@baylibre.com>
+                   Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/bits/c++config [!__cpp_exceptions]
+       (_GLIBCXX_THROW_OR_ABORT): Reference '_EXC'.
+
 2025-02-27  Thomas Schwinge  <tschwinge@baylibre.com>
 
        Backported from trunk:
index 773a99077e09e1d0b350d08541b725a8b119dabe..4277b3b64c045a721b106bbb79aca4b7b942e688 100644 (file)
 # 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