Fix debugging builds with Clang 3.2 and up.

In those Clang versions, -fcatch-undefined-behavior was replaced by
-fsanitize=<what>.  For Clang 3.2, we enable the address sanitizer
and for 3.3 also the miscellaneous undefined behavior one.
Currently, there's no version auto-detection from the Makefiles, it's
set to 3.3 and the others are commented out.

git-svn-id: https://svn.eduke32.com/eduke32@3716 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-29 19:24:15 +00:00
parent c6d7c08d58
commit bdecbc45db
2 changed files with 8 additions and 7 deletions

View file

@ -345,12 +345,13 @@ else
endif
ifneq (0,$(CLANG))
# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }')
# KEEPINSYNC with build/Makefile:
BASECFLAGS+= -Xclang -fcatch-undefined-behavior
# ifeq ($(CLANG_MAJOR),3)
# debug+= -faddress-sanitizer
# endif
# Older Clang (2.9?)
# BASECFLAGS+= -Xclang -fcatch-undefined-behavior
# Clang 3.2
# debug+= -fsanitize=address
# Clang 3.3 or SVN
debug+= -fsanitize=address -fsanitize=undefined
endif
ifeq ($(SUBPLATFORM),LINUX)
BASELIBS+=-rdynamic

View file

@ -290,8 +290,8 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
# Comment out the following rule to debug a-c.o
$(OBJ)/a-c.$o: $(SRC)/a-c.c
$(COMPILE_STATUS)
if $(COMPILER) $(subst -O0,-O2,$(subst -Xclang -fcatch-undefined-behavior,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# KEEPINSYNC the "... -fcatch-undefined-behavior" with Makefile.common
if $(COMPILER) $(subst -O0,-O2,$(subst -fsanitize=address -fsanitize=undefined,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# KEEPINSYNC the Clang -f option(s) with Makefile.common
$(OBJ)/%.$o: $(SRC)/%.c
$(COMPILE_STATUS)