]> git.neil.brown.name Git - git.git/commitdiff
Makefile: allow combining UBSan with other sanitizers
authorRené Scharfe <l.s.r@web.de>
Sat, 15 Jul 2017 17:18:56 +0000 (19:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2017 21:50:27 +0000 (14:50 -0700)
Multiple sanitizers can be specified as a comma-separated list.  Set
the flag NO_UNALIGNED_LOADS even if UndefinedBehaviorSanitizer is not
the only sanitizer to build with.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile

index 852dedc25c57b61e5f3747d1c1efb533329fb543..d3ba23fdd2b1076bc686d7c3c1b20a4a321ad927 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -991,10 +991,15 @@ ifdef DEVELOPER
 CFLAGS += $(DEVELOPER_CFLAGS)
 endif
 
+comma := ,
+empty :=
+space := $(empty) $(empty)
+
 ifdef SANITIZE
+SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
 BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
 BASIC_CFLAGS += -fno-omit-frame-pointer
-ifeq ($(SANITIZE),undefined)
+ifneq ($(filter undefined,$(SANITIZERS)),)
 BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
 endif
 endif