diff --git a/Makefile b/Makefile index 559248867..607d48436 100644 --- a/Makefile +++ b/Makefile @@ -123,20 +123,25 @@ ifeq ($V,1) Q= endif +# WARNING: Do not change cc-opt, cc-opt-alt or cc-warning without checking if +# clang bug #49364 is fixed. stderr is redirected to /dev/null on +# purpose, to work around a clang 11 bug that crashes if stderr is +# redirected to stdin. +# # Function used to detect support of a given option by the compiler. # Usage: CFLAGS += $(call cc-opt,option). Eg: $(call cc-opt,-fwrapv) # Note: ensure the referencing variable is assigned using ":=" and not "=" to # call it only once. -cc-opt = $(shell set -e; if $(CC) -Werror $(1) -E -xc - -o /dev/null &0 2>&0; then echo "$(1)"; fi;) +cc-opt = $(shell set -e; if $(CC) -Werror $(1) -E -xc - -o /dev/null &0 2>/dev/null; then echo "$(1)"; fi;) # same but emits $2 if $1 is not supported -cc-opt-alt = $(shell set -e; if $(CC) -Werror $(1) -E -xc - -o /dev/null &0 2>&0; then echo "$(1)"; else echo "$(2)"; fi;) +cc-opt-alt = $(shell set -e; if $(CC) -Werror $(1) -E -xc - -o /dev/null &0 2>/dev/null; then echo "$(1)"; else echo "$(2)"; fi;) # Disable a warning when supported by the compiler. Don't put spaces around the # warning! And don't use cc-opt which doesn't always report an error until # another one is also returned. # Usage: CFLAGS += $(call cc-nowarn,warning). Eg: $(call cc-opt,format-truncation) -cc-nowarn = $(shell set -e; if $(CC) -Werror -W$(1) -E -xc - -o /dev/null &0 2>&0; then echo "-Wno-$(1)"; fi;) +cc-nowarn = $(shell set -e; if $(CC) -Werror -W$(1) -E -xc - -o /dev/null &0 2>/dev/null; then echo "-Wno-$(1)"; fi;) #### Installation options. DESTDIR =