[gcc r16-1466] libstdc++: Improve naming, whitespace and silence warnings for extents.

Tomasz Kaminski tkaminsk@gcc.gnu.org
Thu Jun 12 09:45:23 GMT 2025


https://gcc.gnu.org/g:86104c51bbf7883eb491fa073abd5836232d749c

commit r16-1466-g86104c51bbf7883eb491fa073abd5836232d749c
Author: Luc Grosheintz <luc.grosheintz@gmail.com>
Date:   Wed Jun 4 16:58:46 2025 +0200

    libstdc++: Improve naming, whitespace and silence warnings for extents.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/mdspan(__mdspan::_ExtentsStorage): Change name
            of private member _M_dynamic_extens to _M_dyn_exts.
            (extents): Change name of private member from _M_dynamic_extents
            to _M_exts.
            Fix two instances of whitespace errors.
            * testsuite/23_containers/mdspan/extents/ctor_default.cc: Fix
            integer comparison with cmp_equal.
    
    Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
    Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>

Diff:
---
 libstdc++-v3/include/std/mdspan                    | 24 +++++++++++-----------
 .../23_containers/mdspan/extents/ctor_default.cc   |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index bcf2fa60feab..0f49b0e09a03 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -69,12 +69,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	//
 	// If __r is the index of a dynamic extent, then
 	// _S_dynamic_index[__r] is the index of that extent in
-	// _M_dynamic_extents.
+	// _M_dyn_exts.
 	static constexpr auto _S_dynamic_index = [] consteval
 	{
 	  array<size_t, _S_rank+1> __ret;
 	  size_t __dyn = 0;
-	  for(size_t __i = 0; __i < _S_rank; ++__i)
+	  for (size_t __i = 0; __i < _S_rank; ++__i)
 	    {
 	      __ret[__i] = __dyn;
 	      __dyn += _S_is_dyn(_Extents[__i]);
@@ -105,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	{
 	  auto __se = _Extents[__r];
 	  if (__se == dynamic_extent)
-	    return _M_dynamic_extents[_S_dynamic_index[__r]];
+	    return _M_dyn_exts[_S_dynamic_index[__r]];
 	  else
 	    return __se;
 	}
@@ -114,12 +114,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  constexpr void
 	  _M_init_dynamic_extents(_GetOtherExtent __get_extent) noexcept
 	  {
-	    for(size_t __i = 0; __i < _S_rank_dynamic; ++__i)
+	    for (size_t __i = 0; __i < _S_rank_dynamic; ++__i)
 	      {
 		size_t __di = __i;
 		if constexpr (_OtherRank != _S_rank_dynamic)
 		  __di = _S_dynamic_index_inv[__i];
-		_M_dynamic_extents[__i] = _S_int_cast(__get_extent(__di));
+		_M_dyn_exts[__i] = _S_int_cast(__get_extent(__di));
 	      }
 	  }
 
@@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       private:
 	using _S_storage = __array_traits<_IndexType, _S_rank_dynamic>::_Type;
-	[[no_unique_address]] _S_storage _M_dynamic_extents{};
+	[[no_unique_address]] _S_storage _M_dyn_exts{};
       };
 
     template<typename _OIndexType, typename _SIndexType>
@@ -197,7 +197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	if constexpr (rank() == 0)
 	  __builtin_trap();
 	else
-	  return _M_dynamic_extents._M_extent(__r);
+	  return _M_exts._M_extent(__r);
       }
 
       constexpr
@@ -233,14 +233,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	requires (_S_is_compatible_extents<_OExtents...>())
 	constexpr explicit(_S_ctor_explicit<_OIndexType, _OExtents...>())
 	extents(const extents<_OIndexType, _OExtents...>& __other) noexcept
-	: _M_dynamic_extents(__other._M_dynamic_extents)
+	: _M_exts(__other._M_exts)
 	{ }
 
       template<__mdspan::__valid_index_type<index_type>... _OIndexTypes>
 	requires (sizeof...(_OIndexTypes) == rank()
 		  || sizeof...(_OIndexTypes) == rank_dynamic())
 	constexpr explicit extents(_OIndexTypes... __exts) noexcept
-	: _M_dynamic_extents(span<const _IndexType, sizeof...(_OIndexTypes)>(
+	: _M_exts(span<const _IndexType, sizeof...(_OIndexTypes)>(
 	    initializer_list{_S_storage::_S_int_cast(__exts)...}))
 	{ }
 
@@ -248,7 +248,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	requires (_Nm == rank() || _Nm == rank_dynamic())
 	constexpr explicit(_Nm != rank_dynamic())
 	extents(span<_OIndexType, _Nm> __exts) noexcept
-	: _M_dynamic_extents(span<const _OIndexType, _Nm>(__exts))
+	: _M_exts(span<const _OIndexType, _Nm>(__exts))
 	{ }
 
 
@@ -256,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	requires (_Nm == rank() || _Nm == rank_dynamic())
 	constexpr explicit(_Nm != rank_dynamic())
 	extents(const array<_OIndexType, _Nm>& __exts) noexcept
-	: _M_dynamic_extents(span<const _OIndexType, _Nm>(__exts))
+	: _M_exts(span<const _OIndexType, _Nm>(__exts))
 	{ }
 
       template<typename _OIndexType, size_t... _OExtents>
@@ -278,7 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     private:
       using _S_storage = __mdspan::_ExtentsStorage<
 	_IndexType, array<size_t, sizeof...(_Extents)>{_Extents...}>;
-      [[no_unique_address]] _S_storage _M_dynamic_extents;
+      [[no_unique_address]] _S_storage _M_exts;
 
       template<typename _OIndexType, size_t... _OExtents>
 	friend class extents;
diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc b/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc
index eec300f68962..f45d3e5a5ca4 100644
--- a/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc
+++ b/libstdc++-v3/testsuite/23_containers/mdspan/extents/ctor_default.cc
@@ -15,7 +15,7 @@ template<typename Extents>
       if(exts.static_extent(i) == std::dynamic_extent)
 	VERIFY(exts.extent(i) == 0);
       else
-	VERIFY(exts.extent(i) == Extents::static_extent(i));
+	VERIFY(std::cmp_equal(exts.extent(i), Extents::static_extent(i)));
   }
 
 constexpr bool


More information about the Libstdc++-cvs mailing list