diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index fbebc71c7..d68b68216 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -77,11 +77,21 @@ ifneq (0,$(USE_LIBVPX)) LIBS+= -lvpx endif + +ifneq ($(RELEASE)$(DEBUGANYWAY),10) + # debug build or DEBUGANYWAY=1 --> -g flag + ifeq ($(CC),clang) + debug=-g + else + debug=-ggdb + endif +endif + ifneq (0,$(RELEASE)) # Debugging disabled - debug=-O$(OPTLEVEL) + debug+= -O$(OPTLEVEL) ifneq ($(CC),clang) - debug=-funswitch-loops + debug+= -funswitch-loops endif ifeq (0,$(DEBUGANYWAY)) debug+= -fomit-frame-pointer -DNDEBUG @@ -92,7 +102,8 @@ ifneq (0,$(RELEASE)) endif else # Debugging enabled - debug=-ggdb -O0 + debug+= -O0 + ifeq (0,$(DEBUGANYWAY)) debug+= -DDEBUGGINGAIDS else @@ -100,7 +111,11 @@ else endif ifeq ($(CC),clang) +# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }') debug+= -fcatch-undefined-behavior +# ifeq ($(CLANG_MAJOR),3) +# debug+= -faddress-sanitizer +# endif endif ifeq ($(PLATFORM),LINUX) LIBS+=-rdynamic @@ -118,9 +133,6 @@ else debug+=-DKRANDDEBUG=1 endif endif -ifneq (0,$(DEBUGANYWAY)) - debug+=-ggdb -endif ifneq ($(CC),clang) W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result) diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 7146ac83f..652d0875a 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -86,6 +86,11 @@ static __inline int32_t _lrotl(int32_t i, int sh) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +#if defined __clang__ && __clang_major__==3 +// clang 3.1 SVN r149129, assertion failure with inline asm +# define NOASM 1 +#endif + #if defined(__GNUC__) #define _inline inline #endif