kconfig: don't silently ignore unhandled characters
PATCH 1/2 kconfig: don't silently ignore unhandled characters
At the very least we should tell people that waht they wrote is not what the utility understands.
--- scripts/kconfig/zconf.l | 6 - scripts/kconfig/zconf.lex.c_shipped | 194 +++++++++++++++++++----------------- 2 files changed, 111 insertions(+), 89 deletions(-)
scripts/kconfig/zconf.l +5 -1
@@ -141,7 +141,11 @@ n [A-Za-z0-9_] } #.* /* comment */ \\\n current_file->lineno++; - . + [[:blank:]]+ + . { + printf("%s:%d:warning: ignoring unsupported character '%c'\n", + zconf_curname(), zconf_lineno(), *yytext); + } <<EOF>> { BEGIN(INITIAL); }
scripts/kconfig/zconf.lex.c_shipped +106 -88
456 lines not on this page · raw message
Quoted 2 lines · Jan Beulich
At the very least we should tell people that waht they wrote is not what the utility understands.
Yes, we should change this. I'm inclined to think the should die with an error on invalid syntax. Would that be too strict?
Anyhow, seems to work as advertised:
$ make ARCH=arm menuconfig
[...]
sound/soc/intel/Kconfig:40:warning: ignoring unsupported character '\'
sound/soc/intel/Kconfig:70:warning: ignoring unsupported character '\'
arch/arm/Kconfig.debug:1268:warning: ignoring unsupported character '>'The soc/intel warnings are for doubled line continuations! You've earned a Reported-by:, I guess.
Quoted 9 lines
Signed-off-by Jan Beulich <[email protected]>--- scripts/kconfig/zconf.l | 6 - scripts/kconfig/zconf.lex.c_shipped | 194 +++++++++++++++++++----------------- 2 files changed, 111 insertions(+), 89 deletions(-)
scripts/kconfig/zconf.l n [A-Za-z0-9_] · line 146
Quoted 7 lines
scripts/kconfig/zconf.l +3
-1@@ -141,7 +141,11 @@ n [A-Za-z0-9_] } #.* /* comment */ \\\n current_file->lineno++; - . + [[:blank:]]+ + . { + printf("%s:%d:warning: ignoring unsupported character '%c'\n",
fprintf(stderr, [...]?
Quoted 16 lines
scripts/kconfig/zconf.l +2
-0+ zconf_curname(), zconf_lineno(), *yytext); + } <<EOF>> { BEGIN(INITIAL); }scripts/kconfig/zconf.lex.c_shipped +2
-2@@ -414,14 +414,14 @@ static yyconst flex_int16_t yy_nxt[][17] }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39
scripts/kconfig/zconf.lex.c_shipped static yyconst flex_int16_t yy_nxt[][17] · line 427
Quoted 10 lines
scripts/kconfig/zconf.lex.c_shipped +2
-2}, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39 }, {
I guess we must trust that you manually edited this _shipped file correctly.
scripts/kconfig/zconf.lex.c_shipped static int input (void ); · line 937
Quoted 10 lines
[...]
scripts/kconfig/zconf.lex.c_shipped +1
-1@@ -920,7 +931,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) +#define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
But this hunk looks unrelated. Is this needed?
Paul Bolle
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 15:06, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
At the very least we should tell people that waht they wrote is not what the utility understands.
Yes, we should change this. I'm inclined to think the should die with an error on invalid syntax. Would that be too strict?
I would think so. This could be made more strict once the warning was in place for a couple of releases.
Quoted 20 lines
Quoted 20 lines
scripts/kconfig/zconf.lex.c_shipped +4
-4@@ -414,14 +414,14 @@ static yyconst flex_int16_t yy_nxt[][17] }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39 }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39 },
Quoted 4 lines
scripts/kconfig/zconf.lex.c_shipped static yyconst flex_int16_t yy_nxt[][17] · line 427
Quoted 1 line
scripts/kconfig/zconf.lex.c_shipped +0
-0{I guess we must trust that you manually edited this
_shippedfile correctly.
There was no manual editing involved - this is the re-generated version.
Quoted 11 lines
scripts/kconfig/zconf.lex.c_shipped static int input (void ); · line 937
Quoted 9 lines
scripts/kconfig/zconf.lex.c_shipped +1
-1@@ -920,7 +931,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) +#define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,But this hunk looks unrelated. Is this needed?
I think it should stay, even if my flex version may be slightly different from the one that was used originally. As above - it's simply a result of re-generating.
Jan
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 15:06, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
scripts/kconfig/zconf.lex.c_shipped +1
-1@@ -920,7 +931,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) +#define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) #endif
Quoted 7 lines
Quoted 3 lines
scripts/kconfig/zconf.lex.c_shipped static int input (void ); · line 937
Quoted 1 line
scripts/kconfig/zconf.lex.c_shipped +0
-0/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,But this hunk looks unrelated. Is this needed?
I think it should stay, even if my flex version may be slightly different from the one that was used originally. As above - it's simply a result of re-generating.
(This annoyed me enough to dive a bit deeper. This message is mainly to archive my notes publicly.)
This #define was added in v3.1. See commit 2f76b358f9fb ("kconfig: regen parser"). Commit explanations were probably a bit expensive then since this is all the info we have: we don't know why this was done, nor how (which program, which options, etc.).
Anyhow, I don't think ECHO is used anywhere. grepping for ECHO in scripts/ finds dtc-lexer.lex.c_shipped, lex.lex.c_shipped, and this file. In the other two _shipped files ECHO is actually used. So, apparently it's not a bit of lex magic. The #define might as well be removed.
I personally wouldn't bother to add this hunk, but who cares.
Paul Bolle
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 05.11.14 at 11:36, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
I think it should stay, even if my flex version may be slightly different from the one that was used originally. As above - it's simply a result of re-generating.
(This annoyed me enough to dive a bit deeper. This message is mainly to archive my notes publicly.)
This #define was added in v3.1. See commit
2f76b358f9fb("kconfig: regen parser"). Commit explanations were probably a bit expensive then since this is all the info we have: we don't know why this was done, nor how (which program, which options, etc.).
Quoted 5 lines
Anyhow, I don't think ECHO is used anywhere. grepping for ECHO in
scripts/finds dtc-lexer.lex.c_shipped, lex.lex.c_shipped, and this file. In the other two_shippedfiles ECHO is actually used. So, apparently it's not a bit of lex magic. The #define might as well be removed.
Again - this is code that gets generated by flex, and hence dropping it (entirely, or the hunk that changes it) will make the discussion re-appear the next time someone re-generates the file.
Jan
Quoted 4 lines · Jan Beulich
Again - this is code that gets generated by flex, and hence dropping it (entirely, or the hunk that changes it) will make the discussion re-appear the next time someone re-generates the file.
My public note ended with:
Quoted 1 line
I personally wouldn't bother to add this hunk, but who cares.
I guess it wasn't clear that this meant that I think that the discussion, which I started of course, is basically moot.
Paul Bolle
Paul Bolle
Acked-byHi Jan,
Quoted 47 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 15:06, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
At the very least we should tell people that waht they wrote is not what the utility understands.
Yes, we should change this. I'm inclined to think the should die with an error on invalid syntax. Would that be too strict?
I would think so. This could be made more strict once the warning was in place for a couple of releases.
Quoted 20 lines
Quoted 20 lines
scripts/kconfig/zconf.lex.c_shipped +4
-4@@ -414,14 +414,14 @@ static yyconst flex_int16_t yy_nxt[][17] }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39 }, { - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32, - 33, 34, 35, 35, 36, 37, 38 + 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, + 34, 35, 36, 36, 37, 38, 39 },Quoted 4 lines
scripts/kconfig/zconf.lex.c_shipped static yyconst flex_int16_t yy_nxt[][17] · line 427
Quoted 1 line
scripts/kconfig/zconf.lex.c_shipped +0
-0{I guess we must trust that you manually edited this
_shippedfile correctly.There was no manual editing involved - this is the re-generated version.
Quoted 8 lines
Quoted 8 lines
scripts/kconfig/zconf.lex.c_shipped +1
-1@@ -920,7 +931,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) +#define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) #endif
Quoted 7 lines
Quoted 3 lines
scripts/kconfig/zconf.lex.c_shipped static int input (void ); · line 937
Quoted 1 line
scripts/kconfig/zconf.lex.c_shipped +0
-0/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,But this hunk looks unrelated. Is this needed?
I think it should stay, even if my flex version may be slightly different from the one that was used originally. As above - it's simply a result of re-generating.
It's been five weeks since you've sent this. I'm not aware of any other comments beside mine. Here's what I'd suggest to get things moving:
Resend these patches. Don't bother sending to Yann, that's pointless. Do include lkml. Perhaps also include Michal Marek and/or Andrew Morton:
one of them might handle these patches. Who knows...
For 1/2 feel free to add
_provided_ you change the printf([...]) to a fprintf(stderr, [...]). It would be nice if you'd added a note about the flex version and the command line used to regenerate the _shipped file, maybe even in the commit explanation.
Note that I tested patch 1/2 on top of next-20141208 for all current defconfigs (see https://lkml.org/lkml/2014/12/8/587 how I did that). No .config was changed, which was what I expected.
For 2/2 don't forget to remove those development printf()s. I haven't yet looked at that patch closely or even tested it. Perhaps I'll actually manage to do that after you resend it.
Paul Bolle
Hi Paul,
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 09.12.14 at 11:16, <[email protected]> wrote:
It's been five weeks since you've sent this. I'm not aware of any other comments beside mine. Here's what I'd suggest to get things moving:
Resend these patches.
I guess I'll do this as soon as I got to merge my patch queue onto 3.19-rc, i.e. hopefully early next year.
Quoted 8 lines
Don't bother sending to Yann, that's pointless. Do
include lkml. Perhaps also include Michal Marek and/or Andrew Morton:
one of them might handle these patches. Who knows...For 1/2 feel free to add
Acked-by Paul Bolle <[email protected]>_provided_ you change the
printf([...])to afprintf(stderr, [...]).
While I can do that, this will end up being inconsistent with all other code in zconf.l - it's all using printf(). I therefore think this would better be another patch changing all of them info fprintf(stderr, ).
Jan