]> 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>
Thu, 6 Mar 2025 13:40:58 +0000 (14:40 +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>
libstdc++-v3/include/bits/c++config

index 6a73507d0748fdcb2fb950d6b45bb54435a78d4b..676f5eecbbb6a715800a99aa4976fd8e51826dde 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