This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2] C++: Add fix-it hints for -Wold-style-cast
- From: Jason Merrill <jason at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: Nathan Sidwell <nathan at acm dot org>, Marek Polacek <polacek at redhat dot com>, Volker Reichelt <v dot reichelt at netcologne dot de>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 Jun 2017 14:39:03 -0400
- Subject: Re: [PATCH v2] C++: Add fix-it hints for -Wold-style-cast
- Authentication-results: sourceware.org; auth=none
- References: <20170427210337.GF4255@redhat.com> <1493819469-38154-1-git-send-email-dmalcolm@redhat.com>
On Wed, May 3, 2017 at 9:51 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Thu, 2017-04-27 at 23:03 +0200, Marek Polacek wrote:
>> On Thu, Apr 27, 2017 at 05:10:24PM -0400, David Malcolm wrote:
>> > + /* First try const_cast. */
>> > + trial = build_const_cast (dst_type, orig_expr, 0 /* complain
>> > */);
>> > + if (trial != error_mark_node)
>> > + return "const_cast";
>> > +
>> > + /* If that fails, try static_cast. */
>> > + trial = build_static_cast (dst_type, orig_expr, 0 /* complain
>> > */);
>> > + if (trial != error_mark_node)
>> > + return "static_cast";
>> > +
>> > + /* Finally, try reinterpret_cast. */
>> > + trial = build_reinterpret_cast (dst_type, orig_expr, 0 /*
>> > complain */);
>> > + if (trial != error_mark_node)
>> > + return "reinterpret_cast";
>>
>> I think you'll want tf_none instead of 0 /* complain */ in these.
>>
>> Marek
>
> Thanks.
>
> Here's an updated version of the patch.
>
> Changes since v1:
> - updated expected fixit-formatting (the new fix-it printer in
> r247548 handles this properly now)
> - added new test cases as suggested by Florian
> - use "tf_none" rather than "0 /* complain */"
>
> Successfully bootstrapped®rtested on x86_64-pc-linux-gnu.
>
> OK for trunk?
OK.
Jason