Message ID | 1477486024-8446-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | Superseded |
Headers | show |
Reviewed-by: Matias Elo <matias.elo@nokia.com> > On 26 Oct 2016, at 15:47, Bill Fischofer <bill.fischofer@linaro.org> wrote: > > Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding > comments to the parser's switch statement to document the fact that > fall through is intentional. > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > platform/linux-generic/odp_packet.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c > index 714794a..e43636b 100644 > --- a/platform/linux-generic/odp_packet.c > +++ b/platform/linux-generic/odp_packet.c > @@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, > > switch (prs->parsed_layers) { > case LAYER_NONE: > + /* Fall through */ > + > case LAYER_L2: > { > const _odp_ethhdr_t *eth; > @@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, > if (layer == LAYER_L2) > return prs->error_flags.all != 0; > } > + /* Fall through */ > + > case LAYER_L3: > { > offset = prs->l3_offset; > @@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, > if (layer == LAYER_L3) > return prs->error_flags.all != 0; > } > + /* Fall through */ > + > case LAYER_L4: > { > offset = prs->l4_offset; > @@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, > prs->parsed_layers = LAYER_L4; > break; > } > + > case LAYER_ALL: > break; > > -- > 2.7.4 >
On 10/27/16 10:56, Elo, Matias (Nokia - FI/Espoo) wrote: > Reviewed-by: Matias Elo <matias.elo@nokia.com> > >> On 26 Oct 2016, at 15:47, Bill Fischofer <bill.fischofer@linaro.org> wrote: >> >> Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding >> comments to the parser's switch statement to document the fact that >> fall through is intentional. >> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> platform/linux-generic/odp_packet.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c >> index 714794a..e43636b 100644 >> --- a/platform/linux-generic/odp_packet.c >> +++ b/platform/linux-generic/odp_packet.c >> @@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, >> >> switch (prs->parsed_layers) { >> case LAYER_NONE: >> + /* Fall through */ indent here is 1 tab from 'case' in over 2 cases it's the same. Please make code look more nice with same indent level. Maxim. >> + >> case LAYER_L2: >> { >> const _odp_ethhdr_t *eth; >> @@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, >> if (layer == LAYER_L2) >> return prs->error_flags.all != 0; >> } >> + /* Fall through */ >> + >> case LAYER_L3: >> { >> offset = prs->l3_offset; >> @@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, >> if (layer == LAYER_L3) >> return prs->error_flags.all != 0; >> } >> + /* Fall through */ >> + >> case LAYER_L4: >> { >> offset = prs->l4_offset; >> @@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, >> prs->parsed_layers = LAYER_L4; >> break; >> } >> + >> case LAYER_ALL: >> break; >> >> -- >> 2.7.4 >>
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 714794a..e43636b 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, switch (prs->parsed_layers) { case LAYER_NONE: + /* Fall through */ + case LAYER_L2: { const _odp_ethhdr_t *eth; @@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, if (layer == LAYER_L2) return prs->error_flags.all != 0; } + /* Fall through */ + case LAYER_L3: { offset = prs->l3_offset; @@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, if (layer == LAYER_L3) return prs->error_flags.all != 0; } + /* Fall through */ + case LAYER_L4: { offset = prs->l4_offset; @@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, prs->parsed_layers = LAYER_L4; break; } + case LAYER_ALL: break;
Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding comments to the parser's switch statement to document the fact that fall through is intentional. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- platform/linux-generic/odp_packet.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.4