This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C PATCH to add -Wswitch-unreachable (PR c/49859)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]