[PATCH 2/3] libstdc++: Fix OpenBSD ctype_base masks
Jonathan Wakely
jwakely.gcc@gmail.com
Sat Aug 8 17:43:13 GMT 2026
On Sat, 8 Aug 2026, 16:23 Pietro Monteiro, <pietro@sociotechnical.xyz>
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 <pietro@sociotechnical.xyz>
> ---
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260808/e47e784b/attachment.htm>
More information about the Libstdc++
mailing list