Fix some things when building on OS X. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4762 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-11-24 08:19:50 +00:00
parent 2c7b31958a
commit f22e202d88
5 changed files with 34 additions and 23 deletions

View file

@ -268,7 +268,7 @@ ifneq ($(RELEASE)$(DEBUGANYWAY),10)
OPTIMIZATIONS += $(DEBUGFLAG) OPTIMIZATIONS += $(DEBUGFLAG)
endif endif
CONLYFLAGS=-std=gnu99 -Wimplicit CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration
CPPONLYFLAGS= -fno-exceptions -fno-rtti -Wno-write-strings CPPONLYFLAGS= -fno-exceptions -fno-rtti -Wno-write-strings
ASFORMAT=elf$(SYSBITS) ASFORMAT=elf$(SYSBITS)
ASFLAGS=-s -f $(ASFORMAT) #-g ASFLAGS=-s -f $(ASFORMAT) #-g
@ -510,7 +510,7 @@ ifeq (0,$(CLANG))
endif endif
endif endif
CWARNS := -W -Wall -Werror-implicit-function-declaration \ CWARNS := -W -Wall \
-Wpointer-arith \ -Wpointer-arith \
-Wextra \ -Wextra \
-Wno-char-subscripts \ -Wno-char-subscripts \

View file

@ -5,31 +5,14 @@
#ifndef compat_h_ #ifndef compat_h_
#define compat_h_ #define compat_h_
#include <malloc.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#ifdef __APPLE__
# include <TargetConditionals.h>
# if !TARGET_OS_IPHONE
# if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
# include <CoreFoundation/CoreFoundation.h>
# endif
# include <CoreServices/CoreServices.h>
# endif
#endif
#ifdef __GNUC__ #ifdef __GNUC__
# define EDUKE32_GCC_PREREQ(major, minor) (major > __GNUC__ || (major == __GNUC__ && minor >= __GNUC_MINOR__)) # define EDUKE32_GCC_PREREQ(major, minor) (major < __GNUC__ || (major == __GNUC__ && minor <= __GNUC_MINOR__))
#else #else
# define EDUKE32_GCC_PREREQ(major, minor) 0 # define EDUKE32_GCC_PREREQ(major, minor) 0
#endif #endif
#ifdef __clang__ #ifdef __clang__
# define EDUKE32_CLANG_PREREQ(major, minor) (major > __clang_major__ || (major == __clang_major__ && minor >= __clang_minor__)) # define EDUKE32_CLANG_PREREQ(major, minor) (major < __clang_major__ || (major == __clang_major__ && minor <= __clang_minor__))
#else #else
# define EDUKE32_CLANG_PREREQ(major, minor) 0 # define EDUKE32_CLANG_PREREQ(major, minor) 0
#endif #endif
@ -84,13 +67,34 @@
#define max(x,y) ((x) > (y) ? (x) : (y)) #define max(x,y) ((x) > (y) ? (x) : (y))
#endif #endif
#ifndef __APPLE__
# include <malloc.h>
#endif
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#ifdef __APPLE__
# include <TargetConditionals.h>
# if !TARGET_OS_IPHONE
# if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
# include <CoreFoundation/CoreFoundation.h>
# endif
# include <CoreServices/CoreServices.h>
# endif
#endif
// This gives us access to 'intptr_t' and 'uintptr_t', which are // This gives us access to 'intptr_t' and 'uintptr_t', which are
// abstractions to the size of a pointer on a given platform // abstractions to the size of a pointer on a given platform
// (ie, they're guaranteed to be the same size as a pointer) // (ie, they're guaranteed to be the same size as a pointer)
#undef __USE_MINGW_ANSI_STDIO // Workaround for MinGW-w64. #undef __USE_MINGW_ANSI_STDIO // Workaround for MinGW-w64.
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif
#ifndef __STDC_LIMIT_MACROS #ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS
#endif #endif
@ -615,7 +619,6 @@ FORCE_INLINE uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7fff
# define Bchdir chdir # define Bchdir chdir
# define Bgetcwd getcwd # define Bgetcwd getcwd
# endif # endif
# define Bmemalign memalign
# define Bopen open # define Bopen open
# define Bclose close # define Bclose close
# define Bwrite write # define Bwrite write
@ -846,6 +849,9 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
{ {
#ifdef _WIN32 #ifdef _WIN32
void *ptr = _aligned_malloc(size, alignment); void *ptr = _aligned_malloc(size, alignment);
#elif defined __APPLE__
void *ptr = NULL;
posix_memalign(&ptr, alignment, size);
#else #else
void *ptr = memalign(alignment, size); void *ptr = memalign(alignment, size);
#endif #endif

View file

@ -2,7 +2,9 @@
#ifdef USE_LIBVPX #ifdef USE_LIBVPX
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif
#ifndef __STDC_LIMIT_MACROS #ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS
#endif #endif

View file

@ -111,7 +111,8 @@ int32_t Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags);
static inline void A_ResetVars(const int32_t iActor) static inline void A_ResetVars(const int32_t iActor)
{ {
for (int i = 0; i < g_gameVarCount; i++) int i;
for (i = 0; i < g_gameVarCount; i++)
{ {
if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) == GAMEVAR_PERACTOR) if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) == GAMEVAR_PERACTOR)
aGameVars[i].val.plValues[iActor] = aGameVars[i].lDefault; aGameVars[i].val.plValues[iActor] = aGameVars[i].lDefault;

View file

@ -20,7 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif
#ifndef __STDC_LIMIT_MACROS #ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS
#endif #endif