From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932280AbdBIQwa (ORCPT ); Thu, 9 Feb 2017 11:52:30 -0500 Received: from mail.kernel.org ([198.145.29.136]:57088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbdBIQw3 (ORCPT ); Thu, 9 Feb 2017 11:52:29 -0500 Date: Thu, 9 Feb 2017 13:50:39 -0300 From: Arnaldo Carvalho de Melo To: Adrian Hunter Cc: Alexander Shishkin , Andi Kleen , Jiri Olsa , Linux Kernel Mailing List Subject: Intel PT decoder switch case fallthrough cases reported by gcc 7 Message-ID: <20170209165039.GA2488@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I've updated the container with Fedora Rawhide I use to build tools/perf/ and samples/bcc/ and it now comes with gcc 7, where I get things like: CC /tmp/build/perf/tests/code-reading.o util/intel-pt-decoder/intel-pt-decoder.c: In function 'intel_pt_walk_psb': util/intel-pt-decoder/intel-pt-decoder.c:1748:31: error: this statement may fall through [-Werror=implicit-fallthrough=] decoder->continuous_period = false; ^ util/intel-pt-decoder/intel-pt-decoder.c:1749:3: note: here case INTEL_PT_TIP_PGE: ^~~~ util/intel-pt-decoder/intel-pt-decoder.c:1801:4: error: this statement may fall through [-Werror=implicit-fallthrough=] intel_pt_clear_tx_flags(decoder); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ util/intel-pt-decoder/intel-pt-decoder.c:1802:3: note: here case INTEL_PT_TNT: ^~~~ util/intel-pt-decoder/intel-pt-decoder.c: In function 'intel_pt_walk_to_ip': util/intel-pt-decoder/intel-pt-decoder.c:1841:31: error: this statement may fall through [-Werror=implicit-fallthrough=] decoder->continuous_period = false; ^ util/intel-pt-decoder/intel-pt-decoder.c:1842:3: note: here case INTEL_PT_TIP_PGE: ^~~~ MKDIR /tmp/build/perf/util/scripting-engines/ This gets solved with a new attribute, that you have to add where in the past we added: /* Fall through */ To indicate that the fall through to the next case statement block is intentional, so now I have a __fallthrough and I am addressing all the cases, please check if the ones below are the ones intended for the Intel PT parts, please Ack or advise, only one seemed like a bug, i.e. a break should be used, but I'm not sure. - Arnaldo diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index e4e7dc781d21..d4ed327a4908 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -1746,6 +1746,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: intel_pt_log("ERROR: Unexpected packet\n"); @@ -1799,6 +1800,8 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) decoder->pge = false; decoder->continuous_period = false; intel_pt_clear_tx_flags(decoder); + break; + case INTEL_PT_TNT: decoder->have_tma = false; intel_pt_log("ERROR: Unexpected packet\n"); @@ -1839,6 +1842,7 @@ static int intel_pt_walk_to_ip(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: decoder->pge = decoder->packet.type != INTEL_PT_TIP_PGD; diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index 4f7b32020487..7528ae4f7e28 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "intel-pt-pkt-decoder.h" @@ -498,6 +499,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, case INTEL_PT_FUP: if (!(packet->count)) return snprintf(buf, buf_len, "%s no ip", name); + __fallthrough; case INTEL_PT_CYC: case INTEL_PT_VMCS: case INTEL_PT_MTC: