-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning "-s option given but default rule can be matched" #1338
Comments
Hi @tdy91, This warning was bugging me for several months on both Linux and Windows installation. Thank you for taking your time to troubleshoot it and providing a fix 👍 I am wondering if there is anybody else who can comment in this issue? I do not have experience with flex and can not comment on possible side effects on suppressing this warning. Depending on feedback I think we should apply it in master. |
Hi @krzychb I am just beginning on esp-idf and don't like to see an icon error in Eclipse, mostly on very simple Hello-World project; it was bugging me too ! I do not have experience with flex too, but with ANTLR with is another parser generator using a similar lexical analyzer. Trying to find a solution, I found this answer to the same warning on another project : Source : https://stackoverflow.com/questions/1622493/bison-build-warning-s-option-given-but-default-rule-can-be-matched The "flex" command on your system could have been aliased to be the flex command with an -s option. That could occur in any of several startup scripts. The warning is telling you that there are some inputs that aren't matched by any of the rules in your input file. The warning is there to get you to make sure you have considered all cases in your regular expressions. If you truly want the default rule to be used, then add it to the end of the rules in your input file. Try adding the rules . ECHO; I'm also suspicious of the "-" symbol in the character class. It is supposed to be a range operator, but it may work as a character in the first position as you have it. I don't know. It might be a good idea to use "-" instead. You could change the last rule to . { printf("lex Unknown character = '%s'", yytext); yyerror("lex Unknown character"); } My own analysis is following one :
So, from my point of view, to use flex, you have :
In fact, this is just a flex warning, not an error, and as we are not debugging kconfig, but developping esp-idf projects, my own opinion is that suppressing "nodefault" option from zconf.l will have no side effects, but another feedback may be preferable before applying this solution in master. |
Very nice explanation, thanks @tdy91 ! Sure enough Windows system is also cured with your fix 🏅 For other people reading, this issue looks as below: I found it very distractive to see an icon error in Eclipse, while actually there are no any errors! You can stop the build from Eclipse and start it again to remove it. The fix identified by @tdy91 does not require any artificial treatment like that. |
Building esp-idf hello-world template, after a "make clean", the first "make all" generates the
warning "-s option given but default rule can be matched" .
This warning appears as an error in Eclipse, even though the compilation succeed.
This warning is generated by flex :
flex -L -P zconf -o zconf.lex.c zconf.l
zconf.l:256: warning, -s option given but default rule can be matched.
I think it is because in esp-idf/tools/kconfig/zconf.l file, there is option nodefault on line 2 (which is the same as specifying "-s" flex command line option) :
Line 2 : %option 8bit nodefault perf-report perf-report
but there is also a defaut rule "." specified on line 97 :
. {
unput(yytext[0]);
BEGIN(COMMAND);
}
The solution seems to be to suppress nodefault option on line 2 if a default rule is defined.
Line 2 : %option 8bit perf-report perf-report
This suppress the warning.
The text was updated successfully, but these errors were encountered: