Re: [PATCH 2/3 v2] Handle all enum members in case statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 4, 2015 at 8:06 AM, Tony Camuso <tcamuso@xxxxxxxxxx> wrote:
> Missing enum members in case statements in c2xml.c and parse.c were
> causing compile time complaints by gcc 5.1.1. Better to explicitly
> handle all enum members of the switch variable in case statements,
> even if they just break.
>                 break;
> +       case SYM_PREPROCESSOR:
> +       case SYM_BASETYPE:
> +       case SYM_NODE:
> +       case SYM_PTR:
> +       case SYM_ARRAY:
> +       case SYM_ENUM:
> +       case SYM_TYPEDEF:
> +       case SYM_TYPEOF:
> +       case SYM_MEMBER:
> +       case SYM_BITFIELD:
> +       case SYM_LABEL:
> +       case SYM_RESTRICT:
> +       case SYM_FOULED:
> +       case SYM_KEYWORD:
> +       case SYM_BAD:
> +               break;

I think adding a "default: break" should work. I like your previous patch
better, except maybe adding a line break after default.


>                         case SYM_ENUM:
>                         case SYM_RESTRICT:
>                                 base_type->ident = ident;
> +                       case SYM_PREPROCESSOR:
> +                       case SYM_BASETYPE:

I notice this has the follow through behavior. It is not a bug.
But if some one append some new case there, it is easy to
cause unintended follow through. It is better add a break there.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux