Re: windows consolidated cleanup

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: windows consolidated cleanup
Date: 2011-04-24 19:40:25
Message-ID: 4DB47CA9.3040801@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/24/2011 09:11 AM, Andrew Chernow wrote:
> On 4/24/2011 1:29 AM, Andrew Dunstan wrote:
>>
>> The attached patch is intended to clean up a bunch of compiler
>> warnings seen on
>> Windows due to mismatches of signedness or constness, unused variables,
>> redefined macros and a missing prototype.
>>
>> It doesn't clean up all the warnings by any means, but it fixes quite
>> a few.
>>
>> One thing I'm a bit confused about is this type of warning:
>>
>> src\backend\utils\misc\guc-file.c(977): warning C4003: not enough actual
>> parameters for macro 'GUC_yywrap'
>>
>>
>> If someone can suggest a good fix That would be nice.
>>
>
> The macro is defined as taking one argument.
>
> // guc-file.c line 354
> #define GUC_yywrap(n) 1
>
> The macro is overriding the prototype declared at line 627, which has
> a void argument list (assuming YY_SKIP_YYWRAP is !defined). Since all
> code references to this do not provide an argument, I'd say the macro
> is incorrect.

Here's the fix that worked for me:

*** a/src/tools/msvc/pgflex.bat
--- b/src/tools/msvc/pgflex.bat
***************
*** 25,32 **** if "%1" == "contrib\seg\segscan.l" call :generate %1 contrib\seg\segscan.c
--- 25,38 ----
echo Unknown flex input: %1
exit 1

+ REM for non-reentrant scanners we need to fix up yywrap 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
+ if errorlevel 1 exit %errorlevel%
+ if not "%1" == "src\backend\parser\scan.l" perl -pi.bak -e "s/yywrap\(n\)/yywrap()/" %2
exit %errorlevel%
:noflex

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-04-24 21:10:16 Re: windows consolidated cleanup
Previous Message Greg Stark 2011-04-24 18:41:37 Re: Unlogged tables, persistent kind