Re: [PATCH 2/3] libstdc++: Fix OpenBSD ctype_base masks

Jonathan Wakely <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel
Message-ID <CAH6eHdQvPieYsqOpLRdmbZU5Jd+0EGNKEbYFFw7oW8VpRJAo+Q@mail.gmail.com>
On Sat, 8 Aug 2026, 16:23 Pietro Monteiro, <[email protected]>
wrote:

> Building on recent OpenBSD fails because the mask macros have been
> redefined.  Use the new macros if available.
>
> libstdc++-v3/ChangeLog:
>
>         * config/os/bsd/openbsd/ctype_base.h:
>

OK for trunk and active release branches.



> Signed-off-by: Pietro Monteiro <[email protected]>
> ---
>  libstdc++-v3/config/os/bsd/openbsd/ctype_base.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h
> b/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h
> index c86c77e60fc..e1d982f81cd 100644
> --- a/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h
> +++ b/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h
> @@ -42,6 +42,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      // on the mask type. Because of this, we don't use an enum.
>      typedef char               mask;
>
> +#ifdef _CTYPE_S
> +    // OpenBSD 7.5 uses this style of define.
> +    static const mask upper    = _CTYPE_U;
> +    static const mask lower    = _CTYPE_L;
> +    static const mask alpha    = _CTYPE_U | _CTYPE_L;
> +    static const mask digit    = _CTYPE_N;
> +    static const mask xdigit   = _CTYPE_N | _CTYPE_X;
> +    static const mask space    = _CTYPE_S;
> +    static const mask print    = _CTYPE_P | _CTYPE_U | _CTYPE_L |
> _CTYPE_N | _CTYPE_B;
> +    static const mask graph    = _CTYPE_P | _CTYPE_U | _CTYPE_L |
> _CTYPE_N;
> +    static const mask cntrl    = _CTYPE_C;
> +    static const mask punct    = _CTYPE_P;
> +    static const mask alnum    = _CTYPE_U | _CTYPE_L | _CTYPE_N;
> +#else
> +    // Older versions use this style.
>      static const mask upper    = _U;
>      static const mask lower    = _L;
>      static const mask alpha    = _U | _L;
> @@ -53,6 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      static const mask cntrl    = _C;
>      static const mask punct    = _P;
>      static const mask alnum    = _U | _L | _N;
> +#endif
>  #if __cplusplus >= 201103L
>      static const mask blank    = space;
>  #endif
> --
> 2.54.0
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.