From patchwork Thu Sep 30 16:49:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 45612 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDF113857C53 for ; Thu, 30 Sep 2021 16:51:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDF113857C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633020665; bh=XsCvIg8zPZ+cgm1oVzMtDlV4lWhpvM4RrPkvOEemoc0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=C6UomtUbpHj4blBW7rtLz6MoKJhENHSlJiGO76Cbp9L1ov7yU/YoOrw7GooyKMWhs EKBxp12hzRCDNukkq6td/jhCZHzUVxX4IK4NCvYOL6NByGby9PTRX/P6+fefeGZOAG JGktSp47K4tOhWokdpkS7m1fLiOA/l3s1jzSQRjw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 1851D3857C59 for ; Thu, 30 Sep 2021 16:49:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1851D3857C59 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-161-Kj3ftPVROpaZ-ItEvY_a6Q-1; Thu, 30 Sep 2021 12:49:35 -0400 X-MC-Unique: Kj3ftPVROpaZ-ItEvY_a6Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 637171084681 for ; Thu, 30 Sep 2021 16:49:34 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.176]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCADC60854 for ; Thu, 30 Sep 2021 16:49:33 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] Add missing braces to bsearch inline implementation Date: Thu, 30 Sep 2021 18:49:31 +0200 Message-ID: <87h7e22elg.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC treats the pragma as a statement, so that the else branch only consists of the pragma, not the return statement. Fixes commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7 ("Suppress -Wcast-qual warnings in bsearch"). --- (Tests are still running, but initial results look good.) bits/stdlib-bsearch.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h index d688ed2e15..e2fcea6e17 100644 --- a/bits/stdlib-bsearch.h +++ b/bits/stdlib-bsearch.h @@ -36,14 +36,16 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, else if (__comparison > 0) __l = __idx + 1; else + { #if __GNUC_PREREQ(4, 6) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wcast-qual" #endif - return (void *) __p; + return (void *) __p; #if __GNUC_PREREQ(4, 6) # pragma GCC diagnostic pop #endif + } } return NULL;