summaryrefslogtreecommitdiff
path: root/scripts/genksyms/genksyms.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genksyms/genksyms.c')
-rw-r--r--scripts/genksyms/genksyms.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 8b0d7ac73dbb..83e48670c2fc 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -181,13 +181,9 @@ static int is_unknown_symbol(struct symbol *sym)
strcmp(defn->string, "{") == 0);
}
-static struct symbol *__add_symbol(const char *name, enum symbol_type type,
- struct string_list *defn, int is_extern,
- int is_reference)
+static struct string_list *process_enum(const char *name, enum symbol_type type,
+ struct string_list *defn)
{
- unsigned long h;
- struct symbol *sym;
- enum symbol_status status = STATUS_UNCHANGED;
/* The parser adds symbols in the order their declaration completes,
* so it is safe to store the value of the previous enum constant in
* a static variable.
@@ -216,7 +212,7 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
defn = mk_node(buf);
}
}
- } else if (type == SYM_ENUM) {
+ } else {
free_list(last_enum_expr, NULL);
last_enum_expr = NULL;
enum_counter = 0;
@@ -225,6 +221,23 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
return NULL;
}
+ return defn;
+}
+
+static struct symbol *__add_symbol(const char *name, enum symbol_type type,
+ struct string_list *defn, int is_extern,
+ int is_reference)
+{
+ unsigned long h;
+ struct symbol *sym;
+ enum symbol_status status = STATUS_UNCHANGED;
+
+ if ((type == SYM_ENUM_CONST || type == SYM_ENUM) && !is_reference) {
+ defn = process_enum(name, type, defn);
+ if (defn == NULL)
+ return NULL;
+ }
+
h = crc32(name);
hash_for_each_possible(symbol_hashtable, sym, hnode, h) {
if (map_to_ns(sym->type) != map_to_ns(type) ||