Branko ÄŒibej <brane@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
Received on Tue May 10 18:44:52 2005