Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2316616pxb; Mon, 20 Sep 2021 18:37:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLIx5CGbsuJBkVqLlwGWWQq9J9yE6l1Bl/WgtYlKGLsyCT4g0fpmwIvx7ukmHq1CgboEiK X-Received: by 2002:aa7:d895:: with SMTP id u21mr32167794edq.300.1632188230237; Mon, 20 Sep 2021 18:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188230; cv=none; d=google.com; s=arc-20160816; b=u3Jz8NgBiVKGpXzg3UNbfOGU/5EoiSVan3UzGMAhRe1I/SbaGyvOhhzmgBNXEk15B+ DRUkIMVxl/2DxK/+3kAWG83PsqJatih9Amls0bErHZaB5lEeav+YWjdxZsfQHuKzJ3K3 0jKFYNY50kSkIYz2d9OxNE4NDhoaSrkXCBmis7mkRv8aHTpvyjw9+cksUrYbeWVljs3W sRPVloVb6ByPDl+6S78w6LX10DCCn9m3S08u6tzKKXDQ6D/6ivGI7Y1cY6dj7qBTfHLq bLcxXJfCxPWWN1jtXLMHEmrdZlx7yyKCkQrb2y7o9X9eRnDadPRvMKqCAnoOXiTJwGce 3RuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4MKJY32MkvRSfhRhRcaA4CbKteJYzvgEq4Y5lfSMU1U=; b=YaGxDmZl5vyFkO0EDK+ayi+v8nHQEpdEwm5MRh4UCAyyMFT+E46aTqK6/V+iD2TD0P ClbLAdza8e2ujnrlePH6CO8QIO8uKSUDRm1rNamd2YfPLu2t8SDLYZfxqCsIIFXlTYek PF/Rn5hs9AbaIZ6LVja1h6MXMk+Wide7QAvU/nPtlVZuVvRSUYdxfJD2mcDrBXBoyF1F XfAL9OL5wgyvlONdawm8eFjT2332d4Dxqn0DfJF0e5ViUoGry7p2PsHEOSEhrXEmU1uo dXi+LixB6k9bA/M18iwCyrTezooENHhBLCQLuobrVWC+kT91ZX4u1k7KxCklSnZOqXtl iShw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NQfTBETI; 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 b7si18758787edk.458.2021.09.20.18.36.47; Mon, 20 Sep 2021 18:37:10 -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=NQfTBETI; 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 S242075AbhITPql (ORCPT + 99 others); Mon, 20 Sep 2021 11:46:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:38136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242035AbhITPqk (ORCPT ); Mon, 20 Sep 2021 11:46:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A27E761159; Mon, 20 Sep 2021 15:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632152713; bh=EC+9dyajYM2OPNtBQsJoiGoRd9MZ5dbX2yOO9/Uoq6U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NQfTBETIlpVtKbA/+UDc+h1Ycdfi45SAPzATlwtFJTjYsBq6Mc3UvwPR2UUgVqSPq xMXRQo1l8idyhR9VJ30vQYai5gQlAlgRocso5YwY4Vcp9vzACHWjMQ3DDxSY762Zoa AIaqdF8h2C2XItW7pFDb/SjOj+f6fgKw7Ox/Nw/YJW/i6ZyOdiGkbruY6Ls6Z6VNBx g/AaCCjaTcD21MCKHy4OQH0nDr6o23qJlVRtwvqrcV7uNhudKLLt5z9KImL0KiPZJa APYEnZkJhTzK2mQVdHruVNHCkizkjfvMiP9HQ/PR1iX6fW3O1Z2fvNouaPyCv3RXJo 8YN/X+jF8hiuw== Date: Mon, 20 Sep 2021 08:45:08 -0700 From: Nathan Chancellor To: Paul Menzel Cc: Nick Desaulniers , Christophe Leroy , Zhen Lei , Andrew Morton , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v3] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning Message-ID: References: <20210920084332.5752-1-pmenzel@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210920084332.5752-1-pmenzel@molgen.mpg.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 20, 2021 at 10:43:33AM +0200, 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 Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor > --- > v2: Use IS_ENABLED > v3: Use if statement over ternary operator as requested by Christophe > > lib/zlib_inflate/inffast.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c > index f19c4fbe1be7..2843f9bb42ac 100644 > --- a/lib/zlib_inflate/inffast.c > +++ b/lib/zlib_inflate/inffast.c > @@ -253,13 +253,12 @@ 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 > - while (--loops); > + do { > + 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; > } else { /* dist == 1 or dist == 2 */ > -- > 2.33.0 >