From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7F1B63858C5F for ; Thu, 16 Feb 2023 10:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F1B63858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676543435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9aSVigx9nG4y267Rey7duwLe4ExoIl47pLbgryqw5Gs=; b=JORraQU8W3Fqu8k8qLFSELQ7as4Dj0VPa0qkROHJcfHO6ogt3mZjfR2BxdP0hJ37eOapvi +NXKV9RAKrFH1XcS6aLumcq+pRlBVZ3PuuQdKluxZGH6qNPvS6IxQ+h6AwLHa++ob3kpVi vVw/UEUPndoGjSwIaJ20fOZ/JPKAEUk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-GZszk4VHNpGr2R_RCE8yYg-1; Thu, 16 Feb 2023 05:30:32 -0500 X-MC-Unique: GZszk4VHNpGr2R_RCE8yYg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B90F3C10238; Thu, 16 Feb 2023 10:30:32 +0000 (UTC) Received: from localhost (unknown [10.33.37.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7329D51FF; Thu, 16 Feb 2023 10:30:31 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix uses of non-reserved names in headers Date: Thu, 16 Feb 2023 10:30:30 +0000 Message-Id: <20230216103030.94868-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested powerpc64le-linux. Pushed to trunk. These should be backported too. -- >8 -- The non-reserved names 'val' and 'dest' were being used in our headers but haven't been added to the 17_intro/names.cc test. That's because they are used by and respecitvely on glibc-based systems. libstdc++-v3/ChangeLog: * include/bits/fs_ops.h (create_directory): Use reserved name for parameter. * include/bits/ranges_algo.h (__contains_subrange_fn): Likewise. * include/bits/regex_automaton.h (_State_base::_M_print): Likewise. * include/bits/regex_automaton.tcc(_State_base::_M_print): Likewise. * include/bits/regex_scanner.tcc(_Scanner::_M_print): Likewise. * include/experimental/bits/fs_ops.h (create_directory): Likewise. * include/std/mutex (timed_mutex::_M_clocklock): Likewise. (recursive_timed_mutex:_M_clocklock): Likewise. * include/std/tuple (basic_common_reference): Likewise. * libsupc++/cxxabi_init_exception.h (__cxa_init_primary_exception): Likewise. * testsuite/17_intro/names.cc: Add checks. --- libstdc++-v3/include/bits/fs_ops.h | 4 +- libstdc++-v3/include/bits/ranges_algo.h | 6 +- libstdc++-v3/include/bits/regex_automaton.h | 2 +- libstdc++-v3/include/bits/regex_automaton.tcc | 18 +++--- libstdc++-v3/include/bits/regex_scanner.tcc | 60 +++++++++---------- .../include/experimental/bits/fs_ops.h | 4 +- libstdc++-v3/include/std/mutex | 8 +-- libstdc++-v3/include/std/tuple | 8 +-- .../libsupc++/cxxabi_init_exception.h | 5 +- libstdc++-v3/testsuite/17_intro/names.cc | 21 ++++++- 10 files changed, 77 insertions(+), 59 deletions(-) diff --git a/libstdc++-v3/include/bits/fs_ops.h b/libstdc++-v3/include/bits/fs_ops.h index 74b8ad50210..e0b87c9fa00 100644 --- a/libstdc++-v3/include/bits/fs_ops.h +++ b/libstdc++-v3/include/bits/fs_ops.h @@ -90,8 +90,8 @@ namespace filesystem bool create_directory(const path& __p); bool create_directory(const path& __p, error_code& __ec) noexcept; - bool create_directory(const path& __p, const path& attributes); - bool create_directory(const path& __p, const path& attributes, + bool create_directory(const path& __p, const path& __attributes); + bool create_directory(const path& __p, const path& __attributes, error_code& __ec) noexcept; void create_directory_symlink(const path& __to, const path& __new_symlink); diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h index 1685e1d85bb..5d039bd1cd4 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -3490,11 +3490,11 @@ namespace ranges template _Sent1, forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2, typename _Pred = ranges::equal_to, - typename Proj1 = identity, typename Proj2 = identity> - requires indirectly_comparable<_Iter1, _Iter2, _Pred, Proj1, Proj2> + typename _Proj1 = identity, typename _Proj2 = identity> + requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2> constexpr bool operator()(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, - _Pred __pred = {}, Proj1 __proj1 = {}, Proj2 __proj2 = {}) const + _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { return __first2 == __last2 || !ranges::search(__first1, __last1, __first2, __last2, diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h index c2e4b512ed5..ef336d5883b 100644 --- a/libstdc++-v3/include/bits/regex_automaton.h +++ b/libstdc++-v3/include/bits/regex_automaton.h @@ -110,7 +110,7 @@ namespace __detail #ifdef _GLIBCXX_DEBUG std::ostream& - _M_print(std::ostream& ostr) const; + _M_print(std::ostream& __ostr) const; // Prints graphviz dot commands for state. std::ostream& diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc index 546605da31f..f25f7b33263 100644 --- a/libstdc++-v3/include/bits/regex_automaton.tcc +++ b/libstdc++-v3/include/bits/regex_automaton.tcc @@ -36,34 +36,34 @@ namespace __detail { #ifdef _GLIBCXX_DEBUG inline std::ostream& - _State_base::_M_print(std::ostream& ostr) const + _State_base::_M_print(std::ostream& __ostr) const { switch (_M_opcode) { case _S_opcode_alternative: case _S_opcode_repeat: - ostr << "alt next=" << _M_next << " alt=" << _M_alt; + __ostr << "alt next=" << _M_next << " alt=" << _M_alt; break; case _S_opcode_subexpr_begin: - ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; + __ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; break; case _S_opcode_subexpr_end: - ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; + __ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; break; case _S_opcode_backref: - ostr << "backref next=" << _M_next << " index=" << _M_backref_index; + __ostr << "backref next=" << _M_next << " index=" << _M_backref_index; break; case _S_opcode_match: - ostr << "match next=" << _M_next; + __ostr << "match next=" << _M_next; break; case _S_opcode_accept: - ostr << "accept next=" << _M_next; + __ostr << "accept next=" << _M_next; break; default: - ostr << "unknown next=" << _M_next; + __ostr << "unknown next=" << _M_next; break; } - return ostr; + return __ostr; } // Prints graphviz dot commands for state. diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc index d3d95acefdc..137617845de 100644 --- a/libstdc++-v3/include/bits/regex_scanner.tcc +++ b/libstdc++-v3/include/bits/regex_scanner.tcc @@ -484,98 +484,98 @@ namespace __detail template std::ostream& _Scanner<_CharT>:: - _M_print(std::ostream& ostr) + _M_print(std::ostream& __ostr) { switch (_M_token) { case _S_token_anychar: - ostr << "any-character\n"; + __ostr << "any-character\n"; break; case _S_token_backref: - ostr << "backref\n"; + __ostr << "backref\n"; break; case _S_token_bracket_begin: - ostr << "bracket-begin\n"; + __ostr << "bracket-begin\n"; break; case _S_token_bracket_neg_begin: - ostr << "bracket-neg-begin\n"; + __ostr << "bracket-neg-begin\n"; break; case _S_token_bracket_end: - ostr << "bracket-end\n"; + __ostr << "bracket-end\n"; break; case _S_token_char_class_name: - ostr << "char-class-name \"" << _M_value << "\"\n"; + __ostr << "char-class-name \"" << _M_value << "\"\n"; break; case _S_token_closure0: - ostr << "closure0\n"; + __ostr << "closure0\n"; break; case _S_token_closure1: - ostr << "closure1\n"; + __ostr << "closure1\n"; break; case _S_token_collsymbol: - ostr << "collsymbol \"" << _M_value << "\"\n"; + __ostr << "collsymbol \"" << _M_value << "\"\n"; break; case _S_token_comma: - ostr << "comma\n"; + __ostr << "comma\n"; break; case _S_token_dup_count: - ostr << "dup count: " << _M_value << "\n"; + __ostr << "dup count: " << _M_value << "\n"; break; case _S_token_eof: - ostr << "EOF\n"; + __ostr << "EOF\n"; break; case _S_token_equiv_class_name: - ostr << "equiv-class-name \"" << _M_value << "\"\n"; + __ostr << "equiv-class-name \"" << _M_value << "\"\n"; break; case _S_token_interval_begin: - ostr << "interval begin\n"; + __ostr << "interval begin\n"; break; case _S_token_interval_end: - ostr << "interval end\n"; + __ostr << "interval end\n"; break; case _S_token_line_begin: - ostr << "line begin\n"; + __ostr << "line begin\n"; break; case _S_token_line_end: - ostr << "line end\n"; + __ostr << "line end\n"; break; case _S_token_opt: - ostr << "opt\n"; + __ostr << "opt\n"; break; case _S_token_or: - ostr << "or\n"; + __ostr << "or\n"; break; case _S_token_ord_char: - ostr << "ordinary character: \"" << _M_value << "\"\n"; + __ostr << "ordinary character: \"" << _M_value << "\"\n"; break; case _S_token_subexpr_begin: - ostr << "subexpr begin\n"; + __ostr << "subexpr begin\n"; break; case _S_token_subexpr_no_group_begin: - ostr << "no grouping subexpr begin\n"; + __ostr << "no grouping subexpr begin\n"; break; case _S_token_subexpr_lookahead_begin: - ostr << "lookahead subexpr begin\n"; + __ostr << "lookahead subexpr begin\n"; break; case _S_token_subexpr_end: - ostr << "subexpr end\n"; + __ostr << "subexpr end\n"; break; case _S_token_unknown: - ostr << "-- unknown token --\n"; + __ostr << "-- unknown token --\n"; break; case _S_token_oct_num: - ostr << "oct number " << _M_value << "\n"; + __ostr << "oct number " << _M_value << "\n"; break; case _S_token_hex_num: - ostr << "hex number " << _M_value << "\n"; + __ostr << "hex number " << _M_value << "\n"; break; case _S_token_quoted_class: - ostr << "quoted class " << "\\" << _M_value << "\n"; + __ostr << "quoted class " << "\\" << _M_value << "\n"; break; default: _GLIBCXX_DEBUG_ASSERT(false); } - return ostr; + return __ostr; } #endif diff --git a/libstdc++-v3/include/experimental/bits/fs_ops.h b/libstdc++-v3/include/experimental/bits/fs_ops.h index b2334a8aadf..b3303afdb20 100644 --- a/libstdc++-v3/include/experimental/bits/fs_ops.h +++ b/libstdc++-v3/include/experimental/bits/fs_ops.h @@ -98,8 +98,8 @@ inline namespace v1 bool create_directory(const path& __p); bool create_directory(const path& __p, error_code& __ec) noexcept; - bool create_directory(const path& __p, const path& attributes); - bool create_directory(const path& __p, const path& attributes, + bool create_directory(const path& __p, const path& __attributes); + bool create_directory(const path& __p, const path& __attributes, error_code& __ec) noexcept; void create_directory_symlink(const path& __to, const path& __new_symlink); diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 9451c4263c1..79420388abc 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -294,8 +294,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK bool - _M_clocklock(clockid_t clockid, const __gthread_time_t& __ts) - { return !pthread_mutex_clocklock(&_M_mutex, clockid, &__ts); } + _M_clocklock(clockid_t __clockid, const __gthread_time_t& __ts) + { return !pthread_mutex_clocklock(&_M_mutex, __clockid, &__ts); } #endif }; @@ -372,8 +372,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK bool - _M_clocklock(clockid_t clockid, const __gthread_time_t& __ts) - { return !pthread_mutex_clocklock(&_M_mutex, clockid, &__ts); } + _M_clocklock(clockid_t __clockid, const __gthread_time_t& __ts) + { return !pthread_mutex_clocklock(&_M_mutex, __clockid, &__ts); } #endif }; diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index c773b3a348b..0e47abed573 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -2328,10 +2328,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 202002L template class TQual, template class UQual> - requires requires { typename tuple, UQual<_UTypes>>...>; } - struct basic_common_reference, tuple<_UTypes...>, TQual, UQual> - { using type = tuple, UQual<_UTypes>>...>; }; + template class _TQual, template class _UQual> + requires requires { typename tuple, _UQual<_UTypes>>...>; } + struct basic_common_reference, tuple<_UTypes...>, _TQual, _UQual> + { using type = tuple, _UQual<_UTypes>>...>; }; template requires requires { typename tuple...>; } diff --git a/libstdc++-v3/libsupc++/cxxabi_init_exception.h b/libstdc++-v3/libsupc++/cxxabi_init_exception.h index a761d5fd57f..d9b0e1bd421 100644 --- a/libstdc++-v3/libsupc++/cxxabi_init_exception.h +++ b/libstdc++-v3/libsupc++/cxxabi_init_exception.h @@ -67,8 +67,9 @@ namespace __cxxabiv1 // Initialize exception (this is a GNU extension) __cxa_refcounted_exception* - __cxa_init_primary_exception(void *object, std::type_info *tinfo, - void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) _GLIBCXX_NOTHROW; + __cxa_init_primary_exception(void *__object, std::type_info *__tinfo, + void (_GLIBCXX_CDTOR_CALLABI *__dest) (void *)) + _GLIBCXX_NOTHROW; } } // namespace __cxxabiv1 diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc index d3e0db9bab6..afa749128f5 100644 --- a/libstdc++-v3/testsuite/17_intro/names.cc +++ b/libstdc++-v3/testsuite/17_intro/names.cc @@ -30,7 +30,7 @@ #define F ( #define G ( #define H ( -#define I ( +// defines I #define J ( #define K ( #define L ( @@ -108,9 +108,18 @@ #endif #define z ( +#define attributes ( +#define bin_op ( +#define clockid ( #define func ( -#define tmp ( +#define max_val ( +#define min_val ( +#define object ( +#define ostr ( +#define policy ( #define sz ( +#define tinfo ( +#define tmp ( #define token ( #define value_t ( @@ -156,6 +165,7 @@ #define Alloc Alloc is not a reserved name #define BinaryFunction1 BinaryFunction1 is not a reserved name #define BinaryFunction2 BinaryFunction2 is not a reserved name +#define BinaryOperation BinaryOperation is not a reserved name #define Char Char is not a reserved name #define CharT CharT is not a reserved name #define Cmp Cmp is not a reserved name @@ -179,6 +189,7 @@ #define H1 H1 is not a reserved name #define H2 H2 is not a reserved name #define Head Head is not a reserved name +#define IsVector IsVector is not a reserved name #define It It is not a reserved name #define Iter Iter is not a reserved name #define Iterator Iterator is not a reserved name @@ -191,16 +202,22 @@ #define Pointer Pointer is not a reserved name #define Policy Policy is not a reserved name #define Pred Pred is not a reserved name +#define Proj Proj is not a reserved name +#define Proj1 Proj1 is not a reserved name +#define Proj2 Proj2 is not a reserved name #define Ptr Ptr is not a reserved name #define Reference Reference is not a reserved name #define Seq Seq is not a reserved name #define Seq_RAIter Seq_RAIter is not a reserved name #define Series Series is not a reserved name #define Set Set is not a reserved name +#define Size Size is not a reserved name #define String String is not a reserved name #define Tp Tp is not a reserved name +#define TQual TQual is not a reserved name #define Traits Traits is not a reserved name #define Type Type is not a reserved name +#define UQual UQual is not a reserved name #define Value Value is not a reserved name #define ValueT ValueT is not a reserved name #define ValueType ValueType is not a reserved name -- 2.39.1