From: Paul Menzel <pmenzel@molgen.mpg.de> To: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>, Zhen Lei <thunder.leizhen@huawei.com>, Andrew Morton <akpm@linux-foundation.org>, Michael Ellerman <mpe@ellerman.id.au>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, linuxppc-dev@lists.ozlabs.org, Paul Menzel <pmenzel@molgen.mpg.de>, 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 [thread overview] Message-ID: <20210920084332.5752-1-pmenzel@molgen.mpg.de> (raw) 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 <pmenzel@molgen.mpg.de> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Paul Menzel <pmenzel@molgen.mpg.de> To: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com> Cc: Paul Menzel <pmenzel@molgen.mpg.de>, llvm@lists.linux.dev, Zhen Lei <thunder.leizhen@huawei.com>, linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>, Andrew Morton <akpm@linux-foundation.org>, linuxppc-dev@lists.ozlabs.org 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 [thread overview] Message-ID: <20210920084332.5752-1-pmenzel@molgen.mpg.de> (raw) 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 <pmenzel@molgen.mpg.de> --- 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
next reply other threads:[~2021-09-20 8:44 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-20 8:43 Paul Menzel [this message] 2021-09-20 8:43 ` [PATCH v3] lib/zlib_inflate/inffast: Check config in C to avoid unused function warning Paul Menzel 2021-09-20 15:45 ` Nathan Chancellor 2021-09-20 15:45 ` Nathan Chancellor 2021-09-21 10:11 ` Paul Menzel 2021-09-21 10:11 ` Paul Menzel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210920084332.5752-1-pmenzel@molgen.mpg.de \ --to=pmenzel@molgen.mpg.de \ --cc=akpm@linux-foundation.org \ --cc=benh@kernel.crashing.org \ --cc=christophe.leroy@csgroup.eu \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=llvm@lists.linux.dev \ --cc=mpe@ellerman.id.au \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=paulus@samba.org \ --cc=thunder.leizhen@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.