]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Avoid inclusion of unistd.h in generated lexers
authorTobias Brunner <tobias@strongswan.org>
Mon, 22 Oct 2018 08:38:53 +0000 (10:38 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 22 Nov 2018 10:17:35 +0000 (11:17 +0100)
Because the file is not available on all platforms the inclusion comes
after the user options in order to disable including it.  But that means
the inclusion also follows after the defined scanner states, which are
generated as simple #defines to numbers.  If the included unistd.h e.g.
uses variables in function definitions with the same names this could
result in compilation errors.

Interactive mode has to be disabled too as it relies on isatty() from
unistd.h.  Since we don't use the scanners interactively, this is not a
problem and might even make the scanners a bit faster.

Fixes #2806.

src/libstrongswan/settings/settings_lexer.l
src/starter/parser/lexer.l

index 19ab8d7b281b41a83b47ce1030d17d20d847157a..e8c2b9884b96fb2506ee93f54e3061daae9e2a03 100644 (file)
@@ -32,6 +32,11 @@ static void include_files(parser_helper_t *ctx);
 /* do not declare unneeded functions */
 %option noinput noyywrap
 
+/* do not include unistd.h as it might conflict with our scanner states */
+%option nounistd
+/* due to that disable interactive mode, which requires isatty() */
+%option never-interactive
+
 /* don't use global variables, and interact properly with bison */
 %option reentrant bison-bridge
 
index fb23a0f9316b28a5ddb70c5133c2e3100d45bf5b..b81d6ce74deaefd4e7096a820d8267f1a00cc57e 100644 (file)
@@ -33,6 +33,11 @@ static void include_files(parser_helper_t *ctx);
 /* do not declare unneeded functions */
 %option noinput noyywrap
 
+/* do not include unistd.h as it might conflict with our scanner states */
+%option nounistd
+/* due to that disable interactive mode, which requires isatty() */
+%option never-interactive
+
 /* don't use global variables, and interact properly with bison */
 %option reentrant bison-bridge