Skip to content

Commit fa5ade4

Browse files
authored
Fix compilation warnings on ARM64 with old GCC versions. (google#52)
Tested on Chrome OS M93 Linux (Debian 10.10) on kukui.
1 parent db08d22 commit fa5ade4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/crc32c_arm64_check.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ inline bool CanUseArm64Crc32() {
3838
// From 'arch/arm64/include/uapi/asm/hwcap.h' in Linux kernel source code.
3939
constexpr unsigned long kHWCAP_PMULL = 1 << 4;
4040
constexpr unsigned long kHWCAP_CRC32 = 1 << 7;
41-
unsigned long hwcap = (&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0;
41+
unsigned long hwcap =
42+
#if HAVE_STRONG_GETAUXVAL
43+
// Some compilers warn on (&getauxval != nullptr) in the block below.
44+
getauxval(AT_HWCAP);
45+
#elif HAVE_WEAK_GETAUXVAL
46+
(&getauxval != nullptr) ? getauxval(AT_HWCAP) : 0;
47+
#else
48+
#error This is supposed to be nested inside a check for HAVE_*_GETAUXVAL.
49+
#endif // HAVE_STRONG_GETAUXVAL
4250
return (hwcap & (kHWCAP_PMULL | kHWCAP_CRC32)) ==
4351
(kHWCAP_PMULL | kHWCAP_CRC32);
4452
#elif defined(__APPLE__)

0 commit comments

Comments
 (0)