summaryrefslogtreecommitdiffstats
path: root/scripts/genksyms/lex.c_shipped
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2011-02-15 16:04:35 +0100
committerMichal Marek <mmarek@suse.cz>2011-03-17 15:13:56 +0100
commit303fc01fb12d95cf9ab88c496df6651c887cef3c (patch)
treebbfc1b170233aeac7f1f2b14f435a41c5d2c9959 /scripts/genksyms/lex.c_shipped
parente37ddb82500393cb417c3ab0fe0726d9a8652372 (diff)
genksyms: Regenerate lexer and parser
Regenerated the parser after "genksyms: Track changes to enum constants". Signed-off-by: Michal Marek <mmarek@suse.cz> Acked-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/genksyms/lex.c_shipped')
-rw-r--r--scripts/genksyms/lex.c_shipped30
1 files changed, 27 insertions, 3 deletions
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped
index f231c0810c6..af4939041e4 100644
--- a/scripts/genksyms/lex.c_shipped
+++ b/scripts/genksyms/lex.c_shipped
@@ -2253,12 +2253,23 @@ void yyfree (void * ptr )
/* Macros to append to our phrase collection list. */
+/*
+ * We mark any token, that that equals to a known enumerator, as
+ * SYM_ENUM_CONST. The parser will change this for struct and union tags later,
+ * the only problem is struct and union members:
+ * enum e { a, b }; struct s { int a, b; }
+ * but in this case, the only effect will be, that the ABI checksums become
+ * more volatile, which is acceptable. Also, such collisions are quite rare,
+ * so far it was only observed in include/linux/telephony.h.
+ */
#define _APP(T,L) do { \
cur_node = next_node; \
next_node = xmalloc(sizeof(*next_node)); \
next_node->next = cur_node; \
cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
- cur_node->tag = SYM_NORMAL; \
+ cur_node->tag = \
+ find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
+ SYM_ENUM_CONST : SYM_NORMAL ; \
} while (0)
#define APP _APP(yytext, yyleng)
@@ -2336,8 +2347,8 @@ repeat:
case STRUCT_KEYW:
case UNION_KEYW:
- dont_want_brace_phrase = 3;
case ENUM_KEYW:
+ dont_want_brace_phrase = 3;
suppress_type_lookup = 2;
goto fini;
@@ -2466,7 +2477,20 @@ repeat:
++count;
APP;
goto repeat;
- case ')': case ']': case '}':
+ case '}':
+ /* is this the last line of an enum declaration? */
+ if (count == 0)
+ {
+ /* Put back the token we just read so's we can find it again
+ after registering the expression. */
+ unput(token);
+
+ lexstate = ST_NORMAL;
+ token = EXPRESSION_PHRASE;
+ break;
+ }
+ /* FALLTHRU */
+ case ')': case ']':
--count;
APP;
goto repeat;