From: Willy Tarreau Date: Fri, 7 Jan 2022 13:51:56 +0000 (+0100) Subject: BUILD: makefile: add -Wno-atomic-alignment to work around clang abusive warning X-Git-Tag: v2.6-dev1~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=790169fe69c139e4fb6fc3046985696aa78c0569;p=thirdparty%2Fhaproxy.git BUILD: makefile: add -Wno-atomic-alignment to work around clang abusive warning As reported in github issue #1502, clang, when building for i386, will try to use CMPXCHG8B-based loops for 64-bit atomic operations, and emits warnings for all 64-bit operands that are not 64-bit aligned, an alignment that is *not* required by the ABI, that the compiler itself does not enforce, and that the intel SDM clearly says is not required on this 32-bit platform for this operation. But this is likely an excessive outcome of the same code being used in 64-bit for CMPXCHG16B which does require proper alignment. Firefox already gave up on this one 3 years ago, let's not waste our time arguing and just shut up the warning instead. It might hide some real bugs in the future but till now experience showed that overall it's unlikely. This should be backported to all maintained branches that use 64-bit atomic ops (e.g. for counters). Thanks to Brad Smith for reporting it and confirming that shutting the warning addresses it. --- diff --git a/Makefile b/Makefile index 380effc539..58c740a42a 100644 --- a/Makefile +++ b/Makefile @@ -203,6 +203,7 @@ SPEC_CFLAGS += $(call cc-nowarn,clobbered) SPEC_CFLAGS += $(call cc-nowarn,missing-field-initializers) SPEC_CFLAGS += $(call cc-nowarn,cast-function-type) SPEC_CFLAGS += $(call cc-nowarn,string-plus-int) +SPEC_CFLAGS += $(call cc-nowarn,atomic-alignment) SPEC_CFLAGS += $(call cc-opt,-Wtype-limits) SPEC_CFLAGS += $(call cc-opt,-Wshift-negative-value) SPEC_CFLAGS += $(call cc-opt,-Wshift-overflow=2)