Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2012 17:04:16 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        mdf@FreeBSD.org
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "David E. O'Brien" <obrien@FreeBSD.org>, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r235797 - head/contrib/gcc
Message-ID:  <D1A149E0-523C-4BBC-AE82-BFD1BEB7788F@xcllnt.net>
In-Reply-To: <CAMBSHm-C7YdU0uPa7aJ6FxDWhZzQiD0_uTj=f1nhV2k5SZ5%2B_A@mail.gmail.com>
References:  <201205221818.q4MII7lk019626@svn.freebsd.org> <20120523050739.H3621@besplex.bde.org> <CAMBSHm-C7YdU0uPa7aJ6FxDWhZzQiD0_uTj=f1nhV2k5SZ5%2B_A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On May 22, 2012, at 2:07 PM, mdf@FreeBSD.org wrote:

> On Tue, May 22, 2012 at 1:05 PM, Bruce Evans <brde@optusnet.com.au> =
wrote:
>> On Tue, 22 May 2012, David E. O'Brien wrote:
>>=20
>>> Log:
>>>  Do not incorrectly warn when printing a quad_t using "%qd" on =
64-bit
>>> platforms.
>>=20
>>=20
>> I think I like this, since it is technically correct, and will find a
>> different set of type mismatches.
>=20
> 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:
>=20
> --- 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 =3D=3D 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) =3D=3D INTEGER_TYPE
> +         && TREE_CODE (cur_type) =3D=3D INTEGER_TYPE
> +         && int_size_in_bytes (wanted_type) =3D=3D 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);
>     }
>=20
>=20
> 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.

--=20
Marcel Moolenaar
marcel@xcllnt.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D1A149E0-523C-4BBC-AE82-BFD1BEB7788F>