diff options
author | Michal Marek <mmarek@suse.cz> | 2011-02-03 17:57:09 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-03-17 10:13:56 -0400 |
commit | e37ddb82500393cb417c3ab0fe0726d9a8652372 (patch) | |
tree | 6ecc94992cb5affad4fe438d9b586a61b803f928 /scripts/genksyms/genksyms.h | |
parent | 01762c4ec5f6f62c550304b9c70e824293cefdd0 (diff) |
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 <constant> <value>. 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 <mmarek@suse.cz>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/genksyms/genksyms.h')
-rw-r--r-- | scripts/genksyms/genksyms.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 9fdafb667e76..7ec52ae3846a 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
@@ -26,7 +26,8 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | 27 | ||
28 | enum symbol_type { | 28 | enum symbol_type { |
29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION | 29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION, |
30 | SYM_ENUM_CONST | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | enum symbol_status { | 33 | enum symbol_status { |
@@ -66,6 +67,8 @@ void export_symbol(const char *); | |||
66 | void free_node(struct string_list *list); | 67 | void free_node(struct string_list *list); |
67 | void free_list(struct string_list *s, struct string_list *e); | 68 | void free_list(struct string_list *s, struct string_list *e); |
68 | struct string_list *copy_node(struct string_list *); | 69 | struct string_list *copy_node(struct string_list *); |
70 | struct string_list *copy_list_range(struct string_list *start, | ||
71 | struct string_list *end); | ||
69 | 72 | ||
70 | int yylex(void); | 73 | int yylex(void); |
71 | int yyparse(void); | 74 | int yyparse(void); |