From patchwork Wed Nov 2 13:19:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 690390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t87xc1Q3tz9vDZ for ; Thu, 3 Nov 2016 00:20:03 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=lAC2qLln; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=LFJdt7uh1RS6 vt+B9Mqdf1Cc9bNCJorhpIQl92rU4k3p21jjblDKSxBQTz53C9V6TqRQATs1acfl Ncr2XRovuSirOIScX4tQaqPmCf7XoNm6cXoJVH6nsl/SXjSGPDzT8KmOvLtsCKSS h35BkMYO66g9v8+j1g19nBhIiMguSTU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=dwJVCzNbHXuaw/g9Gj tdSM1CB/E=; b=lAC2qLlnqZeoUOhmXEmcNjdTdkxmLcp7bowaQ5wC8nf+bgLZat 7ONP8lnJYSzdO+/fuyynBCrmfRPePmX8nOe+jvJZC6EwdUlHupHyBQt/eV+ptnKO TkvcmUys0zdQlIRYmHPZmBjivLaSwCqC7yAoCoFszuR341AYSa63uEOY0= Received: (qmail 124784 invoked by alias); 2 Nov 2016 13:19:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 124661 invoked by uid 89); 2 Nov 2016 13:19:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 spammy=clarity, reserved X-HELO: tarox.wildebeest.org Received: from herd.wildebeest.org (HELO tarox.wildebeest.org) (80.127.118.209) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Nov 2016 13:19:48 +0000 Received: by tarox.wildebeest.org (Postfix, from userid 1000) id BEF64400E839; Wed, 2 Nov 2016 14:19:46 +0100 (CET) From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: Mark Wielaard Subject: [PATCH] libiberty: Fix -Wimplicit-fallthrough warnings. Date: Wed, 2 Nov 2016 14:19:33 +0100 Message-Id: <1478092773-20629-1-git-send-email-mjw@redhat.com> Adjust some comments, add some explicit fall through comments or explicit returns where necessary to not get implicit-fallthrough warnings. All fall throughs were deliberate. In one case I added an explicit return false for clarity instead of falling through a default case (that also would return false). libiberty/ChangeLog: * cplus-dem.c (demangle_signature): Move fall through comment. (demangle_fund_type): Add fall through comment between 'G' and 'I'. * hashtab.c (iterative_hash): Add fall through comments. * regex.c (regex_compile): Add Fall through comment after '+'/'?'. (byte_re_match_2_internal): Add Fall through comment after jump_n. Change "Note fall through" to "Fall through". (common_op_match_null_string_p): Return false after set_number_at instead of fall through. diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 7f63397..810e971 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -1658,8 +1658,8 @@ demangle_signature (struct work_stuff *work, break; } else - /* fall through */ {;} + /* fall through */ default: if (AUTO_DEMANGLING || GNU_DEMANGLING) @@ -4024,6 +4024,7 @@ demangle_fund_type (struct work_stuff *work, success = 0; break; } + /* fall through */ case 'I': (*mangled)++; if (**mangled == '_') diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 04607ea..99381b1 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -962,17 +962,17 @@ iterative_hash (const PTR k_in /* the key */, c += length; switch(len) /* all the case statements fall through */ { - case 11: c+=((hashval_t)k[10]<<24); - case 10: c+=((hashval_t)k[9]<<16); - case 9 : c+=((hashval_t)k[8]<<8); + case 11: c+=((hashval_t)k[10]<<24); /* fall through */ + case 10: c+=((hashval_t)k[9]<<16); /* fall through */ + case 9 : c+=((hashval_t)k[8]<<8); /* fall through */ /* the first byte of c is reserved for the length */ - case 8 : b+=((hashval_t)k[7]<<24); - case 7 : b+=((hashval_t)k[6]<<16); - case 6 : b+=((hashval_t)k[5]<<8); - case 5 : b+=k[4]; - case 4 : a+=((hashval_t)k[3]<<24); - case 3 : a+=((hashval_t)k[2]<<16); - case 2 : a+=((hashval_t)k[1]<<8); + case 8 : b+=((hashval_t)k[7]<<24); /* fall through */ + case 7 : b+=((hashval_t)k[6]<<16); /* fall through */ + case 6 : b+=((hashval_t)k[5]<<8); /* fall through */ + case 5 : b+=k[4]; /* fall through */ + case 4 : a+=((hashval_t)k[3]<<24); /* fall through */ + case 3 : a+=((hashval_t)k[2]<<16); /* fall through */ + case 2 : a+=((hashval_t)k[1]<<8); /* fall through */ case 1 : a+=k[0]; /* case 0: nothing left to add */ } diff --git a/libiberty/regex.c b/libiberty/regex.c index 9ffc3f4..6854e3b 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -2493,6 +2493,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern), if ((syntax & RE_BK_PLUS_QM) || (syntax & RE_LIMITED_OPS)) goto normal_char; + /* Fall through. */ handle_plus: case '*': /* If there is no previous pattern... */ @@ -6697,6 +6698,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, { case jump_n: is_a_jump_n = true; + /* Fall through. */ case pop_failure_jump: case maybe_pop_jump: case jump: @@ -7125,7 +7127,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, DEBUG_PRINT1 (" Match => jump.\n"); goto unconditional_jump; } - /* Note fall through. */ + /* Fall through. */ /* The end of a simple repeat has a pop_failure_jump back to @@ -7150,7 +7152,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, dummy_low_reg, dummy_high_reg, reg_dummy, reg_dummy, reg_info_dummy); } - /* Note fall through. */ + /* Fall through. */ unconditional_jump: #ifdef _LIBC @@ -7453,6 +7455,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, { case jump_n: is_a_jump_n = true; + /* Fall through. */ case maybe_pop_jump: case pop_failure_jump: case jump: @@ -7718,6 +7721,7 @@ PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end, case set_number_at: p1 += 2 * OFFSET_ADDRESS_SIZE; + return false; default: /* All other opcodes mean we cannot match the empty string. */