Date: Tue, 22 May 2012 14:07:22 -0700 From: mdf@FreeBSD.org To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "David E. O'Brien" <obrien@freebsd.org> Subject: Re: svn commit: r235797 - head/contrib/gcc Message-ID: <CAMBSHm-C7YdU0uPa7aJ6FxDWhZzQiD0_uTj=f1nhV2k5SZ5%2B_A@mail.gmail.com> In-Reply-To: <20120523050739.H3621@besplex.bde.org> References: <201205221818.q4MII7lk019626@svn.freebsd.org> <20120523050739.H3621@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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: > >> Log: >> =A0Do 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 =3D=3D char_type_node && (!pedantic || i < 2) && char_type_flag) continue; + + /* Isilon: FreeBSD defines int64_t (and others) as one type (e.g. lo= ng + long) on i386 and another type (e.g. long) on amd64. This prevents + the use of a common format specifier. Treat equal sized integer ty= pes + 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)= ; } If there's no objections, I (or David or anyone else) can commit to the FreeBSD repository. Cheers, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm-C7YdU0uPa7aJ6FxDWhZzQiD0_uTj=f1nhV2k5SZ5%2B_A>