From patchwork Sat Apr 21 18:30:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 26890 Received: (qmail 84029 invoked by alias); 21 Apr 2018 18:31:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 83790 invoked by uid 89); 21 Apr 2018 18:31:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=2157 X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 21 Apr 2018 18:31:02 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 94E9369F5A2 for ; Sat, 21 Apr 2018 13:31:00 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 9xHofiHJ0A3CS9xHofohZi; Sat, 21 Apr 2018 13:31:00 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:50954 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1f9xHo-002rFx-Cy; Sat, 21 Apr 2018 13:31:00 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/9] Fix "obvious" fall-through warnings Date: Sat, 21 Apr 2018 12:30:50 -0600 Message-Id: <20180421183056.29292-4-tom@tromey.com> In-Reply-To: <20180421183056.29292-1-tom@tromey.com> References: <20180421183056.29292-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1f9xHo-002rFx-Cy X-Source-Sender: 97-122-176-117.hlrn.qwest.net (bapiya.Home) [97.122.176.117]:50954 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This patch fixes the subset of -Wimplicit-fallthrough warnings that I considered obvious. In most cases it was obvious from context that falling through was desired; here I added the appropriate comment. In a couple of cases it seemed clear that a "break" was missing. ChangeLog 2018-04-21 Tom Tromey * riscv-tdep.c (riscv_isa_xlen): Add fall-through comment. * utils.c (can_dump_core) : Add fall-through comment. * eval.c (fetch_subexp_value) : Add fall-through comment. * d-valprint.c (d_val_print) : Add fall-through comment. * coffread.c (coff_symtab_read) : Add fall-through comment. --- gdb/ChangeLog | 11 +++++++++++ gdb/coffread.c | 1 + gdb/d-valprint.c | 1 + gdb/eval.c | 1 + gdb/riscv-tdep.c | 1 + gdb/utils.c | 1 + 6 files changed, 16 insertions(+) diff --git a/gdb/coffread.c b/gdb/coffread.c index 192d38c331..f24ec0713a 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -928,6 +928,7 @@ coff_symtab_read (minimal_symbol_reader &reader, backtraces, so filter them out (from phdm@macqel.be). */ if (within_function) break; + /* Fall through. */ case C_STAT: case C_THUMBLABEL: case C_THUMBSTAT: diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c index e2d8431362..579d3c8c91 100644 --- a/gdb/d-valprint.c +++ b/gdb/d-valprint.c @@ -88,6 +88,7 @@ d_val_print (struct type *type, int embedded_offset, stream, recurse, val, options); if (ret == 0) break; + /* Fall through. */ default: c_val_print (type, embedded_offset, address, stream, recurse, val, options); diff --git a/gdb/eval.c b/gdb/eval.c index b6fbfcf6c9..4c908c9538 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -215,6 +215,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp, case MEMORY_ERROR: if (!preserve_errors) break; + /* Fall through. */ default: throw_exception (ex); break; diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 149e5e3cec..9fa458b79b 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -369,6 +369,7 @@ riscv_isa_xlen (struct gdbarch *gdbarch) { default: warning (_("unknown xlen size, assuming 4 bytes")); + /* Fall through. */ case 1: return 4; case 2: diff --git a/gdb/utils.c b/gdb/utils.c index b957b0dc5c..a084046c18 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -275,6 +275,7 @@ can_dump_core (enum resource_limit_kind limit_kind) case LIMIT_CUR: if (rlim.rlim_cur == 0) return 0; + /* Fall through. */ case LIMIT_MAX: if (rlim.rlim_max == 0)