pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
MSVC compilers complain about snprintf
4+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2018-11-11 7f284debaf  Disable MSVC warning caused by recent snprintf.c changes
* MSVC compilers complain about snprintf
@ 2018-10-17 21:27 Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2018-10-17 21:31 ` Re: MSVC compilers complain about snprintf Andres Freund <andres@anarazel.de>
  2018-10-17 22:11 ` Re: MSVC compilers complain about snprintf Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Andrew Dunstan @ 2018-10-17 21:27 UTC (permalink / raw)
  To: pgsql-hackers


The MSVC compilers are whingeing about recent changes in snprintf.c:


    src\port\snprintf.c(1051): warning C4146: unary minus operator
    applied to unsigned type, result still unsigned


The line in question reads:

    uvalue = -(unsigned long long) value;

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: MSVC compilers complain about snprintf
  2018-10-17 21:27 MSVC compilers complain about snprintf Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2018-10-17 21:31 ` Andres Freund <andres@anarazel.de>
  2018-10-17 22:09   ` Re: MSVC compilers complain about snprintf Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Andres Freund @ 2018-10-17 21:31 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: pgsql-hackers

Hi,

On 2018-10-17 17:27:14 -0400, Andrew Dunstan wrote:
> 
> The MSVC compilers are whingeing about recent changes in snprintf.c:
> 
> 
>    src\port\snprintf.c(1051): warning C4146: unary minus operator
>    applied to unsigned type, result still unsigned
> 
> 
> The line in question reads:
> 
>    uvalue = -(unsigned long long) value;

Yea, that's intended. Is there a way to silence that one, but just keep
the code largely similar?

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: MSVC compilers complain about snprintf
  2018-10-17 21:27 MSVC compilers complain about snprintf Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2018-10-17 21:31 ` Re: MSVC compilers complain about snprintf Andres Freund <andres@anarazel.de>
@ 2018-10-17 22:09   ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew Dunstan @ 2018-10-17 22:09 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-hackers



On 10/17/2018 05:31 PM, Andres Freund wrote:
> Hi,
>
> On 2018-10-17 17:27:14 -0400, Andrew Dunstan wrote:
>> The MSVC compilers are whingeing about recent changes in snprintf.c:
>>
>>
>>     src\port\snprintf.c(1051): warning C4146: unary minus operator
>>     applied to unsigned type, result still unsigned
>>
>>
>> The line in question reads:
>>
>>     uvalue = -(unsigned long long) value;
> Yea, that's intended. Is there a way to silence that one, but just keep
> the code largely similar?


Probably something like:

    #if (_MSC_VER >= 1800)
    #pragma warning(disable:4146)
    #endif


based on float.h.



cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: MSVC compilers complain about snprintf
  2018-10-17 21:27 MSVC compilers complain about snprintf Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2018-10-17 22:11 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2018-10-17 22:11 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: pgsql-hackers

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> The MSVC compilers are whingeing about recent changes in snprintf.c:
>     src\port\snprintf.c(1051): warning C4146: unary minus operator
>     applied to unsigned type, result still unsigned

Yeah, see commit 4868e4468590bc32f9c3afed4ec795d6a7732c9d.

The law of conservation of warning messages seems to be at work :-(

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2018-10-17 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17 21:27 MSVC compilers complain about snprintf Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2018-10-17 21:31 ` Andres Freund <andres@anarazel.de>
2018-10-17 22:09   ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2018-10-17 22:11 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox