Thread: mingw format warnings

mingw format warnings

From
Andrew Dunstan
Date:
We have had format warnings in mingw builds for years, and it doesn't 
look like we're ever going to do anything about them. Can we just add 
-Wno-format to the CFLAGS for Mingw and be done with them?

cheers

andrew


Re: mingw format warnings

From
Peter Eisentraut
Date:
On fre, 2011-01-28 at 14:12 -0500, Andrew Dunstan wrote:
> We have had format warnings in mingw builds for years, and it doesn't 
> look like we're ever going to do anything about them. Can we just add 
> -Wno-format to the CFLAGS for Mingw and be done with them?

I wasn't aware of this issue, but looking at the latest build log from
narwhal, I see only 4 format-related warnings, and they all look pretty
easy and desirable to fix.

The boatload of other warnings there is more puzzling ...



Re: mingw format warnings

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> We have had format warnings in mingw builds for years, and it doesn't 
> look like we're ever going to do anything about them. Can we just add 
> -Wno-format to the CFLAGS for Mingw and be done with them?

Are any of them substantive, or are they all about %m ?
        regards, tom lane


Re: mingw format warnings

From
Andrew Dunstan
Date:

On 01/28/2011 03:11 PM, Tom Lane wrote:
> Andrew Dunstan<andrew@dunslane.net>  writes:
>> We have had format warnings in mingw builds for years, and it doesn't
>> look like we're ever going to do anything about them. Can we just add
>> -Wno-format to the CFLAGS for Mingw and be done with them?
> Are any of them substantive, or are they all about %m ?


[andrew@aurelia ]$ grep 'warning.*format' frogmouth-make*.log |  sed 
's/.*warning:/warning:/' | sort | uniq -c      1 warning: format '%08x' expects type 'unsigned int', but 
argument 3 has type 'DWORD'      1 warning: format '%0i' expects type 'int', but argument 4 has 
type 'DWORD'      1 warning: format '%0i' expects type 'int', but argument 5 has 
type 'DWORD'      1 warning: format '%-30s' expects type 'char *', but argument 6 
has type 'int'      2 warning: format '%d' expects type 'int', but argument 3 has 
type 'DWORD'      2 warning: format '%i' expects type 'int', but argument 3 has 
type 'uint64'      2 warning: format '%i' expects type 'int', but argument 4 has 
type 'uint64'      3 warning: format not a string literal and no format arguments      1 warning: format '%s' expects
type'char *', but argument 4 has 
 
type 'int64'     70 warning: too many arguments for format      1 warning: unknown conversion type character 'G' in
format    73 warning: unknown conversion type character 'l' in format    360 warning: unknown conversion type character
'm'in format      1 warning: unknown conversion type character 'V' in format
 


cheers

andrew




Re: mingw format warnings

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> On 01/28/2011 03:11 PM, Tom Lane wrote:
>> Are any of them substantive, or are they all about %m ?

> [andrew@aurelia ]$ grep 'warning.*format' frogmouth-make*.log |  sed 
> 's/.*warning:/warning:/' | sort | uniq -c

I'd say a lot of those probably need attention.  It might be all right
to assume DWORD == int, but even there I'd feel safer with a cast.
        regards, tom lane


Re: mingw format warnings

From
Andrew Dunstan
Date:

On 01/28/2011 02:39 PM, Peter Eisentraut wrote:
> On fre, 2011-01-28 at 14:12 -0500, Andrew Dunstan wrote:
>> We have had format warnings in mingw builds for years, and it doesn't
>> look like we're ever going to do anything about them. Can we just add
>> -Wno-format to the CFLAGS for Mingw and be done with them?
> I wasn't aware of this issue, but looking at the latest build log from
> narwhal, I see only 4 format-related warnings, and they all look pretty
> easy and desirable to fix.
>
> The boatload of other warnings there is more puzzling ...
>


Hmm. Looks like gcc 4.5.0 that's in use on frogmouth is a whole lot noisier.

cheers

andrew


Re: mingw format warnings

From
Andrew Dunstan
Date:

On 01/28/2011 05:34 PM, Tom Lane wrote:
> Andrew Dunstan<andrew@dunslane.net>  writes:
>> On 01/28/2011 03:11 PM, Tom Lane wrote:
>>> Are any of them substantive, or are they all about %m ?
>> [andrew@aurelia ]$ grep 'warning.*format' frogmouth-make*.log |  sed
>> 's/.*warning:/warning:/' | sort | uniq -c
> I'd say a lot of those probably need attention.  It might be all right
> to assume DWORD == int, but even there I'd feel safer with a cast.

A quick look through suggest a cast could be reasonable in these case:

c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3124/../pgsql/src/backend/port/win32/crashdump.c: 
In function 'crashDumpHandler':
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3124/../pgsql/src/backend/port/win32/crashdump.c:137:3: 
warning: format '%0i' expects type 'int', but argument 4 has type 'DWORD'
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3124/../pgsql/src/backend/port/win32/crashdump.c:137:3: 
warning: format '%0i' expects type 'int', but argument 5 has type 'DWORD'
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3124/../pgsql/src/backend/port/win32/crashdump.c:147:6: 
warning: format '%d' expects type 'int', but argument 3 has type 'DWORD'
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3124/../pgsql/src/backend/port/win32/crashdump.c:156:6: 
warning: format '%08x' expects type 'unsigned int', but argument 3 has 
type 'DWORD'
pg_latch.c:147:4: warning: format '%d' expects type 'int', but argument 
3 has type 'DWORD'


The remainder seem due to use of INT64FORMAT or other formats like %m 
which gcc doesn't grok.


cheers

andrew