summaryrefslogblamecommitdiff
path: root/legacy/gcc6/add-classic_table-support.patch
blob: e749293023ae5534f98a319fbd6e864b1709fe99 (plain) (tree)























































































































































                                                                                                                   
--- gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_base.h.old	2016-01-04 08:30:50.652828000 -0600
+++ gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_base.h	2017-10-16 07:51:26.226276759 -0500
@@ -40,19 +40,27 @@
 
     // 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 int 	mask;
-    static const mask upper    	= 1 << 0;
-    static const mask lower 	= 1 << 1;
-    static const mask alpha 	= 1 << 2;
-    static const mask digit 	= 1 << 3;
-    static const mask xdigit 	= 1 << 4;
-    static const mask space 	= 1 << 5;
-    static const mask print 	= 1 << 6;
-    static const mask graph 	= (1 << 2) | (1 << 3) | (1 << 9); // alnum|punct
-    static const mask cntrl 	= 1 << 8;
-    static const mask punct 	= 1 << 9;
-    static const mask alnum 	= (1 << 2) | (1 << 3);  // alpha|digit
-    static const mask blank	= 1 << 10;
+    typedef unsigned short int 	mask;
+/* horrible ugly code from glibc */
+#ifndef _ISbit
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#  define _ISbit(i) (1 << (i))
+# else
+#  define _ISbit(i) (i < 8 ? (1 << i << 8) : (1 << i >> 8))
+# endif
+#endif
+    static const mask upper    	= _ISbit(0);
+    static const mask lower 	= _ISbit(1);
+    static const mask alpha 	= _ISbit(2);
+    static const mask digit 	= _ISbit(3);
+    static const mask xdigit 	= _ISbit(4);
+    static const mask space 	= _ISbit(5);
+    static const mask print 	= _ISbit(6);
+    static const mask graph 	= _ISbit(7);
+    static const mask cntrl 	= _ISbit(9);
+    static const mask punct 	= _ISbit(10);
+    static const mask alnum 	= _ISbit(11);
+    static const mask blank	= _ISbit(8);
   };
 
 _GLIBCXX_END_NAMESPACE_VERSION
--- gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_configure_char.cc.old	2016-01-04 08:30:50.652828000 -0600
+++ gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_configure_char.cc	2017-10-16 08:37:57.986260218 -0500
@@ -40,7 +40,105 @@
 
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return 0; }
+  {
+    static ctype_base::mask mask[256] = {
+      cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
+      cntrl, cntrl | blank | space, cntrl | space, cntrl | space,
+      cntrl | space, cntrl | space, cntrl, cntrl,
+      cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
+      cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
+      print | space | blank,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct, print | punct,
+      print | punct,
+      print | alnum | digit | xdigit, print | alnum | digit | xdigit,
+      print | alnum | digit | xdigit, print | alnum | digit | xdigit,
+      print | alnum | digit | xdigit, print | alnum | digit | xdigit,
+      print | alnum | digit | xdigit, print | alnum | digit | xdigit,
+      print | alnum | digit | xdigit, print | alnum | digit | xdigit,
+      print | punct, print | punct,
+      print, print, print,
+      print | punct, print,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | xdigit | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | alnum | alpha | upper,
+      print | punct, print | punct, print | punct,
+      print | punct, print | punct, print | punct,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | xdigit | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | alnum | alpha | lower,
+      print | punct, print | punct, print | punct, print | punct,
+      cntrl,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0
+    };
+    return mask;
+  }
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
 		     size_t __refs)