Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>, Jonathan Allen <jallen(at)americansavingslife(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Michael Meskes <meskes(at)postgresql(dot)org>, Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Date: 2018-05-19 22:49:20
Message-ID: 22529.1526770160@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 05/19/2018 12:45 PM, Tom Lane wrote:
>> However ... we've got a ton of other places that use INT64_FORMAT with
>> the native printf, eg in pgbench, and frogmouth is not producing
>> warnings about those usages. So I'm confused about exactly what is
>> happening there. Andrew, do you have any insight?

> Very occasionally ;-)

> A little Googling suggested that __USE_MINGW_ANSI_STDIO might help.
> Here's what happened

> $ gcc -Wall -o testme testme.c
> testme.c: In function 'main':
> testme.c:7:5: warning: unknown conversion type character 'l' in format
> testme.c:7:5: warning: too many arguments for format

> $ ./testme
> sizeof long long = 8
> val = 734294471 (%lld) 3153770738837321131 (%I64d)

Yeah, this agrees with what we're seeing in the ecpg test failures, both
as to the warning and the wrong run-time answer. What remains unexplained
is why we don't see the same compile-time warning for uses of
printf("%lld") elsewhere in the build.

> $ gcc -Wall -D__USE_MINGW_ANSI_STDIO -o testme testme.c

[ works as expected ]

> So maybe we just need to define this on XP/mingw (shouldn't be necessary
> on anything later). I don't know what other effects it might have,
> though. Perhaps there is some other flag or define that has the same
> effect that we use in compiling pgbench etc that isn't used by ecpg?

Might be worth trying. As I mentioned in
<13103(dot)1526749980(at)sss(dot)pgh(dot)pa(dot)us>, it seems like it's time to jettison
any pretense of support for non-C99-compliant spellings of "%lld".
It'd be good to know whether __USE_MINGW_ANSI_STDIO works for that
purpose on ancient MinGW.

> Now recall that this animal is on serious life support. ...
> Not sure how much more effort I should put in here.

I couldn't blame you for just deciding to skip the ecpg tests on
this critter.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Dunstan 2018-05-19 23:23:18 Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Previous Message Andrew Dunstan 2018-05-19 22:34:26 Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT