Skip to content

Commit 2c48838

Browse files
committed
Add options nounistd & never-interactive to seclang-scanner.ll
- The parser is not used interactively so we can avoid including unistd.h, which is not available on Windows MSVC C++ compiler. - The #ifdef WIN32 introduced in PR owasp-modsecurity#3132 would probably be overwritten when the parser is updated.
1 parent 124a434 commit 2c48838

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/parser/seclang-scanner.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,13 +4900,14 @@ static std::stack<int> YY_PREVIOUS_STATE;
49004900
// The location of the current token.
49014901
#line 4902 "seclang-scanner.cc"
49024902
#define YY_NO_INPUT 1
4903+
#define YY_NO_UNISTD_H 1
49034904

49044905
#line 494 "seclang-scanner.ll"
49054906
// Code run each time a pattern is matched.
49064907
# define YY_USER_ACTION driver.loc.back()->columns (yyleng);
49074908

4908-
#line 4909 "seclang-scanner.cc"
49094909
#line 4910 "seclang-scanner.cc"
4910+
#line 4911 "seclang-scanner.cc"
49104911

49114912
#define INITIAL 0
49124913
#define EXPECTING_ACTION_PREDICATE_VARIABLE 1
@@ -4952,11 +4953,7 @@ static std::stack<int> YY_PREVIOUS_STATE;
49524953
* The user has a chance to override it with an option.
49534954
*/
49544955
/* %if-c-only */
4955-
#ifndef WIN32
49564956
#include <unistd.h>
4957-
#else
4958-
#include <io.h>
4959-
#endif
49604957
/* %endif */
49614958
/* %if-c++-only */
49624959
/* %endif */
@@ -5232,7 +5229,7 @@ YY_DECL
52325229
// Code run each time yylex is called.
52335230
driver.loc.back()->step();
52345231

5235-
#line 5232 "seclang-scanner.cc"
5232+
#line 5233 "seclang-scanner.cc"
52365233

52375234
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
52385235
{
@@ -8338,7 +8335,7 @@ YY_RULE_SETUP
83388335
#line 1340 "seclang-scanner.ll"
83398336
ECHO;
83408337
YY_BREAK
8341-
#line 8338 "seclang-scanner.cc"
8338+
#line 8339 "seclang-scanner.cc"
83428339

83438340
case YY_END_OF_BUFFER:
83448341
{
@@ -8960,7 +8957,7 @@ static void yy_load_buffer_state (void)
89608957

89618958
/* %if-c-only */
89628959

8963-
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
8960+
b->yy_is_interactive = 0;
89648961

89658962
/* %endif */
89668963
/* %if-c++-only */

src/parser/seclang-scanner.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static std::stack<int> YY_PREVIOUS_STATE;
7373

7474
// The location of the current token.
7575
%}
76-
%option noyywrap nounput batch debug noinput
76+
%option noyywrap nounput batch debug noinput nounistd never-interactive
7777

7878

7979

0 commit comments

Comments
 (0)