Re: A few warnings on Windows

Поиск
Список
Период
Сортировка
Искать
От
Michael Paquier
Тема
Re: A few warnings on Windows
Дата
в 11:30:26
Msg-id
20180501083026.GB25848@paquier.xyz
Ответ на
Список
Дерево обсуждения
A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Michael Paquier <michael@paquier.xyz>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Michael Paquier <michael@paquier.xyz>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Christian Ullrich <chris@chrullrich.net>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
Re: A few warnings on Windows Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: A few warnings on Windows Thomas Munro <thomas.munro@enterprisedb.com>
Re: A few warnings on Windows Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: A few warnings on Windows Andres Freund <andres@anarazel.de>
Re: A few warnings on Windows Tom Lane <tgl@sss.pgh.pa.us>
On Tue, May 01, 2018 at 05:40:18PM +1200, Thomas Munro wrote:
> src/backend/replication/basebackup.c(1470): warning C4146: unary minus
> operator applied to unsigned type, result still unsigned
> 
> Yeah, we have: if (fseek(fp, -(cnt - BLCKSZ * i), SEEK_CUR) == -1)
> 
> ... where cnt is size_t.  Perhaps we should use (or cast to) off_t?

Sounds sensible.

> src/bin/pgbench/pgbench.c(971): warning C4307: '*' : integral constant
> overflow [C:\buildfarm\buildenv\HEAD\pgsql.build\pgbench.vcxproj]
> 
> We have:     uint64      result = seed ^ (sizeof(int64) * MM2_MUL);
> 
> ... where MM2_MUL is a UINT64CONST.  I checked the upstream source of
> this code and it's using a runtime multiplicand while here it's a
> constant so the compiler sees the overflow.  I suppose we could make
> the warning go away by just defining a constant (which I make out to
> be 0x35253c9ade8f4ca8).

Or just enforce it with some casts?

> C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\stdbool.h(11): warning C4005: 'false' : macro
> redefinition [C:\buildfarm\buildenv\HEAD\pgsql.build\jsonb_plperl.vcxproj]
>           c:\buildfarm\buildenv\head\pgsql.build\src\include\c.h(283)
> : see previous definition of 'false'
> C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\stdbool.h(12): warning C4005: 'true' : macro
> redefinition [C:\buildfarm\buildenv\HEAD\pgsql.build\jsonb_plperl.vcxproj]
>           c:\buildfarm\buildenv\head\pgsql.build\src\include\c.h(279)
> : see previous definition of 'true'

Those are caused by the interactions of stdbool.h from MSVC and the
definitions from c.h.  I am pretty sure that there is an unnecessary
double-inclusion happening in the perl scripts of src/tools/msvc, but I
did not take the time to dig into it, and it happens that they are
actually harmless if you look at what msvc ships as definition of true
and false.
--
Michael
В списке pgsql-hackers по дате отправления
От: Craig Ringer
Дата:
От: Amit Langote
Дата:
FAQ