summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-07-15 19:18:56 +0200
committerJunio C Hamano <gitster@pobox.com>2017-07-17 14:50:27 -0700
commit425ca6710b207f36ca0dfd28cc28b5f360355bef (patch)
treeef93f6969db29a4eefe2cacbf6d703c7c9088af2 /Makefile
parent566cf0b3bd6458a74e8a3df8c01d27f35e7814f2 (diff)
downloadgit-425ca6710b207f36ca0dfd28cc28b5f360355bef.tar.gz
Makefile: allow combining UBSan with other sanitizersjk/build-with-asan
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 852dedc25c..d3ba23fdd2 100644
--- 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