[v2,1/4] libstdc++: Setup internal FTM for mdspan.

Message ID 20250415084038.322962-2-luc.grosheintz@gmail.com
State New
Headers
Series Implement extents from the mdspan header. |

Commit Message

Luc Grosheintz April 15, 2025, 8:40 a.m. UTC
  Uses the FTM infrastructure to create an internal feature testing macro
for partial availability of mdspan; which is then used to hide the
contents of the header mdspan when compiling against a standard prior to
C++23.

libstdc++-v3/ChangeLog:

	* include/bits/version.def: Add internal feature testing macro
	__glibcxx_mdspan.
	* include/bits/version.h: Regenerate.

Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
---
 libstdc++-v3/include/bits/version.def | 9 +++++++++
 libstdc++-v3/include/bits/version.h   | 9 +++++++++
 2 files changed, 18 insertions(+)
  

Comments

Tomasz Kaminski April 15, 2025, 9:19 a.m. UTC | #1
On Tue, Apr 15, 2025 at 10:48 AM Luc Grosheintz <luc.grosheintz@gmail.com>
wrote:

> Uses the FTM infrastructure to create an internal feature testing macro
> for partial availability of mdspan; which is then used to hide the
> contents of the header mdspan when compiling against a standard prior to
> C++23.
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/version.def: Add internal feature testing macro
>         __glibcxx_mdspan.
>         * include/bits/version.h: Regenerate.
>
> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
>
LGTM. For clarification, I am not maintainer, and you need a separate
approval from merging to trunk.


> ---
>  libstdc++-v3/include/bits/version.def | 9 +++++++++
>  libstdc++-v3/include/bits/version.h   | 9 +++++++++
>  2 files changed, 18 insertions(+)
>
> diff --git a/libstdc++-v3/include/bits/version.def
> b/libstdc++-v3/include/bits/version.def
> index 0afaf0dec24..b2aaabff6d2 100644
> --- a/libstdc++-v3/include/bits/version.def
> +++ b/libstdc++-v3/include/bits/version.def
> @@ -998,6 +998,15 @@ ftms = {
>    };
>  };
>
> +ftms = {
> +  name = mdspan;
> +  no_stdname = true; // FIXME: remove
> +  values = {
> +    v = 1; // FIXME: 202207
> +    cxxmin = 23;
> +  };
> +};
> +
>  ftms = {
>    name = ssize;
>    values = {
> diff --git a/libstdc++-v3/include/bits/version.h
> b/libstdc++-v3/include/bits/version.h
> index 980fee641e9..9ee1e0e980d 100644
> --- a/libstdc++-v3/include/bits/version.h
> +++ b/libstdc++-v3/include/bits/version.h
> @@ -1115,6 +1115,15 @@
>  #endif /* !defined(__cpp_lib_span) && defined(__glibcxx_want_span) */
>  #undef __glibcxx_want_span
>
> +#if !defined(__cpp_lib_mdspan)
> +# if (__cplusplus >= 202100L)
> +#  define __glibcxx_mdspan 1L
> +#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_mdspan)
> +#  endif
> +# endif
> +#endif /* !defined(__cpp_lib_mdspan) && defined(__glibcxx_want_mdspan) */
> +#undef __glibcxx_want_mdspan
> +
>  #if !defined(__cpp_lib_ssize)
>  # if (__cplusplus >= 202002L)
>  #  define __glibcxx_ssize 201902L
> --
> 2.48.1
>
>
  

Patch

diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 0afaf0dec24..b2aaabff6d2 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -998,6 +998,15 @@  ftms = {
   };
 };
 
+ftms = {
+  name = mdspan;
+  no_stdname = true; // FIXME: remove
+  values = {
+    v = 1; // FIXME: 202207
+    cxxmin = 23;
+  };
+};
+
 ftms = {
   name = ssize;
   values = {
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index 980fee641e9..9ee1e0e980d 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1115,6 +1115,15 @@ 
 #endif /* !defined(__cpp_lib_span) && defined(__glibcxx_want_span) */
 #undef __glibcxx_want_span
 
+#if !defined(__cpp_lib_mdspan)
+# if (__cplusplus >= 202100L)
+#  define __glibcxx_mdspan 1L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_mdspan)
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_mdspan) && defined(__glibcxx_want_mdspan) */
+#undef __glibcxx_want_mdspan
+
 #if !defined(__cpp_lib_ssize)
 # if (__cplusplus >= 202002L)
 #  define __glibcxx_ssize 201902L