public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][committed][libstdc++] Fix ctype changed after newlib update.
@ 2021-11-19  8:46 Tamar Christina
  0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2021-11-19  8:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, paolo.carlini, drepper, bkoz, jwakely

[-- Attachment #1: Type: text/plain, Size: 2472 bytes --]

Hi All,

Newlib changed ctype.h recently[1] by moving the short labels from ctype.h intro
the private namespace in ctype_.h.  This broke embedded builds due to them no
longer being found.  Instead they now expose the long names to match glibc.

This patch now uses the short or long names depending on is the short ones are
defined or not.

[1] https://github.com/bminor/newlib/commit/3ba1bd0d9dbc015c14a0aaafcef042f706d1249a

Regtested on aarch64-none-elf and no issues.

Patch was pre-approve by Jonathan.

Thanks,
Tamar

libstdc++-v3/ChangeLog:

	PR libstdc++/103305
	* config/os/newlib/ctype_base.h (upper, lower, alpha, digit, xdigit,
	space, print, graph, cntrl, punct, alnum, blank): Use short or long
	names depending on if short ones are defined.

--- inline copy of patch -- 
diff --git a/libstdc++-v3/config/os/newlib/ctype_base.h b/libstdc++-v3/config/os/newlib/ctype_base.h
index 33654d7794a0cff3ba4ebe78e28882d78866dd94..3a7477afdcc76e5a5bc6b0a86d2264c5bc8ab7f8 100644
--- a/libstdc++-v3/config/os/newlib/ctype_base.h
+++ b/libstdc++-v3/config/os/newlib/ctype_base.h
@@ -41,6 +41,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     // NB: Offsets into ctype<char>::_M_table force a particular size
     // on the mask type. Because of this, we don't use an enum.
     typedef char 		mask;
+#if defined _U && defined _L && defined _N && defined _S
     static const mask upper    	= _U;
     static const mask lower 	= _L;
     static const mask alpha 	= _U | _L;
@@ -52,8 +53,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     static const mask cntrl 	= _C;
     static const mask punct 	= _P;
     static const mask alnum 	= _U | _L | _N;
-#if __cplusplus >= 201103L
+# if __cplusplus >= 201103L
     static const mask blank 	= space;
+# endif
+#else
+    static const mask upper    = _ISupper;
+    static const mask lower    = _ISlower;
+    static const mask alpha    = _ISupper | _ISlower;
+    static const mask digit    = _ISdigit;
+    static const mask xdigit   = _ISxdigit | _ISdigit;
+    static const mask space    = _ISspace;
+    static const mask print    = _ISpunct | _ISupper | _ISlower | _ISdigit | _ISblank;
+    static const mask graph    = _ISpunct | _ISupper | _ISlower | _ISdigit;
+    static const mask cntrl    = _IScntrl;
+    static const mask punct    = _ISpunct;
+    static const mask alnum    = _ISupper | _ISlower | _ISdigit;
+# if __cplusplus >= 201103L
+    static const mask blank    =  _ISspace | _ISblank;
+# endif
 #endif
   };
 


-- 

[-- Attachment #2: rb15099.patch --]
[-- Type: text/x-diff, Size: 1681 bytes --]

diff --git a/libstdc++-v3/config/os/newlib/ctype_base.h b/libstdc++-v3/config/os/newlib/ctype_base.h
index 33654d7794a0cff3ba4ebe78e28882d78866dd94..3a7477afdcc76e5a5bc6b0a86d2264c5bc8ab7f8 100644
--- a/libstdc++-v3/config/os/newlib/ctype_base.h
+++ b/libstdc++-v3/config/os/newlib/ctype_base.h
@@ -41,6 +41,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     // NB: Offsets into ctype<char>::_M_table force a particular size
     // on the mask type. Because of this, we don't use an enum.
     typedef char 		mask;
+#if defined _U && defined _L && defined _N && defined _S
     static const mask upper    	= _U;
     static const mask lower 	= _L;
     static const mask alpha 	= _U | _L;
@@ -52,8 +53,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     static const mask cntrl 	= _C;
     static const mask punct 	= _P;
     static const mask alnum 	= _U | _L | _N;
-#if __cplusplus >= 201103L
+# if __cplusplus >= 201103L
     static const mask blank 	= space;
+# endif
+#else
+    static const mask upper    = _ISupper;
+    static const mask lower    = _ISlower;
+    static const mask alpha    = _ISupper | _ISlower;
+    static const mask digit    = _ISdigit;
+    static const mask xdigit   = _ISxdigit | _ISdigit;
+    static const mask space    = _ISspace;
+    static const mask print    = _ISpunct | _ISupper | _ISlower | _ISdigit | _ISblank;
+    static const mask graph    = _ISpunct | _ISupper | _ISlower | _ISdigit;
+    static const mask cntrl    = _IScntrl;
+    static const mask punct    = _ISpunct;
+    static const mask alnum    = _ISupper | _ISlower | _ISdigit;
+# if __cplusplus >= 201103L
+    static const mask blank    =  _ISspace | _ISblank;
+# endif
 #endif
   };
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-19  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  8:46 [PATCH][committed][libstdc++] Fix ctype changed after newlib update Tamar Christina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).