Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2230781pxb; Fri, 17 Sep 2021 05:25:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdQGaen+MIGQb8XWBW9IwqmulrQROe+IQE0uBIcj+opsdrKPXs1Ww19lrr5aPmA+8iinan X-Received: by 2002:a92:650c:: with SMTP id z12mr8034969ilb.87.1631881553132; Fri, 17 Sep 2021 05:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631881553; cv=none; d=google.com; s=arc-20160816; b=EtsTaHe8KAMiWyoFzD7mdyIY/GAXug1mD4wKBIPcPmc5J65otI9ipPdeVeXyI1x0YC U8dwvkEF1nRhGUahipRe7rqZTKhrUVb7GHuASzpDZFlch5B64p5ch8vFFJFQVehQ1mQN YtCEV2vAQ8Lnx4EauS0L1iO4S7zoRzyyvZIsnwASGWuLzrGpNrfT/UgOfF6oXGKMlf0f K4BOTsGZDjpTzReCEGWI6hYihxoZ1N7FrfmTRSIRZVAn8iPA2yQaRK0eg36lKFMR+Jyt ugoIqQrfn2rxYek6zX1JQs+Q/O/UlfRvVJBAA+WB6S17Gft8XnuoM1U1WIcVMEXnLae/ yVRw== 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=B0QLSwcsdHZJrNvaGkGVkIORmqvD5SpL4RdrKiJg/Go=; b=mxz3p7fbWbzKQIKbZO1iJj2sLtoDyFqrWyKmwB5GD5KA+YTDQ9XBVRwTGu9Oaqt7TN XLJqfvk5YnVA3z7XQ9b81rRoEPp9/PMNjjzTIjgW7No9slof/s9c+h65KEMAQ56c7WGz nov8+SaCdMuLT2QvY/XWQXHg4dAb7otUvkBuvp/acp4TT453wxYH2cbdjEn1exW7wC04 usWWDHxHoeOr1J/IFQGCDeU/5xucrLKHhF+Aq3Rsrq+i1nMbhCBzByBnEDWxcuSFd/9C Q/Pnlef5fw2DLffwnAXzC2mxK36CtdwNAkI3uNNoShEJV6wRyukQ3dO6MsusQQ0saTBo LqYw== 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 g17si5188247ilr.112.2021.09.17.05.25.41; Fri, 17 Sep 2021 05:25:53 -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 S244780AbhIQFS0 (ORCPT + 99 others); Fri, 17 Sep 2021 01:18:26 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:45041 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbhIQFSZ (ORCPT ); Fri, 17 Sep 2021 01:18:25 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4H9hyk2qq5z9sTc; Fri, 17 Sep 2021 07:17:02 +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 Nv5IhXWb4hJc; Fri, 17 Sep 2021 07:17:02 +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 4H9hyk1bp6z9sTX; Fri, 17 Sep 2021 07:17:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 186B28B783; Fri, 17 Sep 2021 07:17:02 +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 rpsHFshvp2DV; Fri, 17 Sep 2021 07:17:02 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.202.36]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5D7E38B768; Fri, 17 Sep 2021 07:17:01 +0200 (CEST) Subject: Re: [PATCH] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning To: Paul Menzel , Nathan Chancellor , Nick Desaulniers Cc: llvm@lists.linux.dev, Zhen Lei , linux-kernel@vger.kernel.org, Paul Mackerras , Andrew Morton , linuxppc-dev@lists.ozlabs.org References: <20210916142210.26722-1-pmenzel@molgen.mpg.de> From: Christophe Leroy Message-ID: <51258322-8665-76f9-c807-76cb56764229@csgroup.eu> Date: Fri, 17 Sep 2021 07:17:00 +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: <20210916142210.26722-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 16/09/2021 à 16:22, 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 | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c > index f19c4fbe1be7..444ad3c3ccd3 100644 > --- a/lib/zlib_inflate/inffast.c > +++ b/lib/zlib_inflate/inffast.c > @@ -254,11 +254,7 @@ 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++ = CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS ? *sfrom++ : get_unaligned16(sfrom++); You can't do that, CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not something that have value 0 or 1, it is something which is either defined or not. You have to use IS_ENABLED() macro, so it should become something like: if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) *sout++ = *sfrom++; else *sout++ = get_unaligned16(sfrom++); > while (--loops); > out = (unsigned char *)sout; > from = (unsigned char *)sfrom; >