From: Sebastian Pop Date: Wed, 3 Apr 2019 15:00:08 +0000 (-0500) Subject: fix warning when compiling for AArch64 X-Git-Tag: 1.9.9-b1~494 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cf9a48112900de4ecbef7c4c48b2ed9ef775a24;p=thirdparty%2Fzlib-ng.git fix warning when compiling for AArch64 gcc stopped warning about an unused function when I declared `arm_has_neon` as `static inline`. However clang still warns about an unused function: ``` arch/arm/armfeature.c:20:19: warning: unused function 'arm_has_neon' [-Wunused-function] static inline int arm_has_neon() ^ 1 warning generated. ``` This patch moves the function under a preprocessor `#if !defined(__aarch64)` which makes clang stop warn about it. --- diff --git a/arch/arm/armfeature.c b/arch/arm/armfeature.c index 44a160943..f7ccdc460 100644 --- a/arch/arm/armfeature.c +++ b/arch/arm/armfeature.c @@ -17,22 +17,25 @@ static int arm_has_crc32() { #endif } +/* AArch64 has neon. */ +#if !defined(__aarch64__) static inline int arm_has_neon() { -#if defined(__linux__) && defined(HWCAP_NEON) - return (getauxval(AT_HWCAP) & HWCAP_NEON) != 0 ? 1 : 0; -#elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION) -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) - return 1; /* Always supported */ -# endif -#endif + #if defined(__linux__) && defined(HWCAP_NEON) + return (getauxval(AT_HWCAP) & HWCAP_NEON) != 0 ? 1 : 0; + #elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION) + #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) + return 1; /* Always supported */ + #endif + #endif -#if defined(ARM_NOCHECK_NEON) - return 1; -#else - return 0; -#endif + #if defined(ARM_NOCHECK_NEON) + return 1; + #else + return 0; + #endif } +#endif ZLIB_INTERNAL int arm_cpu_has_neon; ZLIB_INTERNAL int arm_cpu_has_crc32;