[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <51258322-8665-76f9-c807-76cb56764229@csgroup.eu>
Date: Fri, 17 Sep 2021 07:17:00 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Paul Menzel <pmenzel@...gen.mpg.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>
Cc: llvm@...ts.linux.dev, Zhen Lei <thunder.leizhen@...wei.com>,
linux-kernel@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] lib/zlib_inflate/inffast: Check config in C to avoid
unused function warning
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 <pmenzel@...gen.mpg.de>
> ---
> 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;
>
Powered by blists - more mailing lists