aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/genksyms/lex.l
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2014-04-03 17:46:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:20:52 -0400
commitdc53324060f324e8af6867f57bf4891c13c6ef18 (patch)
tree8cad63d6b8b31d945dae80f0c18f1c2cb4ad0949 /scripts/genksyms/lex.l
parentd507816b58bebc8f9c1bed6a28affaf0729306e2 (diff)
genksyms: fix typeof() handling
Recent increased use of typeof() throughout the tree resulted in a number of symbols (25 in a typical distro config of ours) not getting a proper CRC calculated for them anymore, due to the parser in genksyms not coping with several of these uses (interestingly in the majority of [if not all] cases the problem is due to the use of typeof() in code preceding a certain export, not in the declaration/definition of the exported function/object itself; I wasn't able to find a way to address this more general parser shortcoming). The use of parameter_declaration is a little more relaxed than would be ideal (permitting not just a bare type specification, but also one with identifier), but since the same code is being passed through an actual compiler, there's no apparent risk of allowing through any broken code. Otoh using parameter_declaration instead of the ad hoc "decl_specifier_seq '*'" / "decl_specifier_seq" pair allows all types to be handled rather than just plain ones and pointers to plain ones. Signed-off-by: Jan Beulich <jbeulich@suse.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/genksyms/lex.l')
-rw-r--r--scripts/genksyms/lex.l51
1 files changed, 49 insertions, 2 deletions
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index f770071719cb..e583565f2011 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -129,8 +129,9 @@ int
129yylex(void) 129yylex(void)
130{ 130{
131 static enum { 131 static enum {
132 ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_BRACKET, ST_BRACE, 132 ST_NOTSTARTED, ST_NORMAL, ST_ATTRIBUTE, ST_ASM, ST_TYPEOF, ST_TYPEOF_1,
133 ST_EXPRESSION, ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4, 133 ST_BRACKET, ST_BRACE, ST_EXPRESSION,
134 ST_TABLE_1, ST_TABLE_2, ST_TABLE_3, ST_TABLE_4,
134 ST_TABLE_5, ST_TABLE_6 135 ST_TABLE_5, ST_TABLE_6
135 } lexstate = ST_NOTSTARTED; 136 } lexstate = ST_NOTSTARTED;
136 137
@@ -198,6 +199,10 @@ repeat:
198 lexstate = ST_ASM; 199 lexstate = ST_ASM;
199 count = 0; 200 count = 0;
200 goto repeat; 201 goto repeat;
202 case TYPEOF_KEYW:
203 lexstate = ST_TYPEOF;
204 count = 0;
205 goto repeat;
201 206
202 case STRUCT_KEYW: 207 case STRUCT_KEYW:
203 case UNION_KEYW: 208 case UNION_KEYW:
@@ -284,6 +289,48 @@ repeat:
284 } 289 }
285 break; 290 break;
286 291
292 case ST_TYPEOF:
293 switch (token)
294 {
295 case '(':
296 if ( ++count == 1 )
297 lexstate = ST_TYPEOF_1;
298 else
299 APP;
300 goto repeat;
301 case ')':
302 APP;
303 if (--count == 0)
304 {
305 lexstate = ST_NORMAL;
306 token = TYPEOF_PHRASE;
307 break;
308 }
309 goto repeat;
310 default:
311 APP;
312 goto repeat;
313 }
314 break;
315
316 case ST_TYPEOF_1:
317 if (token == IDENT)
318 {
319 if (is_reserved_word(yytext, yyleng)
320 || find_symbol(yytext, SYM_TYPEDEF, 1))
321 {
322 yyless(0);
323 unput('(');
324 lexstate = ST_NORMAL;
325 token = TYPEOF_KEYW;
326 break;
327 }
328 _APP("(", 1);
329 }
330 APP;
331 lexstate = ST_TYPEOF;
332 goto repeat;
333
287 case ST_BRACKET: 334 case ST_BRACKET:
288 APP; 335 APP;
289 switch (token) 336 switch (token)