Skip to content

Commit

Permalink
Enable address sanitizer by default
Browse files Browse the repository at this point in the history
Build for sanitizers is conditional for the sake of running Valgrind.
Once build target is set to valgrind, no sanitizer is enabled.
  • Loading branch information
jserv committed Jan 23, 2020
1 parent f215f2e commit a3e0eae
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ else
VECHO = @printf
endif

# Enable sanitizers
ifeq ("$(SANITIER)","0")
# required by Valgrind
else
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
endif

$(GIT_HOOKS):
@scripts/install-git-hooks
@echo
Expand All @@ -37,7 +45,9 @@ test: qtest scripts/driver.py
valgrind_existence:
@which valgrind 2>&1 > /dev/null

valgrind: qtest valgrind_existence
valgrind: valgrind_existence
$(MAKE) clean
$(MAKE) SANITIER=0 qtest
$(eval patched_file := $(shell mktemp /tmp/qtest.XXXXXX))
cp qtest $(patched_file)
chmod u+x $(patched_file)
Expand Down

0 comments on commit a3e0eae

Please sign in to comment.