Skip to content

Commit 08a0c2d

Browse files
committed
Adjust yywrap macro for non-reentrant scanners for MSVC.
The MSVC compiler complains if a macro is called with less arguments than its definition provides for. flex generates a macro with one argument for yywrap, but only supplies the argument for reentrant scanners, so we remove the useless argument in the non-reentrant case to silence the warning.
1 parent 5948a6e commit 08a0c2d

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
exit 1
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+
if errorlevel 1 exit %errorlevel%
35+
perl -n -e "exit 1 if /^\%%option\s+reentrant/;" %1
36+
if errorlevel 1 exit 0
37+
perl -pi.bak -e "s/yywrap\(n\)/yywrap()/;" %2
38+
if errorlevel 1 exit %errorlevel%
39+
del %2.bak
40+
exit 0
3141

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy