A couple of Makefile tweaks for clang 3.1 from SVN, and a workaround

for an assertion failure with clang. Really ought to file a bug report instead.

git-svn-id: https://svn.eduke32.com/eduke32@2292 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-01-28 14:36:52 +00:00
parent 3a0734a7b0
commit 0f36ef92ee
2 changed files with 23 additions and 6 deletions

View file

@ -77,11 +77,21 @@ ifneq (0,$(USE_LIBVPX))
LIBS+= -lvpx LIBS+= -lvpx
endif 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)) ifneq (0,$(RELEASE))
# Debugging disabled # Debugging disabled
debug=-O$(OPTLEVEL) debug+= -O$(OPTLEVEL)
ifneq ($(CC),clang) ifneq ($(CC),clang)
debug=-funswitch-loops debug+= -funswitch-loops
endif endif
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
debug+= -fomit-frame-pointer -DNDEBUG debug+= -fomit-frame-pointer -DNDEBUG
@ -92,7 +102,8 @@ ifneq (0,$(RELEASE))
endif endif
else else
# Debugging enabled # Debugging enabled
debug=-ggdb -O0 debug+= -O0
ifeq (0,$(DEBUGANYWAY)) ifeq (0,$(DEBUGANYWAY))
debug+= -DDEBUGGINGAIDS debug+= -DDEBUGGINGAIDS
else else
@ -100,7 +111,11 @@ else
endif endif
ifeq ($(CC),clang) ifeq ($(CC),clang)
# CLANG_MAJOR := $(shell clang -dM -E -x c /dev/null | grep __clang_major__ | awk '{ print $$3 }')
debug+= -fcatch-undefined-behavior debug+= -fcatch-undefined-behavior
# ifeq ($(CLANG_MAJOR),3)
# debug+= -faddress-sanitizer
# endif
endif endif
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
LIBS+=-rdynamic LIBS+=-rdynamic
@ -118,9 +133,6 @@ else
debug+=-DKRANDDEBUG=1 debug+=-DKRANDDEBUG=1
endif endif
endif endif
ifneq (0,$(DEBUGANYWAY))
debug+=-ggdb
endif
ifneq ($(CC),clang) ifneq ($(CC),clang)
W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result) W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result)

View file

@ -86,6 +86,11 @@ static __inline int32_t _lrotl(int32_t i, int sh)
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
#endif #endif
#if defined __clang__ && __clang_major__==3
// clang 3.1 SVN r149129, assertion failure with inline asm
# define NOASM 1
#endif
#if defined(__GNUC__) #if defined(__GNUC__)
#define _inline inline #define _inline inline
#endif #endif