[PATCH] Avoid deprecation warning with -Wsystem-headers
Jonathan Wakely
jwakely@redhat.com
Thu Aug 16 16:56:00 GMT 2018
C++17 says to use std::uncaught_exceptions() here instead of
std::uncaught_exception() but since we only care whether the result is
non-zero (and we aren't planning to remove the deprecated version) we
can just keep using std::uncaught_exception() and suppress the warning.
* include/std/ostream (basic_ostream::sentry::~sentry): Suppress
deprecation warnings for using uncaught_exception().
Tested x86_64-linux, committed to trunk.
-------------- next part --------------
commit a6d329728aaf20d795ea3e406b2523e9d1a02afd
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Aug 16 17:36:44 2018 +0100
Avoid deprecation warning with -Wsystem-headers
C++17 says to use std::uncaught_exceptions() here instead of
std::uncaught_exception() but since we only care whether the result is
non-zero (and we aren't planning to remove the deprecated version) we
can just keep using std::uncaught_exception() and suppress the warning.
* include/std/ostream (basic_ostream::sentry::~sentry): Suppress
deprecation warnings for using uncaught_exception().
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 448a9288188..2099294fd92 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -444,6 +444,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit
sentry(basic_ostream<_CharT, _Traits>& __os);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/**
* @brief Possibly flushes the stream.
*
@@ -461,6 +463,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_os.setstate(ios_base::badbit);
}
}
+#pragma GCC diagnostic pop
/**
* @brief Quick status checking.
More information about the Libstdc++
mailing list