aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-10-08 00:05:53 +0100
committerJonathan Wakely <jwakely@redhat.com>2020-10-08 00:05:53 +0100
commit23f75da95f5e8e09e9fcbd5b0d2885e6c44739aa (patch)
tree1059fc0a4af215ee6d77e2e22a839ba4d7d1702b /libstdc++-v3
parent635072248a426c933c74ef4431e82401249b6218 (diff)
downloadgcc-23f75da95f5e8e09e9fcbd5b0d2885e6c44739aa.zip
gcc-23f75da95f5e8e09e9fcbd5b0d2885e6c44739aa.tar.gz
gcc-23f75da95f5e8e09e9fcbd5b0d2885e6c44739aa.tar.bz2
libstdc++: Fix non-reserved names in headers
My recent changes to std::exception_ptr moved some members to be inline in the header but didn't replace the variable names with reserved names. The "tmp" variable must be fixed. The "other" parameter is actually a reserved name because of std::allocator<T>::rebind<U>::other but should be fixed anyway. There are also some bad uses of "ForwardIterator" in <ranges>. There's also a "il" parameter in a std::seed_seq constructor in <random> which is only reserved since C++14. libstdc++-v3/ChangeLog: * include/bits/random.h (seed_seq(initializer_list<T>)): Rename parameter to use reserved name. * include/bits/ranges_algo.h (shift_left, shift_right): Rename template parameters to use reserved name. * libsupc++/exception_ptr.h (exception_ptr): Likewise for parameters and local variables. * testsuite/17_intro/names.cc: Check "il". Do not check "d" and "y" in C++20 mode.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/bits/random.h2
-rw-r--r--libstdc++-v3/include/bits/ranges_algo.h19
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h17
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc13
4 files changed, 31 insertions, 20 deletions
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index 19307fb..4a6558c 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -6063,7 +6063,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ }
template<typename _IntType>
- seed_seq(std::initializer_list<_IntType> il);
+ seed_seq(std::initializer_list<_IntType> __il);
template<typename _InputIterator>
seed_seq(_InputIterator __begin, _InputIterator __end);
diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h
index 61673e3..f1a4cc2 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -3696,10 +3696,10 @@ namespace ranges
} // namespace ranges
#define __cpp_lib_shift 201806L
- template<class ForwardIterator>
- constexpr ForwardIterator
- shift_left(ForwardIterator __first, ForwardIterator __last,
- typename iterator_traits<ForwardIterator>::difference_type __n)
+ template<typename _ForwardIterator>
+ constexpr _ForwardIterator
+ shift_left(_ForwardIterator __first, _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n)
{
__glibcxx_assert(__n >= 0);
if (__n == 0)
@@ -3711,16 +3711,17 @@ namespace ranges
return std::move(std::move(__mid), std::move(__last), std::move(__first));
}
- template<class ForwardIterator>
- constexpr ForwardIterator
- shift_right(ForwardIterator __first, ForwardIterator __last,
- typename iterator_traits<ForwardIterator>::difference_type __n)
+ template<typename _ForwardIterator>
+ constexpr _ForwardIterator
+ shift_right(_ForwardIterator __first, _ForwardIterator __last,
+ typename iterator_traits<_ForwardIterator>::difference_type __n)
{
__glibcxx_assert(__n >= 0);
if (__n == 0)
return __first;
- using _Cat = typename iterator_traits<ForwardIterator>::iterator_category;
+ using _Cat
+ = typename iterator_traits<_ForwardIterator>::iterator_category;
if constexpr (derived_from<_Cat, bidirectional_iterator_tag>)
{
auto __mid = ranges::next(__last, -__n, __first);
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index a053122..4497d0e 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -180,8 +180,9 @@ namespace std
#ifndef _GLIBCXX_EH_PTR_COMPAT
inline
#endif
- exception_ptr::exception_ptr(const exception_ptr& other) _GLIBCXX_NOEXCEPT
- : _M_exception_object(other._M_exception_object)
+ exception_ptr::exception_ptr(const exception_ptr& __other)
+ _GLIBCXX_NOEXCEPT
+ : _M_exception_object(__other._M_exception_object)
{
if (_M_exception_object)
_M_addref();
@@ -200,9 +201,9 @@ namespace std
inline
#endif
exception_ptr&
- exception_ptr::operator=(const exception_ptr& other) _GLIBCXX_USE_NOEXCEPT
+ exception_ptr::operator=(const exception_ptr& __other) _GLIBCXX_USE_NOEXCEPT
{
- exception_ptr(other).swap(*this);
+ exception_ptr(__other).swap(*this);
return *this;
}
@@ -210,11 +211,11 @@ namespace std
inline
#endif
void
- exception_ptr::swap(exception_ptr &other) _GLIBCXX_USE_NOEXCEPT
+ exception_ptr::swap(exception_ptr &__other) _GLIBCXX_USE_NOEXCEPT
{
- void *tmp = _M_exception_object;
- _M_exception_object = other._M_exception_object;
- other._M_exception_object = tmp;
+ void *__tmp = _M_exception_object;
+ _M_exception_object = __other._M_exception_object;
+ __other._M_exception_object = __tmp;
}
#ifdef _GLIBCXX_EH_PTR_COMPAT
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 2b6c3eb..5a61c97 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -52,9 +52,10 @@
#define b (
#endif
// <queue> and <stack> defined data members called c
-#define d (
#if __cplusplus <= 201703L
-// <numbers> defines std::numbers::e
+// <chrono> defines operator""d in C++20
+#define d (
+// <numbers> defines std::numbers::e in C++20
#define e (
#endif
#define f (
@@ -98,7 +99,10 @@
#define v (
#define w (
#define x (
+#if __cplusplus <= 201703L
+// <chrono> defines operator""y in C++20
#define y (
+#endif
#define z (
#define tmp (
@@ -107,6 +111,11 @@
#define uses_allocator (
#endif
+#if __cplusplus < 201402L
+// <complex> defines operator""il
+#define il (
+#endif
+
#if __cplusplus < 201703L
// <charconv> defines to_chars_result::ptr and to_chars_result::ec
#define ec (