summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch')
-rw-r--r--meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch218
1 files changed, 218 insertions, 0 deletions
diff --git a/meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch b/meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch
new file mode 100644
index 0000000000..2ea1ffda57
--- /dev/null
+++ b/meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch
@@ -0,0 +1,218 @@
1slang: change char type to signed char in macros
2
3C language has 3 distinct char types:
4 char
5 unsigned char
6 signed char
7A char has the same range of values as signed char on X86,
8but same as unsigned char on ARM which made Slang's typecast()
9and array_sort() unable to work for char value on ARM, since
10Slang is assuming "char" as "signed char".
11
12Now we change "char" as "signed char" explicitly in
13util/mkslarith2.sl, and use it to regenerate src/slarith2.inc
14
15Upstream-Status: Submitted
16Signed-off-by: Roy.Li <rongqing.li@windriver.com>
17---
18 src/slarith2.inc | 72 ++++++++++++++++++++++++-------------------------
19 src/util/mkslarith2.sl | 2 -
20 2 files changed, 37 insertions(+), 37 deletions(-)
21
22--- a/src/util/mkslarith2.sl
23+++ b/src/util/mkslarith2.sl
24@@ -1,7 +1,7 @@
25 #!/usr/bin/env slsh
26
27 private variable CTypes =
28- ["char", "unsigned char", "short", "unsigned short", "int", "unsigned int",
29+ ["signed char", "unsigned char", "short", "unsigned short", "int", "unsigned int",
30 "long", "unsigned long", "long long", "unsigned long long",
31 "float", "double", "long double"];
32 private variable Is_Int_Type =
33--- a/src/slarith2.inc
34+++ b/src/slarith2.inc
35@@ -1,43 +1,43 @@
36 /* DO NOT EDIT -- this file was generated by src/util/mkslarith2.sl */
37-/* ------------ char ---------- */
38-DEFUN_1(copy_char_to_char,char,char)
39+/* ------------ signed char ---------- */
40+DEFUN_1(copy_char_to_char,signed char,signed char)
41 #define char_to_char NULL
42 #define copy_char_to_uchar copy_char_to_char
43 #define char_to_uchar NULL
44-DEFUN_1(copy_char_to_short,char,short)
45+DEFUN_1(copy_char_to_short,signed char,short)
46 #define char_to_short NULL
47-DEFUN_1(copy_char_to_ushort,char,unsigned short)
48+DEFUN_1(copy_char_to_ushort,signed char,unsigned short)
49 #define char_to_ushort NULL
50-DEFUN_1(copy_char_to_int,char,int)
51-DEFUN_2(char_to_int,char,int,copy_char_to_int)
52-DEFUN_1(copy_char_to_uint,char,unsigned int)
53-DEFUN_2(char_to_uint,char,unsigned int,copy_char_to_uint)
54-DEFUN_1(copy_char_to_long,char,long)
55-DEFUN_2(char_to_long,char,long,copy_char_to_long)
56-DEFUN_1(copy_char_to_ulong,char,unsigned long)
57-DEFUN_2(char_to_ulong,char,unsigned long,copy_char_to_ulong)
58+DEFUN_1(copy_char_to_int,signed char,int)
59+DEFUN_2(char_to_int,signed char,int,copy_char_to_int)
60+DEFUN_1(copy_char_to_uint,signed char,unsigned int)
61+DEFUN_2(char_to_uint,signed char,unsigned int,copy_char_to_uint)
62+DEFUN_1(copy_char_to_long,signed char,long)
63+DEFUN_2(char_to_long,signed char,long,copy_char_to_long)
64+DEFUN_1(copy_char_to_ulong,signed char,unsigned long)
65+DEFUN_2(char_to_ulong,signed char,unsigned long,copy_char_to_ulong)
66 #if defined(HAVE_LONG_LONG)
67-DEFUN_1(copy_char_to_llong,char,long long)
68-DEFUN_2(char_to_llong,char,long long,copy_char_to_llong)
69+DEFUN_1(copy_char_to_llong,signed char,long long)
70+DEFUN_2(char_to_llong,signed char,long long,copy_char_to_llong)
71 #endif /* defined(HAVE_LONG_LONG) */
72 #if defined(HAVE_LONG_LONG)
73-DEFUN_1(copy_char_to_ullong,char,unsigned long long)
74-DEFUN_2(char_to_ullong,char,unsigned long long,copy_char_to_ullong)
75+DEFUN_1(copy_char_to_ullong,signed char,unsigned long long)
76+DEFUN_2(char_to_ullong,signed char,unsigned long long,copy_char_to_ullong)
77 #endif /* defined(HAVE_LONG_LONG) */
78 #if SLANG_HAS_FLOAT
79-DEFUN_1(copy_char_to_float,char,float)
80-DEFUN_2(char_to_float,char,float,copy_char_to_float)
81+DEFUN_1(copy_char_to_float,signed char,float)
82+DEFUN_2(char_to_float,signed char,float,copy_char_to_float)
83 #endif /* SLANG_HAS_FLOAT */
84 #if SLANG_HAS_FLOAT
85-DEFUN_1(copy_char_to_double,char,double)
86-DEFUN_2(char_to_double,char,double,copy_char_to_double)
87+DEFUN_1(copy_char_to_double,signed char,double)
88+DEFUN_2(char_to_double,signed char,double,copy_char_to_double)
89 #endif /* SLANG_HAS_FLOAT */
90 #if defined(HAVE_LONG_DOUBLE)
91-DEFUN_1(copy_char_to_ldouble,char,long double)
92-DEFUN_2(char_to_ldouble,char,long double,copy_char_to_ldouble)
93+DEFUN_1(copy_char_to_ldouble,signed char,long double)
94+DEFUN_2(char_to_ldouble,signed char,long double,copy_char_to_ldouble)
95 #endif /* defined(HAVE_LONG_DOUBLE) */
96 #if SLANG_HAS_FLOAT
97-TO_DOUBLE_FUN(char_to_one_double,char)
98+TO_DOUBLE_FUN(char_to_one_double,signed char)
99 #endif
100
101 /* ------------ unsigned char ---------- */
102@@ -82,7 +82,7 @@ TO_DOUBLE_FUN(uchar_to_one_double,unsign
103 #endif
104
105 /* ------------ short ---------- */
106-DEFUN_1(copy_short_to_char,short,char)
107+DEFUN_1(copy_short_to_char,short,signed char)
108 #define short_to_char NULL
109 DEFUN_1(copy_short_to_uchar,short,unsigned char)
110 #define short_to_uchar NULL
111@@ -123,7 +123,7 @@ TO_DOUBLE_FUN(short_to_one_double,short)
112 #endif
113
114 /* ------------ unsigned short ---------- */
115-DEFUN_1(copy_ushort_to_char,unsigned short,char)
116+DEFUN_1(copy_ushort_to_char,unsigned short,signed char)
117 #define ushort_to_char NULL
118 DEFUN_1(copy_ushort_to_uchar,unsigned short,unsigned char)
119 #define ushort_to_uchar NULL
120@@ -164,7 +164,7 @@ TO_DOUBLE_FUN(ushort_to_one_double,unsig
121 #endif
122
123 /* ------------ int ---------- */
124-DEFUN_1(copy_int_to_char,int,char)
125+DEFUN_1(copy_int_to_char,int,signed char)
126 #define int_to_char NULL
127 DEFUN_1(copy_int_to_uchar,int,unsigned char)
128 #define int_to_uchar NULL
129@@ -205,7 +205,7 @@ TO_DOUBLE_FUN(int_to_one_double,int)
130 #endif
131
132 /* ------------ unsigned int ---------- */
133-DEFUN_1(copy_uint_to_char,unsigned int,char)
134+DEFUN_1(copy_uint_to_char,unsigned int,signed char)
135 #define uint_to_char NULL
136 DEFUN_1(copy_uint_to_uchar,unsigned int,unsigned char)
137 #define uint_to_uchar NULL
138@@ -246,7 +246,7 @@ TO_DOUBLE_FUN(uint_to_one_double,unsigne
139 #endif
140
141 /* ------------ long ---------- */
142-DEFUN_1(copy_long_to_char,long,char)
143+DEFUN_1(copy_long_to_char,long,signed char)
144 #define long_to_char NULL
145 DEFUN_1(copy_long_to_uchar,long,unsigned char)
146 #define long_to_uchar NULL
147@@ -287,7 +287,7 @@ TO_DOUBLE_FUN(long_to_one_double,long)
148 #endif
149
150 /* ------------ unsigned long ---------- */
151-DEFUN_1(copy_ulong_to_char,unsigned long,char)
152+DEFUN_1(copy_ulong_to_char,unsigned long,signed char)
153 #define ulong_to_char NULL
154 DEFUN_1(copy_ulong_to_uchar,unsigned long,unsigned char)
155 #define ulong_to_uchar NULL
156@@ -329,7 +329,7 @@ TO_DOUBLE_FUN(ulong_to_one_double,unsign
157
158 /* ------------ long long ---------- */
159 #if defined(HAVE_LONG_LONG)
160-DEFUN_1(copy_llong_to_char,long long,char)
161+DEFUN_1(copy_llong_to_char,long long,signed char)
162 #define llong_to_char NULL
163 DEFUN_1(copy_llong_to_uchar,long long,unsigned char)
164 #define llong_to_uchar NULL
165@@ -372,7 +372,7 @@ TO_DOUBLE_FUN(llong_to_one_double,long l
166
167 /* ------------ unsigned long long ---------- */
168 #if defined(HAVE_LONG_LONG)
169-DEFUN_1(copy_ullong_to_char,unsigned long long,char)
170+DEFUN_1(copy_ullong_to_char,unsigned long long,signed char)
171 #define ullong_to_char NULL
172 DEFUN_1(copy_ullong_to_uchar,unsigned long long,unsigned char)
173 #define ullong_to_uchar NULL
174@@ -415,7 +415,7 @@ TO_DOUBLE_FUN(ullong_to_one_double,unsig
175
176 /* ------------ float ---------- */
177 #if SLANG_HAS_FLOAT
178-DEFUN_1(copy_float_to_char,float,char)
179+DEFUN_1(copy_float_to_char,float,signed char)
180 #define float_to_char NULL
181 DEFUN_1(copy_float_to_uchar,float,unsigned char)
182 #define float_to_uchar NULL
183@@ -458,7 +458,7 @@ TO_DOUBLE_FUN(float_to_one_double,float)
184
185 /* ------------ double ---------- */
186 #if SLANG_HAS_FLOAT
187-DEFUN_1(copy_double_to_char,double,char)
188+DEFUN_1(copy_double_to_char,double,signed char)
189 #define double_to_char NULL
190 DEFUN_1(copy_double_to_uchar,double,unsigned char)
191 #define double_to_uchar NULL
192@@ -501,7 +501,7 @@ TO_DOUBLE_FUN(double_to_one_double,doubl
193
194 /* ------------ long double ---------- */
195 #if defined(HAVE_LONG_DOUBLE)
196-DEFUN_1(copy_ldouble_to_char,long double,char)
197+DEFUN_1(copy_ldouble_to_char,long double,signed char)
198 #define ldouble_to_char NULL
199 DEFUN_1(copy_ldouble_to_uchar,long double,unsigned char)
200 #define ldouble_to_uchar NULL
201@@ -545,7 +545,7 @@ TO_DOUBLE_FUN(ldouble_to_one_double,long
202 #if SLANG_HAS_FLOAT
203 static To_Double_Fun_Table_Type To_Double_Fun_Table [MAX_ARITHMETIC_TYPES] =
204 {
205- {sizeof(char), char_to_one_double},
206+ {sizeof(signed char), char_to_one_double},
207 {sizeof(unsigned char), uchar_to_one_double},
208 {sizeof(short), short_to_one_double},
209 {sizeof(unsigned short), ushort_to_one_double},
210@@ -583,7 +583,7 @@ static To_Double_Fun_Table_Type To_Doubl
211
212 static Binary_Matrix_Type Binary_Matrix [MAX_ARITHMETIC_TYPES][MAX_ARITHMETIC_TYPES] =
213 {
214- /* char */
215+ /* signed char */
216 {
217 {(FVOID_STAR)copy_char_to_char, char_to_char},
218 {(FVOID_STAR)copy_char_to_uchar, char_to_uchar},