Skip to contentSkip to conversation

tracing: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Feb 12, 2019 – Feb 13, 2019 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

kernel/trace/trace_events_filter.c: In function ‘predicate_parse’:
kernel/trace/trace_events_filter.c:494:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

     if (next[1] == next[0]) {
        ^
kernel/trace/trace_events_filter.c:498:4: note: here
    default:
    ^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 kernel/trace/trace_events_filter.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_events_filter.c +1 -0
index 27821480105e..eb694756c4bb 100644
@@ -495,6 +495,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
 					ptr++;
 					break;
 				}
+				/* fall through */
 			default:
 				parse_error(pe, FILT_ERR_TOO_MANY_PREDS,
 					    next - str);
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 7 lines · On Tue, 12 Feb 2019 15:08:03 -0600 "Gustavo A. R. Silva"…

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

kernel/trace/trace_events_filter.c: In function ‘predicate_parse’:
kernel/trace/trace_events_filter.c:494:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 8 lines
     if (next[1] == next[0]) {
        ^
kernel/trace/trace_events_filter.c:498:4: note: here
    default:
    ^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

Thanks, but I've already applied this patch:

http://lkml.kernel.org/r/[email protected]

I just haven't run my queue through my tests to push it to linux-next yet.

-- Steve

Quoted 20 lines

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 kernel/trace/trace_events_filter.c | 1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_events_filter.c +1 -0
index 27821480105e..eb694756c4bb 100644
@@ -495,6 +495,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
 					ptr++;
 					break;
 				}
+				/* fall through */
 			default:
 				parse_error(pe, FILT_ERR_TOO_MANY_PREDS,
 					    next - str);