Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1645556pxb; Thu, 16 Sep 2021 11:56:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGTbNjETr/HRO5BjQ5o7Q1vX8g1buExgrpEvGyrNtB2YyFxP0eQV7JHcYeGySaU5hKCnGU X-Received: by 2002:a17:906:8981:: with SMTP id gg1mr7924979ejc.95.1631818613494; Thu, 16 Sep 2021 11:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631818613; cv=none; d=google.com; s=arc-20160816; b=IPJEre1mhuVzpGGx4jYccU4I/ZkmWsNYz6wjvWYDwS8gAt6LsXE4zErwF0XKVkjAvQ 2t6W5lM3oK9d0Utx/vodUzTIFyexPSCR4NC5VIs/78L9e//Rop16Swu+t8HtSTotx90y dioG6229Uds+RbX/Iikbke73t9kleyLsHXrxRzzGB78ClTRHAL7YQ3NPxA8xEsE90Xz6 7TuVWUEJTaVjX4ib9tAMG0XVkGdw+U+lGoPwdGRIhey52RzIy0OezW3il2ujg81nf0i0 f0IlhGFvLX7ajkqVIRmOyYpDBzP5YMgOf5XJE27qfL9ao0rqxscfWXNlZ12ncSs1o3lS R1gw== 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:dkim-signature; bh=jLEYtSutSyioZZBLXHnYb5QEwN31B8hov/NgvW8eQak=; b=puwcx7rUwkWA7ennySqo6gmnQ406mTz45CJ/rswhqot194dqxn4sklPzW9rJS5iEl6 5Vvr8vB4Nuo3DuED16+VF5E4eiM1BJdZawfSkOmKHva8Vkq+j7ys2ow7OeCbvzZdDXFM soUMqwPmAg7F4ihPmbpgE5ertjw1tljcm7w5CsWFwUCNDpGQhnI7d+tTHmIo/4L3xfUu i+oP/GvbGng+4KYoUQ0AVCMICVisL/+M9a8TohqKUzVGBOYk4B8x8eZBV+dbXzQRDklq 8dBNS6SaQbo9O8cpQmtos32DuKYvym7cOHqaKFHcH8U7HHN/9nK+2DPN7CY1ul2yFTCP qdgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HuUVKWhN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv54si4084452ejc.58.2021.09.16.11.56.29; Thu, 16 Sep 2021 11:56: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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HuUVKWhN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237820AbhIPO7y (ORCPT + 99 others); Thu, 16 Sep 2021 10:59:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:36808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235474AbhIPO7u (ORCPT ); Thu, 16 Sep 2021 10:59:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0DF860F6B; Thu, 16 Sep 2021 14:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631804309; bh=AgqdIcDpy91eL8LK1OITNsHLzbyaPNMmq9RB0DZLZQ8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HuUVKWhN0Cyc3CwcojR+XB+bbOC/LqtJv/hJmtqmtM3VctvEWQLqUSvol9yx3+vxP ursQPNIXbL6KAvPrdcxJ/WvldvdmJAEBvlQ3vvNoj5I7eKH1Z6XvsU9PXrzuXEVnPL +wUuxZgO8GpkpffycTf1COG/dR8Jkht3YwJDqHhL5Xo/r6thIa3oAy5d0KM5916EG8 KEGdZGyVc7VZSrcRzy7rVOD9bugyjPV39/0tBW1qrBpoCCMRI4Rk62EBrQMkLhULib 9Pq0UOJbjh4fPJ6fxnBnt2fEpsBDuvINm3PK7z1Lg4FF70fU90ORMU5SJqLJadmQzA BSwdASIONLGXg== Subject: Re: [PATCH] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning To: Paul Menzel , 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: <20210916142210.26722-1-pmenzel@molgen.mpg.de> From: Nathan Chancellor Message-ID: Date: Thu, 16 Sep 2021 07:58:27 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.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: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On 9/16/2021 7:22 AM, Paul Menzel wrote: > 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++); > while (--loops); > out = (unsigned char *)sout; > from = (unsigned char *)sfrom; > Thanks for the patch. This should probably be IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ? ... which matches the rest of the kernel tree, as certain CONFIG_... values are not guaranteed to always be defined. Cheers, Nathan