svn commit: r235797 - head/contrib/gcc
Marcel Moolenaar
marcel at xcllnt.net
Wed May 23 00:04:32 UTC 2012
On May 22, 2012, at 2:07 PM, mdf at FreeBSD.org wrote:
> On Tue, May 22, 2012 at 1:05 PM, Bruce Evans <brde at optusnet.com.au> wrote:
>> On Tue, 22 May 2012, David E. O'Brien wrote:
>>
>>> Log:
>>> Do not incorrectly warn when printing a quad_t using "%qd" on 64-bit
>>> platforms.
>>
>>
>> I think I like this, since it is technically correct, and will find a
>> different set of type mismatches.
>
> We run with the following at Isilon, which is somewhat bogus because
> it allows a bit of sloppiness in types, but is also terribly
> convenient since it means no casting on printf arguments is needed:
>
> --- contrib/gcc/c-format.c 2012-05-22 14:08:23.538266746 -0700
> +++ /data/sb/head/src/contrib/gcc/c-format.c 2012-05-16
> 12:59:40.937016702 -0700
> @@ -2298,10 +2570,20 @@ check_format_types (format_wanted_type *
> equivalent but the above test won't consider them equivalent. */
> if (wanted_type == char_type_node
> && (!pedantic || i < 2)
> && char_type_flag)
> continue;
> +
> + /* Isilon: FreeBSD defines int64_t (and others) as one type (e.g. long
> + long) on i386 and another type (e.g. long) on amd64. This prevents
> + the use of a common format specifier. Treat equal sized integer types
> + as equivalent. */
> + if (TREE_CODE (wanted_type) == INTEGER_TYPE
> + && TREE_CODE (cur_type) == INTEGER_TYPE
> + && int_size_in_bytes (wanted_type) == int_size_in_bytes (cur_type))
> + continue;
> +
> /* Now we have a type mismatch. */
> format_type_warning (types->name, format_start, format_length,
> wanted_type, types->pointer_count,
> types->wanted_type_name, orig_cur_type, arg_num);
> }
>
>
> If there's no objections, I (or David or anyone else) can commit to
> the FreeBSD repository.
I think such would make support for external (i.e. non-FreeBSD) toolchains
even more problematic. Our format extensions are a big hurdle already. I
think we should not tweak the compiler.
--
Marcel Moolenaar
marcel at xcllnt.net
More information about the svn-src-head
mailing list