summaryrefslogtreecommitdiff
path: root/user/openjdk7/gcc-add-classic_table-support.patch
blob: e749293023ae5534f98a319fbd6e864b1709fe99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
--- 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)