diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2011-04-25 09:10:59 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2011-04-25 09:10:59 -0400 |
commit | 08a0c2dabc3b9d59d72d7a79ed867b8e37d275a7 (patch) | |
tree | 55fc419c88f39317049c7507a8e762c323893a6e | |
parent | 5948a6eeaa682aeb1a8f389ae2136915b2a0e990 (diff) | |
download | postgresql-08a0c2dabc3b9d59d72d7a79ed867b8e37d275a7.tar.gz postgresql-08a0c2dabc3b9d59d72d7a79ed867b8e37d275a7.zip |
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.
-rwxr-xr-x | src/tools/msvc/pgflex.bat | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/msvc/pgflex.bat b/src/tools/msvc/pgflex.bat index da7c33d7af2..58870f05121 100755 --- a/src/tools/msvc/pgflex.bat +++ b/src/tools/msvc/pgflex.bat @@ -25,9 +25,19 @@ if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c echo Unknown flex input: %1 exit 1 +REM For non-reentrant scanners we need to fix up the yywrap macro definition +REM to keep the MS compiler happy. +REM For reentrant scanners (like the core scanner) we do not +REM need to (and must not) change the yywrap definition. :generate flex %3 -o%2 %1 -exit %errorlevel% +if errorlevel 1 exit %errorlevel% +perl -n -e "exit 1 if /^\%%option\s+reentrant/;" %1 +if errorlevel 1 exit 0 +perl -pi.bak -e "s/yywrap\(n\)/yywrap()/;" %2 +if errorlevel 1 exit %errorlevel% +del %2.bak +exit 0 :noflex echo WARNING! flex install not found, attempting to build without |