[gcc r16-8143] libstdc++: Fix some non-uglified names

Jonathan Wakely redi@gcc.gnu.org
Tue Mar 17 22:07:41 GMT 2026


https://gcc.gnu.org/g:62dec39dbd6724b256ede90be0764b09428827d1

commit r16-8143-g62dec39dbd6724b256ede90be0764b09428827d1
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Mar 17 15:37:24 2026 +0000

    libstdc++: Fix some non-uglified names
    
    Jakub wrote a plugin which identified some non-reserved names being used
    in our headers. The "count" one is actually a reserved name (there's
    std::set::count and std::count and std::bitset::count) but we might as
    well uglify it when used as a function parameter name. I think the "ext"
    ones must have happened when moving function definitions from fs_path.cc
    to fs_path.h and I forgot to change them.
    
    The __cond::wait and __cond::wait_recursive member functions are using
    non-reserved names, so that should be changed too, but this patch
    doesn't fix that. I don't think we use the __gnu_cxx::__cond type in any
    headers, so maybe that should just be moved into libsupc++/guard.cc or a
    new header which is not installed and only used while building the
    library.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/chrono_io.h (__formatter_duration::_S_subseconds):
            Uglify subs variable name.
            * include/bits/fs_path.h (path::stem, path::extension)
            (path::has_stem, path::has_extension): Uglify ext parameter
            name.
            * include/ext/concurrence.h (__cond::wait, __cond::wait_recursive):
            Uglify mutex parameter names.
            * include/pstl/glue_algorithm_defs.h (generate_n): Uglify count
            parameter name.
            * include/std/ranges (zip_transform_view): Uglify Rs template
            parameter name.
            (__cartesian_is_sized_sentinel): Uglify FirstSent template
            parameter name.
            * include/tr1/riemann_zeta.tcc: Uglify max_size variable name.

Diff:
---
 libstdc++-v3/include/bits/chrono_io.h           |  4 ++--
 libstdc++-v3/include/bits/fs_path.h             | 20 ++++++++++----------
 libstdc++-v3/include/ext/concurrence.h          |  8 ++++----
 libstdc++-v3/include/pstl/glue_algorithm_defs.h |  2 +-
 libstdc++-v3/include/std/ranges                 | 10 ++++++----
 libstdc++-v3/include/tr1/riemann_zeta.tcc       |  4 ++--
 6 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index 37a296fed7ec..d152397891f2 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -1882,8 +1882,8 @@ namespace __format
 	   {
 	     using _Attoseconds = _ChronoData<_CharT>::_Attoseconds;
 	     using _CRep = common_type_t<_Rep, typename _Attoseconds::rep>;
-	     chrono::duration<_CRep, _Period> subs(__d.count());
-	     return chrono::duration_cast<_Attoseconds>(subs);
+	     chrono::duration<_CRep, _Period> __subs(__d.count());
+	     return chrono::duration_cast<_Attoseconds>(__subs);
 	   }
        }
 
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 313c64bac43c..f0c8c47f0aed 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -1304,33 +1304,33 @@ namespace __detail
   inline path
   path::stem() const
   {
-    auto ext = _M_find_extension();
-    if (ext.first && ext.second != 0)
-      return path{ext.first->substr(0, ext.second)};
+    auto __ext = _M_find_extension();
+    if (__ext.first && __ext.second != 0)
+      return path{__ext.first->substr(0, __ext.second)};
     return {};
   }
 
   inline path
   path::extension() const
   {
-    auto ext = _M_find_extension();
-    if (ext.first && ext.second != string_type::npos)
-      return path{ext.first->substr(ext.second)};
+    auto __ext = _M_find_extension();
+    if (__ext.first && __ext.second != string_type::npos)
+      return path{__ext.first->substr(__ext.second)};
     return {};
   }
 
   inline bool
   path::has_stem() const noexcept
   {
-    auto ext = _M_find_extension();
-    return ext.first && ext.second != 0;
+    auto __ext = _M_find_extension();
+    return __ext.first && __ext.second != 0;
   }
 
   inline bool
   path::has_extension() const noexcept
   {
-    auto ext = _M_find_extension();
-    return ext.first && ext.second != string_type::npos;
+    auto __ext = _M_find_extension();
+    return __ext.first && __ext.second != string_type::npos;
   }
 
   inline bool
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h
index ed37fd8e2af9..b840bd3a7d73 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -290,22 +290,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
     }
 
-    void wait(__mutex *mutex)
+    void wait(__mutex *__mx)
     {
 #if __GTHREADS
       {
-	  if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0)
+	  if (__gthread_cond_wait(&_M_cond, __mx->gthread_mutex()) != 0)
 	    __throw_concurrence_wait_error();
       }
 #endif
     }
 
-    void wait_recursive(__recursive_mutex *mutex)
+    void wait_recursive(__recursive_mutex *__mx)
     {
 #if __GTHREADS
       {
 	  if (__gthread_cond_wait_recursive(&_M_cond,
-					    mutex->gthread_recursive_mutex())
+					    __mx->gthread_recursive_mutex())
 	      != 0)
 	    __throw_concurrence_wait_error();
       }
diff --git a/libstdc++-v3/include/pstl/glue_algorithm_defs.h b/libstdc++-v3/include/pstl/glue_algorithm_defs.h
index e5260e15a1aa..d43112f8644a 100644
--- a/libstdc++-v3/include/pstl/glue_algorithm_defs.h
+++ b/libstdc++-v3/include/pstl/glue_algorithm_defs.h
@@ -202,7 +202,7 @@ generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator _
 
 template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Generator>
 __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>
-generate_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size count, _Generator __g);
+generate_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __count, _Generator __g);
 
 // [alg.remove]
 
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 2cc17eb0f074..95e0109a10cf 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -5261,8 +5261,9 @@ namespace views::__adaptor
     { return _M_zip.size(); }
   };
 
-  template<class _Fp, class... Rs>
-    zip_transform_view(_Fp, Rs&&...) -> zip_transform_view<_Fp, views::all_t<Rs>...>;
+  template<class _Fp, class... _Rs>
+    zip_transform_view(_Fp, _Rs&&...)
+      -> zip_transform_view<_Fp, views::all_t<_Rs>...>;
 
   template<move_constructible _Fp, input_range... _Vs>
     requires (view<_Vs> && ...) && (sizeof...(_Vs) > 0) && is_object_v<_Fp>
@@ -8511,9 +8512,10 @@ namespace views::__adaptor
     template<typename... _Vs>
       concept __cartesian_product_is_sized = (sized_range<_Vs> && ...);
 
-    template<bool _Const, template<typename> class FirstSent, typename _First, typename... _Vs>
+    template<bool _Const, template<typename> class _FirstSent,
+	     typename _First, typename... _Vs>
       concept __cartesian_is_sized_sentinel
-	= (sized_sentinel_for<FirstSent<__maybe_const_t<_Const, _First>>,
+	= (sized_sentinel_for<_FirstSent<__maybe_const_t<_Const, _First>>,
 			      iterator_t<__maybe_const_t<_Const, _First>>>
 	   && ...
 	   && (sized_range<__maybe_const_t<_Const, _Vs>>
diff --git a/libstdc++-v3/include/tr1/riemann_zeta.tcc b/libstdc++-v3/include/tr1/riemann_zeta.tcc
index 8a0daf6bb159..c26ffdc762fa 100644
--- a/libstdc++-v3/include/tr1/riemann_zeta.tcc
+++ b/libstdc++-v3/include/tr1/riemann_zeta.tcc
@@ -83,9 +83,9 @@ namespace tr1
       if (__s < _Tp(1))
         std::__throw_domain_error(__N("Bad argument in zeta sum."));
 
-      const unsigned int max_iter = 10000;
+      const unsigned int __max_iter = 10000;
       _Tp __zeta = _Tp(0);
-      for (unsigned int __k = 1; __k < max_iter; ++__k)
+      for (unsigned int __k = 1; __k < __max_iter; ++__k)
         {
           _Tp __term = std::pow(static_cast<_Tp>(__k), -__s);
           if (__term < std::numeric_limits<_Tp>::epsilon())


More information about the Libstdc++-cvs mailing list