Commit bc6efdcb authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Fix genksyms __typeof__ handling

genksyms used to fail generating a checksum for a symbol which was
defined using __typeof__.

This minimal patch fixes it to recognize the case which occurs in the
kernel, it's not a complete correct typeof handling, but it serves our
needs.
parent 57146c8a
/* ANSI-C code produced by gperf version 2.7.2 */ /* ANSI-C code produced by gperf version 2.7.2 */
/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */
struct resword { const char *name; int token; }; struct resword { const char *name; int token; };
/* maximum key range = 101, duplicates = 0 */ /* maximum key range = 109, duplicates = 0 */
#ifdef __GNUC__ #ifdef __GNUC__
__inline __inline
...@@ -15,32 +15,32 @@ is_reserved_hash (register const char *str, register unsigned int len) ...@@ -15,32 +15,32 @@ is_reserved_hash (register const char *str, register unsigned int len)
{ {
static const unsigned char asso_values[] = static const unsigned char asso_values[] =
{ {
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 5, 113, 113, 113, 113, 113, 113, 113, 113, 113, 5,
105, 105, 105, 105, 105, 105, 0, 105, 105, 105, 113, 113, 113, 113, 113, 113, 0, 113, 113, 113,
0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 0, 105, 0, 105, 20, 113, 113, 113, 113, 113, 0, 113, 0, 113, 20,
25, 0, 35, 30, 105, 20, 105, 105, 40, 30, 25, 0, 35, 30, 113, 20, 113, 113, 40, 30,
30, 0, 0, 105, 0, 0, 0, 15, 5, 105, 30, 0, 0, 113, 0, 51, 0, 15, 5, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
105, 105, 105, 105, 105, 105 113, 113, 113, 113, 113, 113
}; };
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
} }
...@@ -53,23 +53,22 @@ is_reserved_word (register const char *str, register unsigned int len) ...@@ -53,23 +53,22 @@ is_reserved_word (register const char *str, register unsigned int len)
{ {
enum enum
{ {
TOTAL_KEYWORDS = 39, TOTAL_KEYWORDS = 41,
MIN_WORD_LENGTH = 3, MIN_WORD_LENGTH = 3,
MAX_WORD_LENGTH = 17, MAX_WORD_LENGTH = 17,
MIN_HASH_VALUE = 4, MIN_HASH_VALUE = 4,
MAX_HASH_VALUE = 104 MAX_HASH_VALUE = 112
}; };
static const struct resword wordlist[] = static const struct resword wordlist[] =
{ {
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{"auto", AUTO_KEYW}, {"auto", AUTO_KEYW},
{"short", SHORT_KEYW}, {""}, {""},
{"struct", STRUCT_KEYW},
{"__asm__", ASM_KEYW}, {"__asm__", ASM_KEYW},
{"restrict", RESTRICT_KEYW}, {""},
{"_restrict", RESTRICT_KEYW}, {"_restrict", RESTRICT_KEYW},
{"__signed__", SIGNED_KEYW}, {"__typeof__", TYPEOF_KEYW},
{"__attribute", ATTRIBUTE_KEYW}, {"__attribute", ATTRIBUTE_KEYW},
{"__restrict__", RESTRICT_KEYW}, {"__restrict__", RESTRICT_KEYW},
{"__attribute__", ATTRIBUTE_KEYW}, {"__attribute__", ATTRIBUTE_KEYW},
...@@ -82,46 +81,52 @@ is_reserved_word (register const char *str, register unsigned int len) ...@@ -82,46 +81,52 @@ is_reserved_word (register const char *str, register unsigned int len)
{"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
{"int", INT_KEYW}, {"int", INT_KEYW},
{"char", CHAR_KEYW}, {"char", CHAR_KEYW},
{""}, {""}, {""},
{"static", STATIC_KEYW},
{"__const", CONST_KEYW}, {"__const", CONST_KEYW},
{"__inline", INLINE_KEYW}, {"__inline", INLINE_KEYW},
{"__const__", CONST_KEYW}, {"__const__", CONST_KEYW},
{"__inline__", INLINE_KEYW}, {"__inline__", INLINE_KEYW},
{""}, {""}, {""}, {""}, {""}, {""},
{"__signed", SIGNED_KEYW},
{""},
{"__asm", ASM_KEYW}, {"__asm", ASM_KEYW},
{"extern", EXTERN_KEYW}, {"extern", EXTERN_KEYW},
{""}, {""},
{"register", REGISTER_KEYW}, {"register", REGISTER_KEYW},
{""}, {""},
{"float", FLOAT_KEYW}, {"float", FLOAT_KEYW},
{""}, {"typeof", TYPEOF_KEYW},
{"typedef", TYPEDEF_KEYW}, {"typedef", TYPEDEF_KEYW},
{""}, {""}, {""}, {""},
{"_Bool", BOOL_KEYW}, {"_Bool", BOOL_KEYW},
{"double", DOUBLE_KEYW}, {"double", DOUBLE_KEYW},
{""}, {""}, {""},
{"unsigned", UNSIGNED_KEYW},
{"enum", ENUM_KEYW}, {"enum", ENUM_KEYW},
{""}, {""}, {""}, {""}, {""}, {""},
{"volatile", VOLATILE_KEYW}, {"volatile", VOLATILE_KEYW},
{"void", VOID_KEYW}, {"void", VOID_KEYW},
{"const", CONST_KEYW}, {"const", CONST_KEYW},
{""}, {""}, {""}, {""}, {""}, {"short", SHORT_KEYW},
{"signed", SIGNED_KEYW}, {"struct", STRUCT_KEYW},
{""},
{"restrict", RESTRICT_KEYW},
{""},
{"__signed__", SIGNED_KEYW},
{""}, {""},
{"asm", ASM_KEYW}, {"asm", ASM_KEYW},
{""}, {""}, {""}, {""},
{"inline", INLINE_KEYW}, {"inline", INLINE_KEYW},
{""}, {""}, {""}, {""}, {""}, {""},
{"union", UNION_KEYW}, {"union", UNION_KEYW},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{"long", LONG_KEYW} {"static", STATIC_KEYW},
{""}, {""}, {""}, {""}, {""}, {""},
{"__signed", SIGNED_KEYW},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""},
{"unsigned", UNSIGNED_KEYW},
{""}, {""}, {""}, {""},
{"long", LONG_KEYW},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
{"signed", SIGNED_KEYW}
}; };
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......
...@@ -46,3 +46,5 @@ union, UNION_KEYW ...@@ -46,3 +46,5 @@ union, UNION_KEYW
unsigned, UNSIGNED_KEYW unsigned, UNSIGNED_KEYW
void, VOID_KEYW void, VOID_KEYW
volatile, VOLATILE_KEYW volatile, VOLATILE_KEYW
typeof, TYPEOF_KEYW
__typeof__, TYPEOF_KEYW
...@@ -2061,21 +2061,22 @@ fini: ...@@ -2061,21 +2061,22 @@ fini:
#define UNSIGNED_KEYW 278 #define UNSIGNED_KEYW 278
#define VOID_KEYW 279 #define VOID_KEYW 279
#define VOLATILE_KEYW 280 #define VOLATILE_KEYW 280
#define EXPORT_SYMBOL_KEYW 281 #define TYPEOF_KEYW 281
#define ASM_PHRASE 282 #define EXPORT_SYMBOL_KEYW 282
#define ATTRIBUTE_PHRASE 283 #define ASM_PHRASE 283
#define BRACE_PHRASE 284 #define ATTRIBUTE_PHRASE 284
#define BRACKET_PHRASE 285 #define BRACE_PHRASE 285
#define EXPRESSION_PHRASE 286 #define BRACKET_PHRASE 286
#define CHAR 287 #define EXPRESSION_PHRASE 287
#define DOTS 288 #define CHAR 288
#define IDENT 289 #define DOTS 289
#define INT 290 #define IDENT 290
#define REAL 291 #define INT 291
#define STRING 292 #define REAL 292
#define TYPE 293 #define STRING 293
#define OTHER 294 #define TYPE 294
#define FILENAME 295 #define OTHER 295
#define FILENAME 296
extern YYSTYPE yylval; extern YYSTYPE yylval;
This diff is collapsed.
...@@ -25,21 +25,22 @@ ...@@ -25,21 +25,22 @@
#define UNSIGNED_KEYW 278 #define UNSIGNED_KEYW 278
#define VOID_KEYW 279 #define VOID_KEYW 279
#define VOLATILE_KEYW 280 #define VOLATILE_KEYW 280
#define EXPORT_SYMBOL_KEYW 281 #define TYPEOF_KEYW 281
#define ASM_PHRASE 282 #define EXPORT_SYMBOL_KEYW 282
#define ATTRIBUTE_PHRASE 283 #define ASM_PHRASE 283
#define BRACE_PHRASE 284 #define ATTRIBUTE_PHRASE 284
#define BRACKET_PHRASE 285 #define BRACE_PHRASE 285
#define EXPRESSION_PHRASE 286 #define BRACKET_PHRASE 286
#define CHAR 287 #define EXPRESSION_PHRASE 287
#define DOTS 288 #define CHAR 288
#define IDENT 289 #define DOTS 289
#define INT 290 #define IDENT 290
#define REAL 291 #define INT 291
#define STRING 292 #define REAL 292
#define TYPE 293 #define STRING 293
#define OTHER 294 #define TYPE 294
#define FILENAME 295 #define OTHER 295
#define FILENAME 296
extern YYSTYPE yylval; extern YYSTYPE yylval;
...@@ -76,6 +76,7 @@ remove_list(struct string_list **pb, struct string_list **pe) ...@@ -76,6 +76,7 @@ remove_list(struct string_list **pb, struct string_list **pe)
%token UNSIGNED_KEYW %token UNSIGNED_KEYW
%token VOID_KEYW %token VOID_KEYW
%token VOLATILE_KEYW %token VOLATILE_KEYW
%token TYPEOF_KEYW
%token EXPORT_SYMBOL_KEYW %token EXPORT_SYMBOL_KEYW
...@@ -196,6 +197,7 @@ storage_class_specifier: ...@@ -196,6 +197,7 @@ storage_class_specifier:
type_specifier: type_specifier:
simple_type_specifier simple_type_specifier
| cvar_qualifier | cvar_qualifier
| TYPEOF_KEYW '(' type_specifier ')'
/* References to s/u/e's defined elsewhere. Rearrange things /* References to s/u/e's defined elsewhere. Rearrange things
so that it is easier to expand the definition fully later. */ so that it is easier to expand the definition fully later. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment