You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2005/05/10 16:17:08 UTC
compile warnings in trunk
Doing a clean build of trunk on OSX Tiger (which now uses gcc 4.0),
I'm seeing these warnings, because gcc has apparently tightened up
its type-checking. But I'm not sure that we can do anything about
them, can we? Maybe just forcibly cast the argument to an int?
subversion/libsvn_subr/hash.c: In function 'hash_write':
subversion/libsvn_subr/hash.c:204: warning: format '%d' expects type
'int', but argument 4 has type 'apr_ssize_t'
subversion/libsvn_subr/hash.c:227: warning: format '%d' expects type
'int', but argument 4 has type 'apr_ssize_t'
subversion/libsvn_repos/dump.c: In function 'write_hash_to_stringbuf':
subversion/libsvn_repos/dump.c:76: warning: format '%d' expects type
'int', but argument 3 has type 'apr_ssize_t'
subversion/libsvn_repos/dump.c:113: warning: format '%d' expects type
'int', but argument 3 has type 'apr_ssize_t'
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Branko Čibej <br...@xbc.nu>.
Florin Iucha wrote:
>On Tue, May 10, 2005 at 06:22:53PM +0200, Branko Čibej wrote:
>
>
>>Are you sure gcc-4 doesn't have a switch that would turn off these
>>too-pedantic warnings?
>>
>>
>
>-Wno-format
>
>
No, that's not acceptable at all. If using a cast is the only way to
silence these warnings (and note that apr_ssize_t is typedef'd to int,
so this format string _is_ correct), then I consider GCC to be seriously
broken in this area.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Florin Iucha <fl...@iucha.net>.
On Tue, May 10, 2005 at 06:22:53PM +0200, Branko Čibej wrote:
> Are you sure gcc-4 doesn't have a switch that would turn off these
> too-pedantic warnings?
-Wno-format
florin
--
Don't question authority: they don't know either!
Re: compile warnings in trunk
Posted by Ben Collins-Sussman <su...@collab.net>.
On May 11, 2005, at 12:59 PM, Justin Erenkrantz wrote:
> --On Tuesday, May 10, 2005 6:27 PM +0100 Philip Martin
> <ph...@codematters.co.uk> wrote:
>
>
>> So why does the warning occur on Tiger? What underlying type is an
>> apr_ssize_t? Is it now 64-bits? If so then perhaps APR should be
>> using %ld not %d? I'm using gcc 4 on 32-bit Linux and I don't get
>> this warning.
>>
>
> Could be that APR needs to be recompiled on Tiger with a clean
> config.cache if that value changed. I haven't installed Tiger yet
> here, so I can't check into it yet. I do think Tiger moved to an
> LP64 model, so I'd expect that size_t changed from Panther (32-bit)
> to Jaguar (64-bit) - requiring a recompile/reconfigure of APR to
> pick up that change. -- justin
>
Aha, I'll try a clean rebuild of apache2/apr/apu, followed by a clean
build of subversion, and then report back my results.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Michael Sweet <mi...@easysw.com>.
Justin Erenkrantz wrote:
> --On Tuesday, May 10, 2005 6:27 PM +0100 Philip Martin
> <ph...@codematters.co.uk> wrote:
>
>> So why does the warning occur on Tiger? What underlying type is an
>> apr_ssize_t? Is it now 64-bits? If so then perhaps APR should be
>> using %ld not %d? I'm using gcc 4 on 32-bit Linux and I don't get
>> this warning.
>
>
> Could be that APR needs to be recompiled on Tiger with a clean
> config.cache if that value changed. I haven't installed Tiger yet here,
> so I can't check into it yet. I do think Tiger moved to an LP64 model,
> so I'd expect that size_t changed from Panther (32-bit) to Jaguar
> (64-bit) - requiring a recompile/reconfigure of APR to pick up that
> change. -- justin
I think the default is still ILP32, with the 64-bit mode being used
with a compiler option.
Most of the 10.4 apps are still running in 32-bit mode for speed...
--
______________________________________________________________________
Michael Sweet, Easy Software Products mike at easysw dot com
Internet Printing and Document Software http://www.easysw.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Tuesday, May 10, 2005 6:27 PM +0100 Philip Martin
<ph...@codematters.co.uk> wrote:
> So why does the warning occur on Tiger? What underlying type is an
> apr_ssize_t? Is it now 64-bits? If so then perhaps APR should be
> using %ld not %d? I'm using gcc 4 on 32-bit Linux and I don't get
> this warning.
Could be that APR needs to be recompiled on Tiger with a clean config.cache
if that value changed. I haven't installed Tiger yet here, so I can't
check into it yet. I do think Tiger moved to an LP64 model, so I'd expect
that size_t changed from Panther (32-bit) to Jaguar (64-bit) - requiring a
recompile/reconfigure of APR to pick up that change. -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Äibej <br...@xbc.nu> writes:
> I'd say it's compiler overzealousness, not a bug as such. Such
> warnings make sense in envionments where the size of the defined type
> could be different on different platforms. Of course, the compiler
> doesn't know that the format string came from a define, too.
So why does the warning occur on Tiger? What underlying type is an
apr_ssize_t? Is it now 64-bits? If so then perhaps APR should be
using %ld not %d? I'm using gcc 4 on 32-bit Linux and I don't get
this warning.
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Branko Čibej <br...@xbc.nu>.
Philip Martin wrote:
>Branko ÄŒibej <br...@xbc.nu> writes:
>
>
>> From a strictly language point of view, these warnings are
>> correct. On the other hand, unless they can be turned off by a
>> switch, there's no way you can avoid them short of explicitly casting
>> the arguments to the correct types. And that sort of defeats the
>> whole point of having #defined format strings.
>>
>>Are you sure gcc-4 doesn't have a switch that would turn off these
>>too-pedantic warnings?
>>
>>
>
>Why are the warnings correct?
>
>
Sorry, "correct" isn't the right word; "make sense" would've been better.
> SVN_ERR (svn_stream_printf (stream, subpool,
> "K %" APR_SSIZE_T_FMT "\n%s\n"
> "V %" APR_SIZE_T_FMT "\n",
> item->klen, (const char *) item->key,
> valstr->len));
>
>Argument 4, item->klen, is indeed apr_ssize_t, but the format is
>APR_SSIZE_T_FMT which should match. If that doesn't work it looks
>like either APR on Tiger doesn't set APR_SSIZE_T_FMT correctly, or
>it's a compiler bug.
>
>
I'd say it's compiler overzealousness, not a bug as such. Such warnings
make sense in envionments where the size of the defined type could be
different on different platforms. Of course, the compiler doesn't know
that the format string came from a define, too.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Äibej <br...@xbc.nu> writes:
> Ben Collins-Sussman wrote:
>
>> Doing a clean build of trunk on OSX Tiger (which now uses gcc 4.0),
>> I'm seeing these warnings, because gcc has apparently tightened up
>> its type-checking. But I'm not sure that we can do anything about
>> them, can we? Maybe just forcibly cast the argument to an int?
I don't get them using gcc version 4.0.1 20050428 (prerelease) on
32-bit Linux.
>> subversion/libsvn_subr/hash.c: In function 'hash_write':
>> subversion/libsvn_subr/hash.c:204: warning: format '%d' expects type
>> 'int', but argument 4 has type 'apr_ssize_t'
>> subversion/libsvn_subr/hash.c:227: warning: format '%d' expects type
>> 'int', but argument 4 has type 'apr_ssize_t'
>>
>> subversion/libsvn_repos/dump.c: In function 'write_hash_to_stringbuf':
>> subversion/libsvn_repos/dump.c:76: warning: format '%d' expects type
>> 'int', but argument 3 has type 'apr_ssize_t'
>> subversion/libsvn_repos/dump.c:113: warning: format '%d' expects
>> type 'int', but argument 3 has type 'apr_ssize_t'
>
> From a strictly language point of view, these warnings are
> correct. On the other hand, unless they can be turned off by a
> switch, there's no way you can avoid them short of explicitly casting
> the arguments to the correct types. And that sort of defeats the
> whole point of having #defined format strings.
>
> Are you sure gcc-4 doesn't have a switch that would turn off these
> too-pedantic warnings?
Why are the warnings correct?
SVN_ERR (svn_stream_printf (stream, subpool,
"K %" APR_SSIZE_T_FMT "\n%s\n"
"V %" APR_SIZE_T_FMT "\n",
item->klen, (const char *) item->key,
valstr->len));
Argument 4, item->klen, is indeed apr_ssize_t, but the format is
APR_SSIZE_T_FMT which should match. If that doesn't work it looks
like either APR on Tiger doesn't set APR_SSIZE_T_FMT correctly, or
it's a compiler bug.
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: compile warnings in trunk
Posted by Branko Čibej <br...@xbc.nu>.
Ben Collins-Sussman wrote:
> Doing a clean build of trunk on OSX Tiger (which now uses gcc 4.0),
> I'm seeing these warnings, because gcc has apparently tightened up
> its type-checking. But I'm not sure that we can do anything about
> them, can we? Maybe just forcibly cast the argument to an int?
>
>
>
> subversion/libsvn_subr/hash.c: In function 'hash_write':
> subversion/libsvn_subr/hash.c:204: warning: format '%d' expects type
> 'int', but argument 4 has type 'apr_ssize_t'
> subversion/libsvn_subr/hash.c:227: warning: format '%d' expects type
> 'int', but argument 4 has type 'apr_ssize_t'
>
> subversion/libsvn_repos/dump.c: In function 'write_hash_to_stringbuf':
> subversion/libsvn_repos/dump.c:76: warning: format '%d' expects type
> 'int', but argument 3 has type 'apr_ssize_t'
> subversion/libsvn_repos/dump.c:113: warning: format '%d' expects type
> 'int', but argument 3 has type 'apr_ssize_t'
From a strictly language point of view, these warnings are correct. On
the other hand, unless they can be turned off by a switch, there's no
way you can avoid them short of explicitly casting the arguments to the
correct types. And that sort of defeats the whole point of having
#defined format strings.
Are you sure gcc-4 doesn't have a switch that would turn off these
too-pedantic warnings?
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org