summaryrefslogtreecommitdiffstats
path: root/recipes-extended/dev86/dev86/0004-regen-token2.h-token1.h-with-gperf-3.1.patch
blob: 8787369ff34b0f67bf8074c82c560f6bbba7fc94 (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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
From ce2b9747d51df2a4c358a037950f0464f3f53fe8 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Fri, 14 May 2021 14:31:50 +0000
Subject: [PATCH] regen token2.h, token1.h with gperf-3.1

* update cc.h, token1.c, token2.c to be compatible with
  gperf-3.1 output

Upstream-Status: Pending
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

---
 cpp/cc.h     |   4 +-
 cpp/token1.c |   2 +-
 cpp/token1.h |  22 ++----
 cpp/token2.c |   2 +-
 cpp/token2.h | 211 +++++++++++++++++++++++++++++++--------------------
 5 files changed, 140 insertions(+), 101 deletions(-)

diff --git a/cpp/cc.h b/cpp/cc.h
index 9c298e7..3724543 100644
--- a/cpp/cc.h
+++ b/cpp/cc.h
@@ -25,8 +25,8 @@ extern int    dialect;
 extern int gettok P((void));
 
 struct token_trans { char * name; int token; };
-struct token_trans * is_ctok P((const char *str, unsigned int len));
-struct token_trans * is_ckey P((const char *str, unsigned int len));
+struct token_trans * is_ctok P((register const char *str, register size_t len));
+struct token_trans * is_ckey P((register const char *str, register size_t len));
 
 #define WORDSIZE	128
 #define TK_WSPACE	256
diff --git a/cpp/token1.c b/cpp/token1.c
index f3aa420..cc47f3e 100644
--- a/cpp/token1.c
+++ b/cpp/token1.c
@@ -6,6 +6,6 @@
 #ifdef __GNUC__
 __inline
 #endif
-static unsigned int hash1 P((register const char *, register unsigned int));
+static unsigned int hash1 P((register const char *, register size_t));
 
 #include "token1.h"
diff --git a/cpp/token1.h b/cpp/token1.h
index bb313aa..2af88c2 100644
--- a/cpp/token1.h
+++ b/cpp/token1.h
@@ -1,4 +1,4 @@
-/* C code produced by gperf version 3.0.4 */
+/* ANSI-C code produced by gperf version 3.1 */
 /* Command-line: gperf -aptTc -N is_ctok -H hash1 token1.tok  */
 /* Computed positions: -k'1-2' */
 
@@ -26,7 +26,7 @@
       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
 /* The character set is not based on ISO-646.  */
-error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
 
@@ -45,9 +45,7 @@ inline
 #endif
 #endif
 static unsigned int
-hash1 (str, len)
-     register const char *str;
-     register unsigned int len;
+hash1 (register const char *str, register size_t len)
 {
   static unsigned char asso_values[] =
     {
@@ -81,16 +79,8 @@ hash1 (str, len)
   return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
 }
 
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
 struct token_trans *
-is_ctok (str, len)
-     register const char *str;
-     register unsigned int len;
+is_ctok (register const char *str, register size_t len)
 {
   static struct token_trans wordlist[] =
     {
@@ -161,9 +151,9 @@ is_ctok (str, len)
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash1 (str, len);
+      register unsigned int key = hash1 (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= 0)
+      if (key <= MAX_HASH_VALUE)
         {
           register const char *s = wordlist[key].name;
 
diff --git a/cpp/token2.c b/cpp/token2.c
index b4d22b1..fbc790d 100644
--- a/cpp/token2.c
+++ b/cpp/token2.c
@@ -6,6 +6,6 @@
 #ifdef __GNUC__
 __inline
 #endif
-static unsigned int hash2 P((register const char *, register unsigned int));
+static unsigned int hash2 P((register const char *, register size_t));
 
 #include "token2.h"
diff --git a/cpp/token2.h b/cpp/token2.h
index 62e69b1..f7ac2fd 100644
--- a/cpp/token2.h
+++ b/cpp/token2.h
@@ -1,57 +1,87 @@
-/* C code produced by gperf version 2.7.1 (19981006 egcs) */
+/* ANSI-C code produced by gperf version 3.1 */
 /* Command-line: gperf -aptTc -k1,3 -N is_ckey -H hash2 token2.tok  */
 
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+      && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+      && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+      && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+      && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+      && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+      && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+      && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+      && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+      && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+      && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+      && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+      && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+      && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+      && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+      && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+      && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+      && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+      && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+      && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+      && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+      && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+      && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646.  */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
+#endif
+
+
 #define TOTAL_KEYWORDS 34
 #define MIN_WORD_LENGTH 2
 #define MAX_WORD_LENGTH 8
-#define MIN_HASH_VALUE 2
-#define MAX_HASH_VALUE 69
-/* maximum key range = 68, duplicates = 0 */
+#define MIN_HASH_VALUE 3
+#define MAX_HASH_VALUE 44
+/* maximum key range = 42, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
+#else
+#ifdef __cplusplus
+inline
+#endif
 #endif
 static unsigned int
-hash2 (str, len)
-     register const char *str;
-     register unsigned int len;
+hash2 (register const char *str, register size_t len)
 {
   static unsigned char asso_values[] =
     {
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-       5, 70, 70, 70, 70, 70,  0, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70,  0, 70,  5,  5, 10,
-      10, 20, 20, 25, 70,  0, 70, 70, 50, 70,
-       0, 15,  0, 70, 15,  0, 40, 20,  0,  0,
-      70, 70, 10, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-      70, 70, 70, 70, 70, 70
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      25, 45, 45, 45, 45, 45, 10, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45,  5, 45, 30, 10, 10,
+      25, 20,  0, 10, 45,  5, 45, 45, 25, 45,
+      10, 10,  5, 45,  0,  5,  0,  0,  0, 20,
+      45, 45, 25, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+      45, 45, 45, 45, 45, 45
     };
-  register int hval = len;
+  register unsigned int hval = len;
 
   switch (hval)
     {
       default:
-      case 3:
         hval += asso_values[(unsigned char)str[2]];
+      /*FALLTHROUGH*/
       case 2:
       case 1:
         hval += asso_values[(unsigned char)str[0]];
@@ -60,78 +90,97 @@ hash2 (str, len)
   return hval;
 }
 
-#ifdef __GNUC__
-__inline
-#endif
 struct token_trans *
-is_ckey (str, len)
-     register const char *str;
-     register unsigned int len;
+is_ckey (register const char *str, register size_t len)
 {
   static struct token_trans wordlist[] =
     {
+      {""}, {""}, {""},
+#line 16 "token2.tok"
+      {"for",		TK_FOR},
       {""}, {""},
+#line 22 "token2.tok"
+      {"return",		TK_RETURN},
+#line 18 "token2.tok"
       {"if",		TK_IF},
-      {""},
+#line 19 "token2.tok"
+      {"int",		TK_INT},
+#line 32 "token2.tok"
       {"void",		TK_VOID},
-      {"while",		TK_WHILE},
+#line 30 "token2.tok"
+      {"union",		TK_UNION},
+#line 27 "token2.tok"
+      {"struct",		TK_STRUCT},
+#line 29 "token2.tok"
+      {"typedef",	TK_TYPEDEF},
+#line 31 "token2.tok"
+      {"unsigned",	TK_UNSIGNED},
+#line 17 "token2.tok"
+      {"goto",		TK_GOTO},
+#line 15 "token2.tok"
+      {"float",		TK_FLOAT},
+#line 28 "token2.tok"
       {"switch",		TK_SWITCH},
       {""},
-      {"__LINE__",	TK_LINE},
-      {""}, {""},
-      {"static",		TK_STATIC},
-      {"do",		TK_DO},
-      {"__FILE__",	TK_FILE},
+#line 21 "token2.tok"
+      {"register",	TK_REGISTER},
+#line 5 "token2.tok"
       {"case",		TK_CASE},
-      {"const",		TK_CONST},
-      {"sizeof",		TK_SIZEOF},
+#line 23 "token2.tok"
+      {"short",		TK_SHORT},
+#line 24 "token2.tok"
+      {"signed",		TK_SIGNED},
       {""},
+#line 36 "token2.tok"
+      {"__LINE__",	TK_LINE},
+#line 13 "token2.tok"
+      {"enum",		TK_ENUM},
+#line 7 "token2.tok"
+      {"const",		TK_CONST},
+#line 14 "token2.tok"
+      {"extern",		TK_EXTERN},
+#line 10 "token2.tok"
+      {"do",		TK_DO},
+#line 8 "token2.tok"
       {"continue",	TK_CONTINUE},
-      {"char",		TK_CHAR},
-      {"short",		TK_SHORT},
-      {"struct",		TK_STRUCT},
-      {""}, {""},
+#line 12 "token2.tok"
       {"else",		TK_ELSE},
-      {"union",		TK_UNION},
-      {""}, {""},
-      {"unsigned",	TK_UNSIGNED},
-      {""},
-      {"break",		TK_BREAK},
-      {"signed",		TK_SIGNED},
-      {""}, {""}, {""}, {""},
+#line 34 "token2.tok"
+      {"while",		TK_WHILE},
+#line 11 "token2.tok"
       {"double",		TK_DOUBLE},
+#line 9 "token2.tok"
       {"default",	TK_DEFAULT},
-      {"for",		TK_FOR},
-      {""},
-      {"float",		TK_FLOAT},
-      {""}, {""},
-      {"int",		TK_INT},
-      {"enum",		TK_ENUM},
-      {""}, {""},
-      {"typedef",	TK_TYPEDEF},
-      {"register",	TK_REGISTER},
+#line 33 "token2.tok"
+      {"volatile",	TK_VOLATILE},
+#line 3 "token2.tok"
       {"auto",		TK_AUTO},
-      {""}, {""}, {""}, {""},
+#line 4 "token2.tok"
+      {"break",		TK_BREAK},
+#line 25 "token2.tok"
+      {"sizeof",		TK_SIZEOF},
+      {""},
+#line 35 "token2.tok"
+      {"__FILE__",	TK_FILE},
+#line 20 "token2.tok"
       {"long",		TK_LONG},
-      {""}, {""}, {""},
-      {"volatile",	TK_VOLATILE},
-      {""}, {""},
-      {"return",		TK_RETURN},
-      {""}, {""}, {""}, {""},
-      {"extern",		TK_EXTERN},
+      {""},
+#line 26 "token2.tok"
+      {"static",		TK_STATIC},
       {""}, {""},
-      {"goto",		TK_GOTO}
+#line 6 "token2.tok"
+      {"char",		TK_CHAR}
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash2 (str, len);
+      register unsigned int key = hash2 (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= 0)
+      if (key <= MAX_HASH_VALUE)
         {
           register const char *s = wordlist[key].name;
 
-          if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
+          if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
             return &wordlist[key];
         }
     }