[PATCH] libstdc++: Deprecate std::unexpected and handler functions: Adjust 'libstdc++-v3/libsupc++/eh_call.cc'
Thomas Schwinge
tschwinge@baylibre.com
Mon Nov 9 09:30:27 GMT 2026
In a '--enable-werror' build for '--target=arm-rtems6', in a
'#ifdef __ARM_EABI_UNWINDER__' block of code, I ran into:
../../../../source-gcc/libstdc++-v3/libsupc++/eh_call.cc: In function ‘void __cxa_call_unexpected(void*)’:
../../../../source-gcc/libstdc++-v3/libsupc++/eh_call.cc:112:24: error: ‘void std::unexpected()’ is deprecated [-Werror=deprecated-declarations]
112 | std::unexpected();
| ~~~~~~~~~~~~~~~^~
In file included from ../../../../source-gcc/libstdc++-v3/libsupc++/unwind-cxx.h:34,
from ../../../../source-gcc/libstdc++-v3/libsupc++/eh_call.cc:28:
[...]/source-gcc/libstdc++-v3/libsupc++/exception:126:8: note: declared here
126 | void unexpected() __attribute__ ((__noreturn__,__cold__));
| ^~~~~~~~~~
cc1plus: all warnings being treated as errors
Mute this 'error: ‘void std::unexpected()’ is deprecated' in the same way as
similar code had gotten in commit f4130a3eb545ab1aaf3ecb44f3d06b43e3751e04
"libstdc++: Deprecate std::unexpected and handler functions".
libstdc++-v3/
* libsupc++/eh_call.cc [__ARM_EABI_UNWINDER__]: Disable deprecated
warnings.
---
libstdc++-v3/libsupc++/eh_call.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
index 5bc92f9c633a..a4ddd4ba34c4 100644
--- a/libstdc++-v3/libsupc++/eh_call.cc
+++ b/libstdc++-v3/libsupc++/eh_call.cc
@@ -109,7 +109,12 @@ __cxa_call_unexpected(void* exc_obj_in)
__try
{
if (foreign_exception)
- std::unexpected();
+ {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ std::unexpected();
+#pragma GCC diagnostic pop
+ }
else
__unexpected(unexpectedHandler);
}
--
2.53.0
More information about the Libstdc++
mailing list