Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08a0c2d

Browse files
committed
Adjust yywrap macro for non-reentrant scanners for MSVC.
The MSVC compiler complains if a macro is called with less argumentsthan its definition provides for. flex generates a macro with oneargument for yywrap, but only supplies the argument for reentrantscanners, so we remove the useless argument in the non-reentrantcase to silence the warning.
1 parent5948a6e commit08a0c2d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/tools/msvc/pgflex.bat

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,19 @@ if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c
2525
echo Unknown flex input:%1
2626
exit1
2727

28+
REM For non-reentrant scanners we need to fix up the yywrap macro definition
29+
REM to keep the MS compiler happy.
30+
REM For reentrant scanners (like the core scanner) we do not
31+
REM need to (and must not) change the yywrap definition.
2832
:generate
2933
flex%3 -o%2%1
30-
exit%errorlevel%
34+
iferrorlevel1exit%errorlevel%
35+
perl -n -e"exit 1 if /^\%%option\s+reentrant/;"%1
36+
iferrorlevel1exit0
37+
perl -pi.bak -e"s/yywrap\(n\)/yywrap()/;"%2
38+
iferrorlevel1exit%errorlevel%
39+
del%2.bak
40+
exit0
3141

3242
:noflex
3343
echo WARNING! flex install not found, attempting to build without

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp