You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.7 KiB

  1. commit a7e9853db925b12b1d040be8b04bafc11d84d685
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Tue Oct 16 18:11:34 2018 +0200
  4. BUILD: Makefile: silence an option conflict warning with clang
  5. clang complains that -fno-strict-overflow is not used when -fwrapv is
  6. used, which breaks the build when -Werror is used. Let's introduce a
  7. cc-opt-alt function to emit the former only then the latter is not
  8. supported (since it implies the former).
  9. (cherry picked from commit 0d7a2ae4f5199ec37ead6914fa24d40ec0989a4d)
  10. Signed-off-by: Willy Tarreau <w@1wt.eu>
  11. diff --git a/Makefile b/Makefile
  12. index 1a971f92..6ffc1b06 100644
  13. --- a/Makefile
  14. +++ b/Makefile
  15. @@ -98,6 +98,9 @@
  16. # call it only once.
  17. cc-opt = $(shell set -e; if $(CC) $(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; fi;)
  18. +# same but emits $2 if $1 is not supported
  19. +cc-opt-alt = $(shell set -e; if $(CC) $(1) -E -xc - -o /dev/null </dev/null >&0 2>&0; then echo "$(1)"; else echo "$(2)"; fi;)
  20. +
  21. # Disable a warning when supported by the compiler. Don't put spaces around the
  22. # warning! And don't use cc-opt which doesn't always report an error until
  23. # another one is also returned.
  24. @@ -147,8 +150,7 @@ DEBUG_CFLAGS = -g
  25. # can do whatever it wants since it's an undefined behavior, so use -fwrapv
  26. # to be sure we get the intended behavior.
  27. SPEC_CFLAGS := -fno-strict-aliasing -Wdeclaration-after-statement
  28. -SPEC_CFLAGS += $(call cc-opt,-fwrapv)
  29. -SPEC_CFLAGS += $(call cc-opt,-fno-strict-overflow)
  30. +SPEC_CFLAGS += $(call cc-opt-alt,-fwrapv,$(call cc-opt,-fno-strict-overflow))
  31. SPEC_CFLAGS += $(call cc-nowarn,format-truncation)
  32. SPEC_CFLAGS += $(call cc-nowarn,address-of-packed-member)
  33. SPEC_CFLAGS += $(call cc-nowarn,null-dereference)