public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patches for libstdc++ in #64271 (bootstrap on NetBSD)
@ 2014-12-11 18:22 Kai-Uwe Eckhardt
  2014-12-15 11:12 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Kai-Uwe Eckhardt @ 2014-12-11 18:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++

Here are the three patches as requested for #64271.

--- libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h.orig	2014-12-10 22:19:05.000000000 +0100
+++ libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h	2014-12-10 22:20:46.000000000 +0100
@@ -48,7 +48,7 @@
   is(const char* __low, const char* __high, mask* __vec) const
   {
     while (__low < __high)
-      *__vec++ = _M_table[*__low++];
+      *__vec++ = _M_table[(unsigned char)*__low++];
     return __high;
   }
 


--- libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc.orig	2014-12-10 22:19:26.000000000 +0100
+++ libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc	2014-12-10 22:21:15.000000000 +0100
@@ -38,11 +38,17 @@
 
 // Information as gleaned from /usr/include/ctype.h
 
+#ifndef _CTYPE_BL
   extern "C" const u_int8_t _C_ctype_[];
+#endif
 
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return _C_ctype_ + 1; }
+#ifdef _CTYPE_BL
+  { return _C_ctype_tab_ + 1; }
+#else
+   { return _C_ctype_ + 1; }
+#endif
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
 		     size_t __refs) 
@@ -69,14 +75,14 @@
 
   char
   ctype<char>::do_toupper(char __c) const
-  { return ::toupper((int) __c); }
+  { return ::toupper((int)(unsigned char) __c); }
 
   const char*
   ctype<char>::do_toupper(char* __low, const char* __high) const
   {
     while (__low < __high)
       {
-	*__low = ::toupper((int) *__low);
+	*__low = ::toupper((int)(unsigned char) *__low);
 	++__low;
       }
     return __high;
@@ -84,14 +90,14 @@
 
   char
   ctype<char>::do_tolower(char __c) const
-  { return ::tolower((int) __c); }
+  { return ::tolower((int)(unsigned char) __c); }
 
   const char* 
   ctype<char>::do_tolower(char* __low, const char* __high) const
   {
     while (__low < __high)
       {
-	*__low = ::tolower((int) *__low);
+	*__low = ::tolower((int)(unsigned char) *__low);
 	++__low;
       }
     return __high;


--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig	2014-12-10 22:18:50.000000000 +0100
+++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h	2014-12-10 22:20:31.000000000 +0100
@@ -43,9 +43,22 @@
 
     // 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 unsigned char      	mask;
 
-#ifndef _CTYPE_U
+#if defined(_CTYPE_BL)
+    typedef unsigned short      mask;
+    static const mask upper     = _CTYPE_U;
+    static const mask lower     = _CTYPE_L;
+    static const mask alpha     = _CTYPE_A;
+    static const mask digit     = _CTYPE_D;
+    static const mask xdigit    = _CTYPE_X;
+    static const mask space     = _CTYPE_S;
+    static const mask print     = _CTYPE_R;
+    static const mask graph     = _CTYPE_G;
+    static const mask cntrl     = _CTYPE_C;
+    static const mask punct     = _CTYPE_P;
+    static const mask alnum     = _CTYPE_A | _CTYPE_D;
+#elif !defined(_CTYPE_U)
+    typedef unsigned char      	mask;
     static const mask upper    	= _U;
     static const mask lower 	= _L;
     static const mask alpha 	= _U | _L;
@@ -58,6 +71,7 @@
     static const mask punct 	= _P;
     static const mask alnum 	= _U | _L | _N;
 #else
+    typedef unsigned char      	mask;
     static const mask upper    	= _CTYPE_U;
     static const mask lower 	= _CTYPE_L;
     static const mask alpha 	= _CTYPE_U | _CTYPE_L;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patches for libstdc++ in #64271 (bootstrap on NetBSD)
  2014-12-11 18:22 patches for libstdc++ in #64271 (bootstrap on NetBSD) Kai-Uwe Eckhardt
@ 2014-12-15 11:12 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2014-12-15 11:12 UTC (permalink / raw)
  To: Kai-Uwe Eckhardt; +Cc: gcc-patches, libstdc++

On 11/12/14 19:22 +0100, Kai-Uwe Eckhardt wrote:
>--- libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.orig	2014-12-10 22:18:50.000000000 +0100
>+++ libstdc++-v3/config/os/bsd/netbsd/ctype_base.h	2014-12-10 22:20:31.000000000 +0100
>@@ -43,9 +43,22 @@
>
>     // 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 unsigned char      	mask;
>
>-#ifndef _CTYPE_U
>+#if defined(_CTYPE_BL)

What is _CTYPE_BL? If it corresponds to the "blank" character class
then I would expect the ctype_base::blank mask to be changed by this
patch as well.

>+    typedef unsigned short      mask;

As I said in the Bugzilla comments, changing this type alters the ABI
for NetBSD.  Are C++ binaries compiled with NetBSD 5.0 expected to run
unchanged on NetBSD 7.0? Or is an ABI break acceptable for the target?

The other changes are OK, although they probably don't solve the
problem in isolation without the ctype_base.h changes.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-15 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 18:22 patches for libstdc++ in #64271 (bootstrap on NetBSD) Kai-Uwe Eckhardt
2014-12-15 11:12 ` Jonathan Wakely

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).