aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/slang/slang/change-char-type-to-signed-char-in-macros.patch
blob: 2ea1ffda57abb20d025cd018bab117c306e6267f (plain)
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
slang: change char type to signed char in macros

C language has 3 distinct char types:
         char
         unsigned char
         signed char
A char has the same range of values as signed char on X86,
but same as unsigned char on ARM which made Slang's typecast()
and array_sort() unable to work for char value on ARM, since
Slang is assuming "char" as "signed char".

Now we change "char" as "signed char" explicitly in
util/mkslarith2.sl, and use it to regenerate src/slarith2.inc

Upstream-Status: Submitted
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 src/slarith2.inc       |   72 ++++++++++++++++++++++++-------------------------
 src/util/mkslarith2.sl |    2 -
 2 files changed, 37 insertions(+), 37 deletions(-)

--- a/src/util/mkslarith2.sl
+++ b/src/util/mkslarith2.sl
@@ -1,7 +1,7 @@
 #!/usr/bin/env slsh
 
 private variable CTypes =
-  ["char", "unsigned char", "short", "unsigned short", "int", "unsigned int",
+  ["signed char", "unsigned char", "short", "unsigned short", "int", "unsigned int",
    "long", "unsigned long", "long long", "unsigned long long",
    "float", "double", "long double"];
 private variable Is_Int_Type =
--- a/src/slarith2.inc
+++ b/src/slarith2.inc
@@ -1,43 +1,43 @@
 /* DO NOT EDIT -- this file was generated by src/util/mkslarith2.sl */
-/* ------------ char ---------- */
-DEFUN_1(copy_char_to_char,char,char)
+/* ------------ signed char ---------- */
+DEFUN_1(copy_char_to_char,signed char,signed char)
 #define char_to_char	NULL
 #define copy_char_to_uchar	copy_char_to_char
 #define char_to_uchar	NULL
-DEFUN_1(copy_char_to_short,char,short)
+DEFUN_1(copy_char_to_short,signed char,short)
 #define char_to_short	NULL
-DEFUN_1(copy_char_to_ushort,char,unsigned short)
+DEFUN_1(copy_char_to_ushort,signed char,unsigned short)
 #define char_to_ushort	NULL
-DEFUN_1(copy_char_to_int,char,int)
-DEFUN_2(char_to_int,char,int,copy_char_to_int)
-DEFUN_1(copy_char_to_uint,char,unsigned int)
-DEFUN_2(char_to_uint,char,unsigned int,copy_char_to_uint)
-DEFUN_1(copy_char_to_long,char,long)
-DEFUN_2(char_to_long,char,long,copy_char_to_long)
-DEFUN_1(copy_char_to_ulong,char,unsigned long)
-DEFUN_2(char_to_ulong,char,unsigned long,copy_char_to_ulong)
+DEFUN_1(copy_char_to_int,signed char,int)
+DEFUN_2(char_to_int,signed char,int,copy_char_to_int)
+DEFUN_1(copy_char_to_uint,signed char,unsigned int)
+DEFUN_2(char_to_uint,signed char,unsigned int,copy_char_to_uint)
+DEFUN_1(copy_char_to_long,signed char,long)
+DEFUN_2(char_to_long,signed char,long,copy_char_to_long)
+DEFUN_1(copy_char_to_ulong,signed char,unsigned long)
+DEFUN_2(char_to_ulong,signed char,unsigned long,copy_char_to_ulong)
 #if defined(HAVE_LONG_LONG)
-DEFUN_1(copy_char_to_llong,char,long long)
-DEFUN_2(char_to_llong,char,long long,copy_char_to_llong)
+DEFUN_1(copy_char_to_llong,signed char,long long)
+DEFUN_2(char_to_llong,signed char,long long,copy_char_to_llong)
 #endif /* defined(HAVE_LONG_LONG) */
 #if defined(HAVE_LONG_LONG)
-DEFUN_1(copy_char_to_ullong,char,unsigned long long)
-DEFUN_2(char_to_ullong,char,unsigned long long,copy_char_to_ullong)
+DEFUN_1(copy_char_to_ullong,signed char,unsigned long long)
+DEFUN_2(char_to_ullong,signed char,unsigned long long,copy_char_to_ullong)
 #endif /* defined(HAVE_LONG_LONG) */
 #if SLANG_HAS_FLOAT
-DEFUN_1(copy_char_to_float,char,float)
-DEFUN_2(char_to_float,char,float,copy_char_to_float)
+DEFUN_1(copy_char_to_float,signed char,float)
+DEFUN_2(char_to_float,signed char,float,copy_char_to_float)
 #endif /* SLANG_HAS_FLOAT */
 #if SLANG_HAS_FLOAT
-DEFUN_1(copy_char_to_double,char,double)
-DEFUN_2(char_to_double,char,double,copy_char_to_double)
+DEFUN_1(copy_char_to_double,signed char,double)
+DEFUN_2(char_to_double,signed char,double,copy_char_to_double)
 #endif /* SLANG_HAS_FLOAT */
 #if defined(HAVE_LONG_DOUBLE)
-DEFUN_1(copy_char_to_ldouble,char,long double)
-DEFUN_2(char_to_ldouble,char,long double,copy_char_to_ldouble)
+DEFUN_1(copy_char_to_ldouble,signed char,long double)
+DEFUN_2(char_to_ldouble,signed char,long double,copy_char_to_ldouble)
 #endif /* defined(HAVE_LONG_DOUBLE) */
 #if SLANG_HAS_FLOAT
-TO_DOUBLE_FUN(char_to_one_double,char)
+TO_DOUBLE_FUN(char_to_one_double,signed char)
 #endif
 
 /* ------------ unsigned char ---------- */
@@ -82,7 +82,7 @@ TO_DOUBLE_FUN(uchar_to_one_double,unsign
 #endif
 
 /* ------------ short ---------- */
-DEFUN_1(copy_short_to_char,short,char)
+DEFUN_1(copy_short_to_char,short,signed char)
 #define short_to_char	NULL
 DEFUN_1(copy_short_to_uchar,short,unsigned char)
 #define short_to_uchar	NULL
@@ -123,7 +123,7 @@ TO_DOUBLE_FUN(short_to_one_double,short)
 #endif
 
 /* ------------ unsigned short ---------- */
-DEFUN_1(copy_ushort_to_char,unsigned short,char)
+DEFUN_1(copy_ushort_to_char,unsigned short,signed char)
 #define ushort_to_char	NULL
 DEFUN_1(copy_ushort_to_uchar,unsigned short,unsigned char)
 #define ushort_to_uchar	NULL
@@ -164,7 +164,7 @@ TO_DOUBLE_FUN(ushort_to_one_double,unsig
 #endif
 
 /* ------------ int ---------- */
-DEFUN_1(copy_int_to_char,int,char)
+DEFUN_1(copy_int_to_char,int,signed char)
 #define int_to_char	NULL
 DEFUN_1(copy_int_to_uchar,int,unsigned char)
 #define int_to_uchar	NULL
@@ -205,7 +205,7 @@ TO_DOUBLE_FUN(int_to_one_double,int)
 #endif
 
 /* ------------ unsigned int ---------- */
-DEFUN_1(copy_uint_to_char,unsigned int,char)
+DEFUN_1(copy_uint_to_char,unsigned int,signed char)
 #define uint_to_char	NULL
 DEFUN_1(copy_uint_to_uchar,unsigned int,unsigned char)
 #define uint_to_uchar	NULL
@@ -246,7 +246,7 @@ TO_DOUBLE_FUN(uint_to_one_double,unsigne
 #endif
 
 /* ------------ long ---------- */
-DEFUN_1(copy_long_to_char,long,char)
+DEFUN_1(copy_long_to_char,long,signed char)
 #define long_to_char	NULL
 DEFUN_1(copy_long_to_uchar,long,unsigned char)
 #define long_to_uchar	NULL
@@ -287,7 +287,7 @@ TO_DOUBLE_FUN(long_to_one_double,long)
 #endif
 
 /* ------------ unsigned long ---------- */
-DEFUN_1(copy_ulong_to_char,unsigned long,char)
+DEFUN_1(copy_ulong_to_char,unsigned long,signed char)
 #define ulong_to_char	NULL
 DEFUN_1(copy_ulong_to_uchar,unsigned long,unsigned char)
 #define ulong_to_uchar	NULL
@@ -329,7 +329,7 @@ TO_DOUBLE_FUN(ulong_to_one_double,unsign
 
 /* ------------ long long ---------- */
 #if defined(HAVE_LONG_LONG)
-DEFUN_1(copy_llong_to_char,long long,char)
+DEFUN_1(copy_llong_to_char,long long,signed char)
 #define llong_to_char	NULL
 DEFUN_1(copy_llong_to_uchar,long long,unsigned char)
 #define llong_to_uchar	NULL
@@ -372,7 +372,7 @@ TO_DOUBLE_FUN(llong_to_one_double,long l
 
 /* ------------ unsigned long long ---------- */
 #if defined(HAVE_LONG_LONG)
-DEFUN_1(copy_ullong_to_char,unsigned long long,char)
+DEFUN_1(copy_ullong_to_char,unsigned long long,signed char)
 #define ullong_to_char	NULL
 DEFUN_1(copy_ullong_to_uchar,unsigned long long,unsigned char)
 #define ullong_to_uchar	NULL
@@ -415,7 +415,7 @@ TO_DOUBLE_FUN(ullong_to_one_double,unsig
 
 /* ------------ float ---------- */
 #if SLANG_HAS_FLOAT
-DEFUN_1(copy_float_to_char,float,char)
+DEFUN_1(copy_float_to_char,float,signed char)
 #define float_to_char	NULL
 DEFUN_1(copy_float_to_uchar,float,unsigned char)
 #define float_to_uchar	NULL
@@ -458,7 +458,7 @@ TO_DOUBLE_FUN(float_to_one_double,float)
 
 /* ------------ double ---------- */
 #if SLANG_HAS_FLOAT
-DEFUN_1(copy_double_to_char,double,char)
+DEFUN_1(copy_double_to_char,double,signed char)
 #define double_to_char	NULL
 DEFUN_1(copy_double_to_uchar,double,unsigned char)
 #define double_to_uchar	NULL
@@ -501,7 +501,7 @@ TO_DOUBLE_FUN(double_to_one_double,doubl
 
 /* ------------ long double ---------- */
 #if defined(HAVE_LONG_DOUBLE)
-DEFUN_1(copy_ldouble_to_char,long double,char)
+DEFUN_1(copy_ldouble_to_char,long double,signed char)
 #define ldouble_to_char	NULL
 DEFUN_1(copy_ldouble_to_uchar,long double,unsigned char)
 #define ldouble_to_uchar	NULL
@@ -545,7 +545,7 @@ TO_DOUBLE_FUN(ldouble_to_one_double,long
 #if SLANG_HAS_FLOAT
 static To_Double_Fun_Table_Type To_Double_Fun_Table [MAX_ARITHMETIC_TYPES] =
 {
-   {sizeof(char), char_to_one_double},
+   {sizeof(signed char), char_to_one_double},
    {sizeof(unsigned char), uchar_to_one_double},
    {sizeof(short), short_to_one_double},
    {sizeof(unsigned short), ushort_to_one_double},
@@ -583,7 +583,7 @@ static To_Double_Fun_Table_Type To_Doubl
 
 static Binary_Matrix_Type Binary_Matrix [MAX_ARITHMETIC_TYPES][MAX_ARITHMETIC_TYPES] =
 {
-   /* char */
+   /* signed char */
    {
      {(FVOID_STAR)copy_char_to_char, char_to_char},
      {(FVOID_STAR)copy_char_to_uchar, char_to_uchar},