diff options
| author | Michal Marek <mmarek@suse.cz> | 2011-10-07 19:18:35 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2011-10-11 06:00:39 -0400 |
| commit | 2c5925d6b7fedc8f1c325f4f85451f505ec69aca (patch) | |
| tree | 4b27c58e2487842385e9a736331d97a3c3a9afee | |
| parent | b06fcd6c83c231f51a86448bb33c4cd717fefee8 (diff) | |
genksyms: Do not expand internal types
Consider structures, unions and enums defined in the source file as
internal and do not expand them. This way, changes to e.g. struct
serial_private in drivers/tty/serial/8250_pci.c will not affect the
checksum of the pciserial_* exports.
| -rw-r--r-- | scripts/genksyms/genksyms.c | 3 | ||||
| -rw-r--r-- | scripts/genksyms/genksyms.h | 4 | ||||
| -rw-r--r-- | scripts/genksyms/lex.l | 8 | ||||
| -rw-r--r-- | scripts/genksyms/parse.y | 7 |
4 files changed, 20 insertions, 2 deletions
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 6d3fda0ce2ae..8a106499ec4f 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
| @@ -40,7 +40,8 @@ static struct symbol *symtab[HASH_BUCKETS]; | |||
| 40 | static FILE *debugfile; | 40 | static FILE *debugfile; |
| 41 | 41 | ||
| 42 | int cur_line = 1; | 42 | int cur_line = 1; |
| 43 | char *cur_filename; | 43 | char *cur_filename, *source_file; |
| 44 | int in_source_file; | ||
| 44 | 45 | ||
| 45 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, | 46 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, |
| 46 | flag_preserve, flag_warnings; | 47 | flag_preserve, flag_warnings; |
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 7ec52ae3846a..3bffdcaaa274 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
| @@ -37,6 +37,7 @@ enum symbol_status { | |||
| 37 | struct string_list { | 37 | struct string_list { |
| 38 | struct string_list *next; | 38 | struct string_list *next; |
| 39 | enum symbol_type tag; | 39 | enum symbol_type tag; |
| 40 | int in_source_file; | ||
| 40 | char *string; | 41 | char *string; |
| 41 | }; | 42 | }; |
| 42 | 43 | ||
| @@ -57,7 +58,8 @@ typedef struct string_list **yystype; | |||
| 57 | #define YYSTYPE yystype | 58 | #define YYSTYPE yystype |
| 58 | 59 | ||
| 59 | extern int cur_line; | 60 | extern int cur_line; |
| 60 | extern char *cur_filename; | 61 | extern char *cur_filename, *source_file; |
| 62 | extern int in_source_file; | ||
| 61 | 63 | ||
| 62 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); | 64 | struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact); |
| 63 | struct symbol *add_symbol(const char *name, enum symbol_type type, | 65 | struct symbol *add_symbol(const char *name, enum symbol_type type, |
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index 400ae06a70df..f770071719cb 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l | |||
| @@ -116,6 +116,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>) | |||
| 116 | cur_node->tag = \ | 116 | cur_node->tag = \ |
| 117 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ | 117 | find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\ |
| 118 | SYM_ENUM_CONST : SYM_NORMAL ; \ | 118 | SYM_ENUM_CONST : SYM_NORMAL ; \ |
| 119 | cur_node->in_source_file = in_source_file; \ | ||
| 119 | } while (0) | 120 | } while (0) |
| 120 | 121 | ||
| 121 | #define APP _APP(yytext, yyleng) | 122 | #define APP _APP(yytext, yyleng) |
| @@ -166,6 +167,13 @@ repeat: | |||
| 166 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); | 167 | cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1); |
| 167 | cur_line = atoi(yytext+2); | 168 | cur_line = atoi(yytext+2); |
| 168 | 169 | ||
| 170 | if (!source_file) { | ||
| 171 | source_file = xstrdup(cur_filename); | ||
| 172 | in_source_file = 1; | ||
| 173 | } else { | ||
| 174 | in_source_file = (strcmp(cur_filename, source_file) == 0); | ||
| 175 | } | ||
| 176 | |||
| 169 | goto repeat; | 177 | goto repeat; |
| 170 | } | 178 | } |
| 171 | 179 | ||
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index a783ad4e2b51..23c39998ad86 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y | |||
| @@ -58,6 +58,13 @@ static void record_compound(struct string_list **keyw, | |||
| 58 | enum symbol_type type) | 58 | enum symbol_type type) |
| 59 | { | 59 | { |
| 60 | struct string_list *b = *body, *i = *ident, *r; | 60 | struct string_list *b = *body, *i = *ident, *r; |
| 61 | |||
| 62 | if (i->in_source_file) { | ||
| 63 | remove_node(keyw); | ||
| 64 | (*ident)->tag = type; | ||
| 65 | remove_list(body, ident); | ||
| 66 | return; | ||
| 67 | } | ||
| 61 | r = copy_node(i); r->tag = type; | 68 | r = copy_node(i); r->tag = type; |
| 62 | r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL; | 69 | r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL; |
| 63 | add_symbol(i->string, type, b, is_extern); | 70 | add_symbol(i->string, type, b, is_extern); |
