[gcc r16-3743] libstdc++: Rename _S-prefixed identifiers in <mdspan>.

Tomasz Kaminski tkaminsk@gcc.gnu.org
Wed Sep 10 10:58:46 GMT 2025


https://gcc.gnu.org/g:008ad1c6bad820cacdfd6a6d907330ed2577a696

commit r16-3743-g008ad1c6bad820cacdfd6a6d907330ed2577a696
Author: Luc Grosheintz <luc.grosheintz@gmail.com>
Date:   Wed Sep 10 12:10:29 2025 +0200

    libstdc++: Rename _S-prefixed identifiers in <mdspan>.
    
    In libstdc++ the prefix _S is used for static members only. In <mdspan>
    there's several type aliases that also used the prefix _S. They now use
    a single leading underscore follow by a capital letter instead.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/mdspan (_ExtentsStorage::_Base): New name for
            _S_base.
            (_ExtentsStorage::_Storage): New name for _S_storage.
            (extents::_Storage): New name for _S_storage.
            (layout_stride::mapping::_Strides): New name for
            _S_stries_t.
            * testsuite/23_containers/mdspan/class_mandate_neg.cc: Update
            test to the new error message.
    
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
    Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>

Diff:
---
 libstdc++-v3/include/std/mdspan                    | 34 +++++++++++-----------
 .../23_containers/mdspan/class_mandate_neg.cc      |  2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index 678b2619ebe4..01d3b2cb6b17 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -148,14 +148,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       class _ExtentsStorage : public _StaticExtents<_Extents>
       {
       private:
-	using _S_base = _StaticExtents<_Extents>;
+	using _Base = _StaticExtents<_Extents>;
 
       public:
-	using _S_base::_S_rank;
-	using _S_base::_S_rank_dynamic;
-	using _S_base::_S_dynamic_index;
-	using _S_base::_S_dynamic_index_inv;
-	using _S_base::_S_static_extent;
+	using _Base::_S_rank;
+	using _Base::_S_rank_dynamic;
+	using _Base::_S_dynamic_index;
+	using _Base::_S_dynamic_index_inv;
+	using _Base::_S_static_extent;
 
 	static constexpr bool
 	_S_is_dynamic(size_t __r) noexcept
@@ -242,8 +242,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
 
       private:
-	using _S_storage = __array_traits<_IndexType, _S_rank_dynamic>::_Type;
-	[[no_unique_address]] _S_storage _M_dyn_exts{};
+	using _Storage = __array_traits<_IndexType, _S_rank_dynamic>::_Type;
+	[[no_unique_address]] _Storage _M_dyn_exts{};
       };
 
     template<typename _OIndexType, typename _SIndexType>
@@ -259,7 +259,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     template<typename _Extents>
       constexpr const array<size_t, _Extents::rank()>&
       __static_extents() noexcept
-      { return _Extents::_S_storage::_S_static_extents(); }
+      { return _Extents::_Storage::_S_static_extents(); }
 
     // Pre-compute: \prod_{i = 0}^r _Extents[i], for r = 0,..., n (exclusive)
     template<array _Extents>
@@ -314,10 +314,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using rank_type = size_t;
 
       static constexpr rank_type
-      rank() noexcept { return _S_storage::_S_rank; }
+      rank() noexcept { return _Storage::_S_rank; }
 
       static constexpr rank_type
-      rank_dynamic() noexcept { return _S_storage::_S_rank_dynamic; }
+      rank_dynamic() noexcept { return _Storage::_S_rank_dynamic; }
 
       static constexpr size_t
       static_extent(rank_type __r) noexcept
@@ -326,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	if constexpr (rank() == 0)
 	  __builtin_trap();
 	else
-	  return _S_storage::_S_static_extent(__r);
+	  return _Storage::_S_static_extent(__r);
       }
 
       constexpr index_type
@@ -423,9 +423,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       friend span<const index_type>
       __mdspan::__dynamic_extents<extents>(const extents&, size_t, size_t);
 
-      using _S_storage = __mdspan::_ExtentsStorage<
+      using _Storage = __mdspan::_ExtentsStorage<
 	_IndexType, array<size_t, sizeof...(_Extents)>{_Extents...}>;
-      [[no_unique_address]] _S_storage _M_exts;
+      [[no_unique_address]] _Storage _M_exts;
 
       template<typename _OIndexType, size_t... _OExtents>
 	friend class extents;
@@ -1158,10 +1158,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
 
     private:
-      using _S_strides_t = typename __array_traits<index_type,
-						   extents_type::rank()>::_Type;
+      using _Strides = typename __array_traits<index_type,
+					       extents_type::rank()>::_Type;
       [[no_unique_address]] extents_type _M_extents;
-      [[no_unique_address]] _S_strides_t _M_strides;
+      [[no_unique_address]] _Strides _M_strides;
     };
 
   template<typename _ElementType>
diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/class_mandate_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/class_mandate_neg.cc
index de19b6d85c99..172f149176f7 100644
--- a/libstdc++-v3/testsuite/23_containers/mdspan/class_mandate_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/mdspan/class_mandate_neg.cc
@@ -35,7 +35,7 @@ test_element_type_mismatch()
 static_assert(test_element_type_mismatch());
 
 // { dg-prune-output "Extents must be a specialization of std::extents" }
-// { dg-prune-output "no type named '_S_storage'" }
+// { dg-prune-output "no type named '_Storage'" }
 // { dg-prune-output "non-constant condition" }
 // { dg-prune-output "static assertion failed" }
 // { dg-prune-output "__glibcxx_assert" }


More information about the Libstdc++-cvs mailing list