Thread: Warning compiling pg_dump (MinGW, Windows XP)

Warning compiling pg_dump (MinGW, Windows XP)

From
Pavel Golub
Date:
Hello, Pgsql-hackers.

I'm getting such warnings:

pg_dump.c: In function 'dumpSequence':
pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
pg_dump.c:11449:2: warning: too many arguments for format
pg_dump.c:11450:2: warning: unknown conversion type character 'l' in format
pg_dump.c:11450:2: warning: too many arguments for format

Line numbers my not be the same in the official sources, because I've
made some changes. But the lines are:
       snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);       snprintf(bufx, sizeof(bufx), INT64_FORMAT,
SEQ_MAXVALUE);

In my oppinion configure failed for MinGw+Windows in this case. Am I
right? Can someone give me a hint how to avoid this?

Thanks in advance

-- 
With best wishes,Pavel                          mailto:pavel@gf.microolap.com



Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Robert Haas
Date:
2011/1/13 Pavel Golub <pavel@microolap.com>:
> Hello, Pgsql-hackers.
>
> I'm getting such warnings:
>
> pg_dump.c: In function 'dumpSequence':
> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
> pg_dump.c:11449:2: warning: too many arguments for format
> pg_dump.c:11450:2: warning: unknown conversion type character 'l' in format
> pg_dump.c:11450:2: warning: too many arguments for format
>
> Line numbers my not be the same in the official sources, because I've
> made some changes. But the lines are:
>
>        snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
>        snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
>
> In my oppinion configure failed for MinGw+Windows in this case. Am I
> right? Can someone give me a hint how to avoid this?

It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
wrong answer on your machine, though I'm not sure why.  The easiest
workaround is probably to run configure and then edit
src/include/pg_config.h before compiling.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Pavel Golub
Date:
Hello, Robert.

You wrote:

RH> 2011/1/13 Pavel Golub <pavel@microolap.com>:
>> Hello, Pgsql-hackers.
>>
>> I'm getting such warnings:
>>
>> pg_dump.c: In function 'dumpSequence':
>> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
>> pg_dump.c:11449:2: warning: too many arguments for format
>> pg_dump.c:11450:2: warning: unknown conversion type character 'l' in format
>> pg_dump.c:11450:2: warning: too many arguments for format
>>
>> Line numbers my not be the same in the official sources, because I've
>> made some changes. But the lines are:
>>
>>        snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
>>        snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
>>
>> In my oppinion configure failed for MinGw+Windows in this case. Am I
>> right? Can someone give me a hint how to avoid this?

RH> It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
RH> wrong answer on your machine, though I'm not sure why.  The easiest
RH> workaround is probably to run configure and then edit
RH> src/include/pg_config.h before compiling.

Thanks Robert. What value should I enter for this option?




-- 
With best wishes,Pavel                          mailto:pavel@gf.microolap.com



Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Andrew Dunstan
Date:

On 01/17/2011 05:54 AM, Pavel Golub wrote:
> Hello, Robert.
>
> You wrote:
>
> RH>  2011/1/13 Pavel Golub<pavel@microolap.com>:
>>> Hello, Pgsql-hackers.
>>>
>>> I'm getting such warnings:
>>>
>>> pg_dump.c: In function 'dumpSequence':
>>> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
>>> pg_dump.c:11449:2: warning: too many arguments for format
>>> pg_dump.c:11450:2: warning: unknown conversion type character 'l' in format
>>> pg_dump.c:11450:2: warning: too many arguments for format
>>>
>>> Line numbers my not be the same in the official sources, because I've
>>> made some changes. But the lines are:
>>>
>>>         snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
>>>         snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
>>>
>>> In my oppinion configure failed for MinGw+Windows in this case. Am I
>>> right? Can someone give me a hint how to avoid this?
> RH>  It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
> RH>  wrong answer on your machine, though I'm not sure why.  The easiest
> RH>  workaround is probably to run configure and then edit
> RH>  src/include/pg_config.h before compiling.
>
> Thanks Robert. What value should I enter for this option?



Mingw has always had a huge number of format warnings. See for example 
<http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-17%2007%3A30%3A00&stg=make>

If someone wants to fix them that would be good, but I'm not sure it's a 
simple task. There's probably some discussion of it in the archives back 
when we first did the Windows port.

cheers

andrew


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Pavel Golub
Date:
Hello, Andrew.

You wrote:



AD> On 01/17/2011 05:54 AM, Pavel Golub wrote:
>> Hello, Robert.
>>
>> You wrote:
>>
>> RH>  2011/1/13 Pavel Golub<pavel@microolap.com>:
>>>> Hello, Pgsql-hackers.
>>>>
>>>> I'm getting such warnings:
>>>>
>>>> pg_dump.c: In function 'dumpSequence':
>>>> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
>>>> pg_dump.c:11449:2: warning: too many arguments for format
>>>> pg_dump.c:11450:2: warning: unknown conversion type character 'l' in format
>>>> pg_dump.c:11450:2: warning: too many arguments for format
>>>>
>>>> Line numbers my not be the same in the official sources, because I've
>>>> made some changes. But the lines are:
>>>>
>>>>         snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
>>>>         snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
>>>>
>>>> In my oppinion configure failed for MinGw+Windows in this case. Am I
>>>> right? Can someone give me a hint how to avoid this?
>> RH>  It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
>> RH>  wrong answer on your machine, though I'm not sure why.  The easiest
>> RH>  workaround is probably to run configure and then edit
>> RH>  src/include/pg_config.h before compiling.
>>
>> Thanks Robert. What value should I enter for this option?



AD> Mingw has always had a huge number of format warnings. See for example
AD> <http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-17%2007%3A30%3A00&stg=make>

So you think I should just ignore these warnings? Because I can't
remember the same behaviour on 8.x branches...

AD> If someone wants to fix them that would be good, but I'm not sure it's a
AD> simple task. There's probably some discussion of it in the archives back
AD> when we first did the Windows port.

AD> cheers

AD> andrew



-- 
With best wishes,Pavel                          mailto:pavel@gf.microolap.com



Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Robert Haas
Date:
On Mon, Jan 17, 2011 at 5:54 AM, Pavel Golub <pavel@microolap.com> wrote:
> RH> It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
> RH> wrong answer on your machine, though I'm not sure why.  The easiest
> RH> workaround is probably to run configure and then edit
> RH> src/include/pg_config.h before compiling.
>
> Thanks Robert. What value should I enter for this option?

Not sure.  I notice that the configure test has this comment:

# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
# ---------------------------------------
# Determine which format snprintf uses for long long int.  We handle
# %lld, %qd, %I64d.  The result is in shell variable
# LONG_LONG_INT_FORMAT.
#
# MinGW uses '%I64d', though gcc throws an warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.
#

...and the values the test actually tries are:

%lld
%qd
%I64d

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Andrew Dunstan
Date:

On 01/17/2011 07:18 AM, Pavel Golub wrote:
>
> AD>  Mingw has always had a huge number of format warnings. See for example
> AD>  <http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-17%2007%3A30%3A00&stg=make>
>
> So you think I should just ignore these warnings? Because I can't
> remember the same behaviour on 8.x branches...
>
>

We've had them all along, as I said. See 
<http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-04%2023%3A54%3A16&stg=make> 
for the same thing in an 8.2 build.

cheers

andre


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Tom Lane
Date:
Robert Haas <robertmhaas@gmail.com> writes:
> 2011/1/13 Pavel Golub <pavel@microolap.com>:
>> pg_dump.c: In function 'dumpSequence':
>> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
>> pg_dump.c:11449:2: warning: too many arguments for format

> It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
> wrong answer on your machine, though I'm not sure why.

That configure check tests whether snprintf produces the right result at
runtime.  It doesn't check whether the compiler will generate a warning
about it.  It looks to me like Pavel has a compiler that is out of sync
with his libc; which is a platform configuration mistake that he needs
to fix.

Another possibility is that configure chose to not use the system
snprintf at all, in which case %lld is the correct syntax to use but gcc
might well have some different expectation.  Without seeing the
config.log results it's hard to be sure about that one; but in any case
it's hard to credit that there are any modern machines where snprintf
can't handle long long int, so this still suggests a platform problem.
        regards, tom lane


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> On 01/17/2011 07:18 AM, Pavel Golub wrote:
>> So you think I should just ignore these warnings? Because I can't
>> remember the same behaviour on 8.x branches...

> We've had them all along, as I said. See 
> <http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-04%2023%3A54%3A16&stg=make> 
> for the same thing in an 8.2 build.

I wonder why mingw's gcc is complaining about %m when other versions of
gcc do not?  If you can't get it to shut up about that, there's not
going to be much percentage in silencing warnings about %lld.
        regards, tom lane


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Andrew Dunstan
Date:

On 01/17/2011 03:51 PM, Tom Lane wrote:
> Andrew Dunstan<andrew@dunslane.net>  writes:
>> On 01/17/2011 07:18 AM, Pavel Golub wrote:
>>> So you think I should just ignore these warnings? Because I can't
>>> remember the same behaviour on 8.x branches...
>> We've had them all along, as I said. See
>> <http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-04%2023%3A54%3A16&stg=make>
>> for the same thing in an 8.2 build.
> I wonder why mingw's gcc is complaining about %m when other versions of
> gcc do not?  If you can't get it to shut up about that, there's not
> going to be much percentage in silencing warnings about %lld.
>
>             

We could add -Wno-format to the flags. That makes it shut up, but maybe 
we don't want to use such a sledgehammer.

cheers

andrew


Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Pavel Golub
Date:
Hello, Tom.

You wrote:

TL> Robert Haas <robertmhaas@gmail.com> writes:
>> 2011/1/13 Pavel Golub <pavel@microolap.com>:
>>> pg_dump.c: In function 'dumpSequence':
>>> pg_dump.c:11449:2: warning: unknown conversion type character 'l' in format
>>> pg_dump.c:11449:2: warning: too many arguments for format

>> It seems like PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT is getting the
>> wrong answer on your machine, though I'm not sure why.

TL> That configure check tests whether snprintf produces the right result at
TL> runtime.  It doesn't check whether the compiler will generate a warning
TL> about it.  It looks to me like Pavel has a compiler that is out of sync
TL> with his libc; which is a platform configuration mistake that he needs
TL> to fix.

The thing is that for this test I used a clean virtual machine under
WinXP with only one MinGW + MSYS installed.

TL> Another possibility is that configure chose to not use the system
TL> snprintf at all, in which case %lld is the correct syntax to use but gcc
TL> might well have some different expectation.  Without seeing the
TL> config.log results it's hard to be sure about that one; but in any case
TL> it's hard to credit that there are any modern machines where snprintf
TL> can't handle long long int, so this still suggests a platform problem.

config.log attached

TL>                         regards, tom lane



--
With best wishes,
 Pavel                          mailto:pavel@gf.microolap.com
Attachment

Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Pavel Golub
Date:
Hello, Andrew.

You wrote:



AD> On 01/17/2011 03:51 PM, Tom Lane wrote:
>> Andrew Dunstan<andrew@dunslane.net>  writes:
>>> On 01/17/2011 07:18 AM, Pavel Golub wrote:
>>>> So you think I should just ignore these warnings? Because I can't
>>>> remember the same behaviour on 8.x branches...
>>> We've had them all along, as I said. See
>>> <http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=frogmouth&dt=2011-01-04%2023%3A54%3A16&stg=make>
>>> for the same thing in an 8.2 build.
>> I wonder why mingw's gcc is complaining about %m when other versions of
>> gcc do not?  If you can't get it to shut up about that, there's not
>> going to be much percentage in silencing warnings about %lld.
>>
>>                       

AD> We could add -Wno-format to the flags. That makes it shut up, but maybe
AD> we don't want to use such a sledgehammer.

I want to understand the only thing. Are these warnings really
dangerous? Or I should just ignore them?

AD> cheers

AD> andrew



-- 
With best wishes,Pavel                          mailto:pavel@gf.microolap.com



Re: Warning compiling pg_dump (MinGW, Windows XP)

From
Andrew Dunstan
Date:

On 01/18/2011 04:40 AM, Pavel Golub wrote:
>
> AD>  We could add -Wno-format to the flags. That makes it shut up, but maybe
> AD>  we don't want to use such a sledgehammer.
>
> I want to understand the only thing. Are these warnings really
> dangerous? Or I should just ignore them?
>
>


As I pointed out previously, we have had these warnings for years and 
years. I am not aware of a single issue that has been reported as 
arising from them.

cheers

andrew