aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-05-02 22:23:38 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-05-02 22:23:38 +0100
commit315f8b5f18dcfcd81401c9629deaf77443fa7c1e (patch)
treec67f2a13583af00c07f97f877c822185815fe380
parentb752e2c926065820a0086c7a482edf199d79dfc2 (diff)
downloadgcc-315f8b5f18dcfcd81401c9629deaf77443fa7c1e.zip
gcc-315f8b5f18dcfcd81401c9629deaf77443fa7c1e.tar.gz
gcc-315f8b5f18dcfcd81401c9629deaf77443fa7c1e.tar.bz2
PR libstdc++/90314 fix non-equivalent declarations of std::swap
In order to use the _GLIBCXX_NOEXCEPT_IF macro for an expression containing commas I enclosed it in parentheses, so the preprocessor wouldn't treat it as two arguments to the function-like macro. Clang gives an error because now the noexcept-specifier noexcept((C)) is not equivalent to the noexcept(C) one on the declaration of swap in <type_traits>. Instead of requiring extra parentheses around the expression, redefine _GLIBCXX_NOEXCEPT_IF as a variadic macro (even though supporting that in C++98 is a GNU extension). PR libstdc++/90314 * include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Use variadic macro. * include/bits/move.h (swap): Remove extra parentheses. From-SVN: r270827
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/include/bits/c++config4
-rw-r--r--libstdc++-v3/include/bits/move.h4
3 files changed, 8 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cd1508e..6c93604 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2019-05-02 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/90314
+ * include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Use variadic macro.
+ * include/bits/move.h (swap): Remove extra parentheses.
+
* include/experimental/bits/lfts_config.h: Improve doc markup.
* include/experimental/optional: Improve docs.
(_Has_addressof_mem, _Has_addressof_free, _Has_addressof)
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 5016f48..ca1557a 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -157,12 +157,12 @@
#ifndef _GLIBCXX_NOEXCEPT
# if __cplusplus >= 201103L
# define _GLIBCXX_NOEXCEPT noexcept
-# define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND)
+# define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__)
# define _GLIBCXX_USE_NOEXCEPT noexcept
# define _GLIBCXX_THROW(_EXC)
# else
# define _GLIBCXX_NOEXCEPT
-# define _GLIBCXX_NOEXCEPT_IF(_COND)
+# define _GLIBCXX_NOEXCEPT_IF(...)
# define _GLIBCXX_USE_NOEXCEPT throw()
# define _GLIBCXX_THROW(_EXC) throw(_EXC)
# endif
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 996078c..7271e27 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -183,8 +183,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
#endif
swap(_Tp& __a, _Tp& __b)
- _GLIBCXX_NOEXCEPT_IF((__and_<is_nothrow_move_constructible<_Tp>,
- is_nothrow_move_assignable<_Tp>>::value))
+ _GLIBCXX_NOEXCEPT_IF(__and_<is_nothrow_move_constructible<_Tp>,
+ is_nothrow_move_assignable<_Tp>>::value)
{
// concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>)