Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1688432pxb; Mon, 20 Sep 2021 02:57:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4FHhlXXW15ksIadbaZUB7aQ3reWO2ZEeGoXjwmbXrX0LdKXCPVJsn1PwEvOjlpshD8hIJ X-Received: by 2002:a05:6402:698:: with SMTP id f24mr27944829edy.48.1632131848147; Mon, 20 Sep 2021 02:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632131848; cv=none; d=google.com; s=arc-20160816; b=gFa+t/8fLjChgxbLmbuqU4IW4GQvMLTHWPk2wAArmzcAwGHHlgfhlo9oRo1/hpqh+Z UNfCoItRu4A79m65zhCwubyPAMpWpTb4SPCxrh2ZgNPwHx1qyVPezprMUyRqjwj+wn3t sMQqltrQpc6JhoXhkCi9+y6pU+w/Oob3+n03Fp5N+HNrBHlpJYhDncZzmZ0Ud6Bf1K5c E7qQMKf1qtsN0y/Q1ldFFbMczZkHyhr9nAk/1HkZTyEg4Lb8ENNSJBJ3Jtjg7w70lou+ dc5YlsgPE4Br1kewS8np3hcuP7LftVTJPw2liO4AflDSQTly5gr3W+Nx1D2a706g8egV XwjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=UlYzYpEI6YA+rc7OKqrN0KlZBegQs8iYXowRMXHsLbA=; b=nmrlS0oxjm8M+zRmdFA/b3c1FSkzBSagvlzelke8CIch8Mk9ZBQcszZCsSiHdzPG5N fBQVN3VCZX13Zkv7MfBLB851lBgonza/qHckg3cwVCZLsimW2xnBE5QA5VgSrpS7KAb2 g5Dl0GAXFp9JREOVsYD5TJkoWKuiEVuAQx1VLLBRmUnZUhDFhx90TBQFFlKG6Ge/JK+5 UDoBR15iDm47XP0/5J1x6ueLTGjxXYh07wr4RWA2CoVUAwhtm4MpVu8h8S7CNBVGs4Gh 245vhjNzKKeSXsoOvKjOVjHvrYbqi8JMsBeQDS1FlMOrc7O4ncT73BFAIMBhf77ieuw6 RJ7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy1si15939078ejc.592.2021.09.20.02.57.03; Mon, 20 Sep 2021 02:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232145AbhITIiW (ORCPT + 99 others); Mon, 20 Sep 2021 04:38:22 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:38975 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233496AbhITIiV (ORCPT ); Mon, 20 Sep 2021 04:38:21 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HCdFx6BFMz9sVK; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V_9QalPWqNnZ; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HCdFx5DLxz9sVJ; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9E55C8B76E; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 9mQA2CH--3lc; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 601ED8B764; Mon, 20 Sep 2021 10:36:53 +0200 (CEST) Subject: Re: [PATCH v2] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning To: Paul Menzel , Nathan Chancellor , Nick Desaulniers Cc: Zhen Lei , Andrew Morton , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev References: <20210920074633.13089-1-pmenzel@molgen.mpg.de> From: Christophe Leroy Message-ID: <00f8d7d7-cb13-203e-5a37-aee34a3258ff@csgroup.eu> Date: Mon, 20 Sep 2021 10:36:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210920074633.13089-1-pmenzel@molgen.mpg.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr-FR Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 20/09/2021 à 09:46, Paul Menzel a écrit : > Building Linux for ppc64le with Ubuntu clang version 12.0.0-3ubuntu1~21.04.1 > shows the warning below. > > arch/powerpc/boot/inffast.c:20:1: warning: unused function 'get_unaligned16' [-Wunused-function] > get_unaligned16(const unsigned short *p) > ^ > 1 warning generated. > > Fix it, by moving the check from the preprocessor to C, so the compiler > sees the use. > > Signed-off-by: Paul Menzel > --- > lib/zlib_inflate/inffast.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c > index f19c4fbe1be7..fb87a3120f0f 100644 > --- a/lib/zlib_inflate/inffast.c > +++ b/lib/zlib_inflate/inffast.c > @@ -254,11 +254,8 @@ void inflate_fast(z_streamp strm, unsigned start) > sfrom = (unsigned short *)(from); > loops = len >> 1; > do > -#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > - *sout++ = *sfrom++; > -#else > - *sout++ = get_unaligned16(sfrom++); > -#endif > + *sout++ = IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? > + *sfrom++ : get_unaligned16(sfrom++); I think it would be more readable as do { if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) *sout++ = *sfrom++; else *sout++ = get_unaligned16(sfrom++); } while (--loops); > while (--loops); > out = (unsigned char *)sout; > from = (unsigned char *)sfrom; >