[gcc r17-3313] libstdc++: Fix OpenBSD ctype_base masks

Pietro Monteiro via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:15419a00a2934258bed26ab75bc2f80a245ca7c3

commit r17-3313-g15419a00a2934258bed26ab75bc2f80a245ca7c3
Author: Pietro Monteiro <[email protected]>
Date:   Sat Aug 15 14:28:10 2026 -0400

    libstdc++: Fix OpenBSD ctype_base masks
    
    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: Use _CTYPE prefixed
            macros if available.
    
    Signed-off-by: Pietro Monteiro <[email protected]>

Diff:
---
 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 c86c77e60fc0..e1d982f81cd1 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
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.