Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1825195pxb; Mon, 20 Sep 2021 06:15:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Qjj6LtYLduYCrO+o6tp1uuxB/Ma4es8bVnCA2+ZNWry/lBK9R3jru2RMLE/eqnn5omC2 X-Received: by 2002:a17:906:6d5a:: with SMTP id a26mr28723816ejt.162.1632143756161; Mon, 20 Sep 2021 06:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632143756; cv=none; d=google.com; s=arc-20160816; b=gxQg1Yh927JGPr5+t3gwpZ2j28BdQxtFqc/0bCMbbax4g2OU3otCCzpHfZBBZUcVWQ Gig8LKBpvrBJzHlxKLqTk8HzKnR21Fe+rCyRrqqsFDmhT4nQYDtb8aOEnDLsCIqKNfQI foqcHCL9JXwzNXv82/xu9PwKwTtwPm330T2fu6/TIFpeWzWn6asrL8j2+Jzs0e61Efld d8fHdhAEo4ZjIOuQSzTTGzYPK9cizZIdxoQ5K/hm2gFgNeqMFrjHQWXqXIT0HT2YlxCD cDjB58LLClHOVB4w8gdjJ6YMwTXbSgbyYnaFDLz+En/MNHlBKlLxtjiM7rB+y69OnNWO uE0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=i+gBUuNNPoKBUQdJZVQ5SYdSvQ+Gr3daknGqlBbPark=; b=su2uwuQR3YrzHw7ZN1YMUf13qfqm389Tpcb7dEaBEf9v1gftN7TQ5mUIdh9VFXl++1 dzTn9nKO4BLEr0SY96B9wdo+LTXv/gKYOE3KkbioGB02cUUiRiPVrZLRYou03Sj8+Nev Hwc5SfO8WNxDsm9Rq97Q4Cn2MQ4Z1/qpGtHA8WMQMDVTvloZfPBrs/Em/CBkvLYuE4Ow tqYZzru6zm3rbjXF4eUk+WG2aDn+Uv8IhLgmsPrTpR2Lu74fE32B45d1HVMf4nRnvC/4 FDOIy3obqn6mKgnqzM7eySIAYCltIHfjHzE49uGO1I7CeanjN+rzZIDnJKZfSXLSxc3w 4F3A== 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 8si15414615eje.191.2021.09.20.06.15.27; Mon, 20 Sep 2021 06:15:56 -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 S232227AbhITIpy (ORCPT + 99 others); Mon, 20 Sep 2021 04:45:54 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:39905 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230053AbhITIpw (ORCPT ); Mon, 20 Sep 2021 04:45:52 -0400 Received: from localhost.localdomain (ip5f5aef72.dynamic.kabel-deutschland.de [95.90.239.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 3FBA161E5FE33; Mon, 20 Sep 2021 10:44:25 +0200 (CEST) From: Paul Menzel To: Nathan Chancellor , Nick Desaulniers Cc: Christophe Leroy , Zhen Lei , Andrew Morton , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, Paul Menzel , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v3] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning Date: Mon, 20 Sep 2021 10:43:33 +0200 Message-Id: <20210920084332.5752-1-pmenzel@molgen.mpg.de> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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