On Wed, Apr 9, 2025 at 9:30 AM Luc Grosheintz <luc.groshei...@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.groshei...@gmail.com>
> ---
>  libstdc++-v3/include/bits/version.def |  9 +++++++++
>  libstdc++-v3/include/bits/version.h   | 10 ++++++++++
>  2 files changed, 19 insertions(+)
>
> diff --git a/libstdc++-v3/include/bits/version.def
> b/libstdc++-v3/include/bits/version.def
> index 8f609b469cc..89f066010ae 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 f05c3fd13c0..b97053a891e 100644
> --- a/libstdc++-v3/include/bits/version.h
> +++ b/libstdc++-v3/include/bits/version.h
> @@ -1115,6 +1115,16 @@
>  #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)
> +#   define __cpp_lib_mdspan 1L
>
With the `no_stdname` option this line should not be present. Support for
no_stdname was merged recently,
so could you try to regenerate the file. I have recently merged
__glibcxx_format_ranges that have similar behavior.

In that case, you should use __glibcxx_mdspan as the guard for macros.

> +#  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.49.0
>
>

Reply via email to