This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C PATCH to add -Wswitch-unreachable (PR c/49859)
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Joseph Myers <joseph at codesourcery dot com>
- Date: Thu, 26 May 2016 09:21:27 -0400
- Subject: Re: C PATCH to add -Wswitch-unreachable (PR c/49859)
- Authentication-results: sourceware.org; auth=none
- References: <20160510181929 dot GE20450 at redhat dot com> <CADzB+2=5o2z4ztTa2e8WHwiNiKbeBj4Bue9a5LD-c=n72vVrtQ at mail dot gmail dot com> <20160520163634 dot GN1611 at redhat dot com> <57439802 dot 9040001 at gmail dot com> <20160525153005 dot GE17920 at redhat dot com> <5746173C dot 7040306 at gmail dot com> <20160526070655 dot GA3014 at redhat dot com>
On Thu, May 26, 2016 at 3:06 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Wed, May 25, 2016 at 03:21:00PM -0600, Martin Sebor wrote:
>> I see. Thanks for clarifying that. No warning on a declaration
>> alone makes sense in the case above but it has the unfortunate
>> effect of suppressing the warning when the declaration is followed
>> by a statement, such as in:
>>
>> void f (int*, int);
>>
>> void g (int i)
>> {
>> switch (i) {
>> int a [3];
>> memset (a, 0, sizeof a);
>>
>> default:
>> f (a, 3);
>> }
>> }
>
> Ah, then I think we should probably look into GIMPLE_TRY, using
> gimple_try_eval, too.
It might also make sense to distinguish between gimple_try_kind of
GIMPLE_TRY_CATCH (a user-written try block) and GIMPLE_TRY_FINALLY (a
compiler-generated cleanup).
Jason