]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR libstdc++/79789 fix non-reserved names in headers
authorJonathan Wakely <jwakely@redhat.com>
Thu, 2 Mar 2017 18:59:06 +0000 (18:59 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 2 Mar 2017 18:59:06 +0000 (18:59 +0000)
PR libstdc++/79789
* include/bits/ios_base.h (make_error_code, make_error_condition):
Likewise.
* include/bits/mask_array.h (mask_array): Likewise.
* include/bits/regex.h (regex_token_iterator): Likewise.
* include/bits/slice_array.h (slice_array): Likewise.
* include/std/memory (undeclare_no_pointers): Likewise.
* testsuite/17_intro/names.cc: New test.

From-SVN: r245847

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/ios_base.h
libstdc++-v3/include/bits/mask_array.h
libstdc++-v3/include/bits/regex.h
libstdc++-v3/include/bits/slice_array.h
libstdc++-v3/testsuite/17_intro/names.cc [new file with mode: 0644]

index 7325a2f7e5442d03ea488c3a5d52e6ddb9f61592..87c626e8be45c5449d174e124fc9e2c8908bac79 100644 (file)
@@ -1,3 +1,14 @@
+2017-03-02  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/79789
+       * include/bits/ios_base.h (make_error_code, make_error_condition):
+       Likewise.
+       * include/bits/mask_array.h (mask_array): Likewise.
+       * include/bits/regex.h (regex_token_iterator): Likewise.
+       * include/bits/slice_array.h (slice_array): Likewise.
+       * include/std/memory (undeclare_no_pointers): Likewise.
+       * testsuite/17_intro/names.cc: New test.
+
 2017-02-14  Jonathan Wakely  <jwakely@redhat.com>
 
        Backport from mainline
index 908ba7c7e4ee547ddc2338f1eb4f474d9334eece..7e91c0bbbb0ea840406897d28d65d7287c9797e3 100644 (file)
@@ -207,12 +207,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   const error_category& iostream_category() noexcept;
 
   inline error_code
-  make_error_code(io_errc e) noexcept
-  { return error_code(static_cast<int>(e), iostream_category()); }
+  make_error_code(io_errc __e) noexcept
+  { return error_code(static_cast<int>(__e), iostream_category()); }
 
   inline error_condition
-  make_error_condition(io_errc e) noexcept
-  { return error_condition(static_cast<int>(e), iostream_category()); }
+  make_error_condition(io_errc __e) noexcept
+  { return error_condition(static_cast<int>(__e), iostream_category()); }
 #endif
 
   // 27.4.2  Class ios_base
index 5078f1736cf03e177e1a5678050e6a4bbab62771..850ad8d4b2ef88352c5c42f19cf041e4c7a9f595 100644 (file)
@@ -136,8 +136,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
   template<typename _Tp>
-    inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a)
-    : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
+    inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& __a)
+    : _M_sz(__a._M_sz), _M_mask(__a._M_mask), _M_array(__a._M_array) {}
 
   template<typename _Tp>
     inline
index 9b26c8f465df78d7d2f3fc0a38691802fd25c41d..90723e6e25518eb755588e2a93d82ef50f0c8277 100644 (file)
@@ -2672,9 +2672,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
                           initializer_list<int>,
                           regex_constants::match_flag_type =
                           regex_constants::match_default) = delete;
-      template <std::size_t N>
+      template <std::size_t _Nm>
        regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&,
-                            const int (&)[N],
+                            const int (&)[_Nm],
                             regex_constants::match_flag_type =
                             regex_constants::match_default) = delete;
 
index ee1c546a7c354ba733c2fadc2e129ef9f3ccf83f..199998a3f54d184aa27d7c160de016239f0f0b1f 100644 (file)
@@ -204,8 +204,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp>
     inline
-    slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
-    : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
+    slice_array<_Tp>::slice_array(const slice_array<_Tp>& __a)
+    : _M_sz(__a._M_sz), _M_stride(__a._M_stride), _M_array(__a._M_array) {}
 
   //    template<typename _Tp>
   //    inline slice_array<_Tp>::~slice_array () {}
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
new file mode 100644 (file)
index 0000000..a7d9a6b
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+// Define macros for some common variables names that we must not use for
+// naming variables, parameters etc. in the library.
+#define tmp (
+#define A (
+#define B (
+#define C (
+#define D (
+#define E (
+#define F (
+#define G (
+#define H (
+#define I (
+#define J (
+#define K (
+#define L (
+#define M (
+#define N (
+#define O (
+#define P (
+#define Q (
+#define R (
+#define S (
+#define T (
+#define U (
+#define V (
+#define W (
+#define X (
+#define Y (
+#define Z (
+#if __cplusplus >= 201103L
+// <random> defines member functions called a() and b()
+#else
+#define a (
+#define b (
+#endif
+// <queue> and <stack> defined data members called c
+#define d (
+#define e (
+#define f (
+#define g (
+#if __cplusplus >= 201402L
+// <chrono> defines operator ""h in C++14
+// <complex> defines operator ""i in C++14
+#else
+#define h (
+#define i (
+#endif
+#define j (
+#if __cplusplus >= 201103L
+// <random> defines member functions called k()
+#else
+#define k (
+#endif
+#define l (
+#if __cplusplus >= 201103L
+// <random> defines member functions called m() and n()
+#else
+#define m (
+#define n (
+#endif
+#define o (
+#if __cplusplus >= 201103L
+// <random> defines member functions called p()
+#else
+#define p (
+#endif
+#define q (
+#define r (
+#if __cplusplus >= 201103L
+// <random> defines member functions called s() and t()
+// <chrono> and <string> define operator ""s in C++14
+#else
+#define s (
+#define t (
+#endif
+#define u (
+#define v (
+#define w (
+#define x (
+#define y (
+#define z (
+#include <bits/stdc++.h>