From 01762c4ec5f6f62c550304b9c70e824293cefdd0 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Tue, 15 Feb 2011 15:11:36 +0100 Subject: genksyms: simplify usage of find_symbol() Allow searching for symbols of an exact type. The lexer does this and a subsequent patch will add one more usage. Signed-off-by: Michal Marek Acked-by: Sam Ravnborg --- scripts/genksyms/genksyms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/genksyms/genksyms.h') diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 25c4d40cefc..9fdafb667e7 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h @@ -58,7 +58,7 @@ typedef struct string_list **yystype; extern int cur_line; extern char *cur_filename; -struct symbol *find_symbol(const char *name, enum symbol_type ns); +struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); struct symbol *add_symbol(const char *name, enum symbol_type type, struct string_list *defn, int is_extern); void export_symbol(const char *); -- cgit v1.2.3 From e37ddb82500393cb417c3ab0fe0726d9a8652372 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 3 Feb 2011 23:57:09 +0100 Subject: genksyms: Track changes to enum constants Enum constants can be used as array sizes; if the enum itself does not appear in the symbol expansion, a change in the enum constant will go unnoticed. Example patch that changes the ABI but does not change the checksum with current genksyms: | enum e { | E1, | E2, |+ E3, | E_MAX | }; | | struct s { | int a[E_MAX]; | } | | int f(struct s *s) { ... } | EXPORT_SYMBOL(f) Therefore, remember the value of each enum constant and expand each occurence to . The value is not actually computed, but instead an expression in the form (last explicitly assigned value) + N is used. This avoids having to parse and semantically understand whole of C. Note: The changes won't take effect until the lexer and parser are rebuilt by the next patch. Signed-off-by: Michal Marek Acked-by: Sam Ravnborg --- scripts/genksyms/genksyms.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts/genksyms/genksyms.h') diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 9fdafb667e7..7ec52ae3846 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h @@ -26,7 +26,8 @@ #include enum symbol_type { - SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION + SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION, + SYM_ENUM_CONST }; enum symbol_status { @@ -66,6 +67,8 @@ void export_symbol(const char *); void free_node(struct string_list *list); void free_list(struct string_list *s, struct string_list *e); struct string_list *copy_node(struct string_list *); +struct string_list *copy_list_range(struct string_list *start, + struct string_list *end); int yylex(void); int yyparse(void); -- cgit v1.2.3