Skip to content

Commit

Permalink
lib/zlib_inflate/inffast: check config in C to avoid unused function …
Browse files Browse the repository at this point in the history
…warning

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.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Paul Menzel <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Zhen Lei <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
paulmenzel authored and torvalds committed Sep 24, 2021
1 parent ebaeab2 commit b7cd9fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/zlib_inflate/inffast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b7cd9fa

Please sign in to comment.