]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
genksyms: Do not expand internal types
authorMichal Marek <mmarek@suse.cz>
Fri, 7 Oct 2011 23:18:35 +0000 (01:18 +0200)
committerMichal Marek <mmarek@suse.cz>
Tue, 11 Oct 2011 10:00:39 +0000 (12:00 +0200)
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.

scripts/genksyms/genksyms.c
scripts/genksyms/genksyms.h
scripts/genksyms/lex.l
scripts/genksyms/parse.y

index 6d3fda0ce2aeb6a3e0123de2f3d9f61538e7f7d9..8a106499ec4fd627c183dc12eac1a607f2fabd80 100644 (file)
@@ -40,7 +40,8 @@ static struct symbol *symtab[HASH_BUCKETS];
 static FILE *debugfile;
 
 int cur_line = 1;
-char *cur_filename;
+char *cur_filename, *source_file;
+int in_source_file;
 
 static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
           flag_preserve, flag_warnings;
index 7ec52ae3846aa3c2b70837fd652d7e20bbf9dcb0..3bffdcaaa274e82271a98c65fa0bc43cef53ffe2 100644 (file)
@@ -37,6 +37,7 @@ enum symbol_status {
 struct string_list {
        struct string_list *next;
        enum symbol_type tag;
+       int in_source_file;
        char *string;
 };
 
@@ -57,7 +58,8 @@ typedef struct string_list **yystype;
 #define YYSTYPE yystype
 
 extern int cur_line;
-extern char *cur_filename;
+extern char *cur_filename, *source_file;
+extern int in_source_file;
 
 struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
 struct symbol *add_symbol(const char *name, enum symbol_type type,
index 400ae06a70df0ba9b17640d8bd67f0756b802f36..f770071719cb7cb8d4b8d1a069cf8e21786106ff 100644 (file)
@@ -116,6 +116,7 @@ MC_TOKEN            ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
                          cur_node->tag =                                  \
                            find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
                            SYM_ENUM_CONST : SYM_NORMAL ;                  \
+                         cur_node->in_source_file = in_source_file;       \
                        } while (0)
 
 #define APP            _APP(yytext, yyleng)
@@ -166,6 +167,13 @@ repeat:
       cur_filename = memcpy(xmalloc(e-file+1), file, e-file+1);
       cur_line = atoi(yytext+2);
 
+      if (!source_file) {
+        source_file = xstrdup(cur_filename);
+        in_source_file = 1;
+      } else {
+        in_source_file = (strcmp(cur_filename, source_file) == 0);
+      }
+
       goto repeat;
     }
 
index a783ad4e2b51b1b0974e34f78b647db23bd9aa41..23c39998ad864eb328dfaa6c7da6ff9dcc6a10c9 100644 (file)
@@ -58,6 +58,13 @@ static void record_compound(struct string_list **keyw,
                       enum symbol_type type)
 {
        struct string_list *b = *body, *i = *ident, *r;
+
+       if (i->in_source_file) {
+               remove_node(keyw);
+               (*ident)->tag = type;
+               remove_list(body, ident);
+               return;
+       }
        r = copy_node(i); r->tag = type;
        r->next = (*keyw)->next; *body = r; (*keyw)->next = NULL;
        add_symbol(i->string, type, b, is_extern);