Re: MinGW compiler warnings in ecpg tests - Mailing list pgsql-hackers

From Tom Lane
Subject Re: MinGW compiler warnings in ecpg tests
Date
Msg-id 2530095.1733411471@sss.pgh.pa.us
Whole thread Raw
In response to MinGW compiler warnings in ecpg tests  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: MinGW compiler warnings in ecpg tests
List pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> Yeah.  This warning is visible on CI, and on fairywren since its MSYS2
> upgrade a couple of months ago.  Old MinGW didn't like %lld (I think
> perhaps the printf from msvcrt.dll from 1996 didn't like it and MinGW
> knew that), but new MinGW doesn't like %I64d (that's interesting, but
> not relevant here because %lld is clearly the correct format string,
> and it works).  We should just revert that change.  Here's a patch.

+1

> Those were there before the upgrade.  POSIX says that environ should
> not be declared by a header, but Windows apparently declares it, or at
> least its cousin _environ, in <stdlib.h> which we include in c.h.  I
> have no idea why Visual Studio doesn't warn, or why the documentation
> only tells you about _environ and not environ, or where the macro (?)
> comes from that renames it, but it passes CI and is
> warning-free on both toolchains if you just hide the offending
> declarations.

Isn't this likely to break things for every other Windows toolchain?
I think the concept might be OK, but we need a tighter #if condition.

An alternative could be to add the missing dllimport on Windows;
it's not clear whether other toolchains would care.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: doc: Mention clock synchronization recommendation for hot_standby_feedback
Next
From: Robert Haas
Date:
Subject: Re: Proposal: Role Sandboxing for Secure Impersonation