From 8db0c9c7292a19a634ee4c4369ff17cf5ecbbf6b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 10 Feb 2014 10:55:13 +0000 Subject: [PATCH] Fix errors and warnings with LLVM/clang 3.4 Windows. git-svn-id: https://svn.eduke32.com/eduke32@4315 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile.common | 4 +++- polymer/eduke32/build/Makefile.shared | 7 +++++-- polymer/eduke32/build/src/engine.c | 2 +- polymer/eduke32/build/src/kplib.c | 6 ++++++ polymer/eduke32/build/src/polymost.c | 6 ------ polymer/eduke32/build/src/winbits.c | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index 133c96833..760814cdf 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -356,7 +356,9 @@ endif # See http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation # for a list of possible UBSan options. # Clang 3.2 does only supports -fsanitize=address for the AddressSanitizer -CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size +ifneq ($(PLATFORM),WINDOWS) + CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size +endif ifneq (0,$(RELEASE)) # Debugging disabled diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 319ccbf9a..5deb7a273 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -102,7 +102,10 @@ ifeq ($(PLATFORM),WINDOWS) SDL_FRAMEWORK=1 BUILDCOMMONFLAGS+= -DHAVE_INTTYPES EXESUFFIX=.exe - BUILDLIBS+= -Wl,--enable-auto-import -mwindows -lmingwex -lcomctl32 -lwinmm $(L_SSP) -lwsock32 -lws2_32 -lshlwapi + BUILDLIBS+= -Wl,--enable-auto-import -lmingwex -lgdi32 -lcomctl32 -lwinmm $(L_SSP) -lwsock32 -lws2_32 -lshlwapi + ifeq (0,$(CLANG)) + BUILDLIBS+= -mwindows + endif #-lshfolder #BUILDLIBDIRS+= -L$(ENETROOT) STDCPPLIB:=-lstdc++ @@ -228,7 +231,7 @@ ifeq ($(RENDERTYPE),SDL) BUILDLIBS+= -static endif endif - BUILDLIBS+= -l$(SDLNAME)main -l$(SDLNAME) -lmingw32 -limm32 -lole32 -loleaut32 -lwinmm -lversion + BUILDLIBS+= -l$(SDLNAME)main -l$(SDLNAME) -lmingw32 -lgdi32 -limm32 -lole32 -loleaut32 -lwinmm -lversion endif ifeq (1,$(WITHOUT_GTK)) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index feb6c7a14..ba204d21f 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -69,13 +69,13 @@ LUNATIC_EXTERN const int32_t engine_main_arrays_are_static = 0; // for Lunatic # else LUNATIC_EXTERN const int32_t engine_main_arrays_are_static = 1; # endif -#endif #if MAXSECTORS==MAXSECTORSV8 LUNATIC_EXTERN const int32_t engine_v8 = 1; #else LUNATIC_EXTERN const int32_t engine_v8 = 0; #endif +#endif #ifdef DEBUGGINGAIDS float debug1, debug2; diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 5a2432638..fb1929d94 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -206,6 +206,7 @@ static uint8_t qhufbit0[1<>8) + ((a&0xff00)<<8) + (a<<24) + (a>>24)); } +#endif static inline int32_t bitrev(int32_t b, int32_t c) { diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 936bc7c9b..622dcfea3 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -195,12 +195,6 @@ int32_t r_parallaxskypanning = 0; #define MIN_CACHETIME_PRINT 10 -static inline int32_t imod(int32_t a, int32_t b) -{ - if (a >= 0) return(a%b); - return(((a+1)%b)+b-1); -} - void drawline2d(float x0, float y0, float x1, float y1, char col) { float f, dx, dy, fxres, fyres; diff --git a/polymer/eduke32/build/src/winbits.c b/polymer/eduke32/build/src/winbits.c index 6ac120201..55b8bf060 100644 --- a/polymer/eduke32/build/src/winbits.c +++ b/polymer/eduke32/build/src/winbits.c @@ -283,6 +283,6 @@ int32_t addsearchpath_ProgramFiles(const char *p) // Workaround for a bug in mingwrt-4.0.0 and up where a function named main() in misc/src/libcrt/gdtoa/qnan.c takes precedence over the proper one in src/libcrt/crt/main.c. -#if defined __MINGW32__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 8 +#if (defined __MINGW32__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 8) || (defined __clang__ && __clang_major__ == 3 && __clang_minor__ >= 4) # include "mingw_main.c" #endif