CPPFLAGS += CXXFLAGS += -O0 -g -fomit-frame-pointer # Enable sanitizers (http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation). # # The default (SANITIZE=true) is to enable nothing. #only the LeakSanitizer. # If SANITIZE=full is specified, then the UndefinedBehaviorSanitzer and # either the ThreadSanitizer (PARASCIP=true) or the AddressSanitizer (PARASCIP=false) # are enabled (neither LeakSanitizer nor AddressSanitizer can be used together # with ThreadSanitizer). # # We currently do not activate the extra -fsanitize=unsigned-integer-overflow of the # UndefinedBehaviorSanitizer, as this is allowed behavior for hash-computations (which # happen at various places in the code). One could, however, white/blacklist these functions # (see the few places where a division by zero is allowed). SANITIZE = true ifeq ($(SANITIZE),full) ifeq ($(PARASCIP),true) # enable ThreadSanitizer (http://clang.llvm.org/docs/ThreadSanitizer.html) SANITIZERFLAGS = -fsanitize=thread else # enable AddressSanitizer (http://clang.llvm.org/docs/AddressSanitizer.html) SANITIZERFLAGS = -fsanitize=address endif # enable UndefinedBehaviorSanitizer (http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) SANITIZERFLAGS += -fsanitize=undefined endif ifeq ($(SANITIZE),true) # do not enable LeakSanitizer (http://clang.llvm.org/docs/LeakSanitizer.html) # this does not seem to work well together with Criterion # also it may prevents usage of valgrind while also not replacing it #SANITIZERFLAGS = -fsanitize=leak endif CXXFLAGS += $(SANITIZERFLAGS) LDFLAGS += $(SANITIZERFLAGS) ifeq ($(SHARED),true) LIBBUILDFLAGS += $(SANITIZERFLAGS) endif # deprecated SANITZERFLAGS = $(SANITIZERFLAGS)