Clean up warnings and build issues when building under OS X 10.9. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4644 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-10-16 21:03:24 +00:00
parent ff7d664d1e
commit 295cf82323
15 changed files with 136 additions and 66 deletions

View file

@ -519,7 +519,7 @@ $(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.c | $(ENGINE_OBJ)
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.m | $(ENGINE_OBJ)
$(COMPILE_STATUS)
$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(ENGINE_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
$(ENGINE_OBJ)/%.$o: $(ENGINE_SRC)/%.cpp | $(ENGINE_OBJ)
$(COMPILE_STATUS)
@ -579,7 +579,7 @@ $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/util/%.c | $(DUKE3D_OBJ)
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.m | $(DUKE3D_OBJ)
$(COMPILE_STATUS)
$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
$(RECIPE_IF) $(COMPILER_OBJC) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE)
$(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.cpp | $(DUKE3D_OBJ)
$(COMPILE_STATUS)

View file

@ -33,22 +33,10 @@ ifeq ($(AS),as)
override AS=nasm
endif
COMPILER_OBJC=$(CC)
L_CC=$(CC)
L_CXX=$(CXX)
CLANG?=0
ifeq ($(findstring clang,$(CC)),clang)
override CLANG=1
endif
ifneq (0,$(CLANG))
override CC=clang -x c
override CXX=clang -x c++
override L_CC=clang
override L_CXX=clang
endif
CCFULLPATH=$(CC)
ifeq ($(PLATFORM),WII)
@ -64,6 +52,26 @@ ifeq ($(PLATFORM),WII)
STRIP=powerpc-eabi-strip
endif
CLANG?=0
CLANG_POTENTIAL_VERSION := $(shell $(CCFULLPATH) --version)
ifeq ($(findstring clang,$(CC)),clang)
override CLANG=1
endif
# detect clang symlinked as gcc, as in OS X
ifeq ($(findstring clang,$(CLANG_POTENTIAL_VERSION)),clang)
override CLANG=1
endif
ifneq (0,$(CLANG))
override CC=clang -x c
override CXX=clang -x c++
override COMPILER_OBJC=clang -x objective-c
override L_CC=clang
override L_CXX=clang
endif
# GCC version, for conditional selection of flags.
ifndef GCC_MAJOR
GCC_MAJOR := $(shell $(CCFULLPATH) -dumpversion 2>&1 | cut -d'.' -f1)
@ -303,8 +311,14 @@ ifeq ($(PLATFORM),DARWIN)
ifndef DARWINVERSION
DARWINVERSION:=$(strip $(shell uname -r | cut -d . -f 1))
endif
DARWIN9 ?= 0
DARWIN10 ?= 0
ifeq (1,$(strip $(shell expr $(DARWINVERSION) \< 10)))
DARWIN9 ?= 1
override DARWIN9 := 1
endif
ifeq (1,$(strip $(shell expr $(DARWINVERSION) \< 11)))
override DARWIN10 := 1
endif
# COMMONFLAGS += -fno-leading-underscore
@ -405,11 +419,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
ifneq ($(PLATFORM),WINDOWS)
CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size
# CLANG_DEBUG_FLAGS := -fsanitize=address -fsanitize=bounds,enum,float-cast-overflow,object-size -fsanitize-undefined-trap-on-error
# CLANG_DEBUG_FLAGS := $(CLANG_DEBUG_FLAGS),signed-integer-overflow
# CLANG_DEBUG_FLAGS := $(CLANG_DEBUG_FLAGS),unsigned-integer-overflow
endif
ifneq (0,$(RELEASE))
# Debugging disabled
@ -429,9 +441,9 @@ ifneq (0,$(RELEASE))
COMPILERFLAGS += -DNDEBUG
else
COMPILERFLAGS += -DDEBUGGINGAIDS
ifneq (0,$(CLANG))
COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
endif
# ifneq (0,$(CLANG))
# COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
# endif
endif
ifneq (0,$(LTO))
COMPILERFLAGS += -DUSING_LTO
@ -451,9 +463,9 @@ else
COMPILERFLAGS += -DDEBUGGINGAIDS=2
endif
ifneq (0,$(CLANG))
COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
endif
# ifneq (0,$(CLANG))
# COMMONFLAGS += $(CLANG_DEBUG_FLAGS)
# endif
ifeq ($(SUBPLATFORM),LINUX)
LIBS+=-rdynamic
endif
@ -595,7 +607,7 @@ DLLSUFFIX=.so
SDL_TARGET ?= 2
SDL_FRAMEWORK ?= 1
SDL_FRAMEWORK ?= 0
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \>= 4)))
L_SSP := -lssp
@ -651,15 +663,27 @@ ifeq ($(PLATFORM),DARWIN)
ASFORMAT=macho$(SYSBITS)
ASFLAGS+= -DUNDERSCORES
# include port and brew
LIBDIRS+= -Lplatform/Apple/lib -L/opt/local/lib -L/usr/local/lib
COMPILERFLAGS+= -Iplatform/Apple/include -I/opt/local/include -I/sw/include -I/usr/local/include
LIBDIRS+= -Lplatform/Apple/lib
COMPILERFLAGS+= -Iplatform/Apple/include
ifneq ($(shell port --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/opt/local/lib
COMPILERFLAGS+= -I/opt/local/include
endif
ifneq ($(shell brew --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/usr/local/lib
COMPILERFLAGS+= -I/usr/local/include
endif
ifneq ($(shell fink --version &>/dev/null; echo $$?),127)
LIBDIRS+= -L/sw/lib
COMPILERFLAGS+= -I/sw/include
endif
RENDERTYPE = SDL
MIXERTYPE = SDL
STDCPPLIB:=-lstdc++
COMPILERFLAGS += -DHAVE_INTTYPES
DLLSUFFIX=.dylib # ???
DLLSUFFIX=.dylib
GTKCOMPAT32 = 0
WITHOUT_GTK ?= 1
@ -944,7 +968,9 @@ ifneq ($(PLATFORM),WINDOWS)
ifneq ($(PLATFORM),WII)
LIBS+= -ldl
endif
LIBS+= -pthread
ifneq ($(PLATFORM),DARWIN)
LIBS+= -pthread
endif
endif
ifeq ($(PLATFORM),WINDOWS)

View file

@ -519,6 +519,12 @@ extern bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
#endif
// GLU
#if defined __clang__ && defined __APPLE__
// XXX: OS X 10.9 deprecated GLUtesselator.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
typedef void (APIENTRY * bgluTessBeginContourProcPtr)(GLUtesselator* tess);
extern bgluTessBeginContourProcPtr bgluTessBeginContour;
typedef void (APIENTRY * bgluTessBeginPolygonProcPtr)(GLUtesselator* tess, GLvoid* data);
@ -540,6 +546,10 @@ extern bgluNewTessProcPtr bgluNewTess;
typedef void (APIENTRY * bgluDeleteTessProcPtr)(GLUtesselator* tess);
extern bgluDeleteTessProcPtr bgluDeleteTess;
#if defined __clang__ && defined __APPLE__
#pragma clang diagnostic pop
#endif
typedef void (APIENTRY * bgluPerspectiveProcPtr)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
extern bgluPerspectiveProcPtr bgluPerspective;

View file

@ -2,7 +2,7 @@
#define __osxbits_h__
#include <sys/types.h>
int32_t osx_msgbox(char *name, char *msg);
int32_t osx_ynbox(char *name, char *msg);
int32_t osx_msgbox(const char *name, const char *msg);
int32_t osx_ynbox(const char *name, const char *msg);
#endif
#endif

View file

@ -53,7 +53,7 @@ Minimum required SDL versions:
# endif
# else
# if (SDL_TARGET == 2)
# include <SDL2_mixer/SDL_mixer.h>
# include <SDL2/SDL_mixer.h>
# else
# include <SDL_mixer/SDL_mixer.h>
# endif

View file

@ -5,13 +5,7 @@
Feel free to customize this file to suit your needs
*/
#if defined(SDL_FRAMEWORK)
# include <SDL/SDL.h>
#else
# include "SDL.h"
#endif
#include "SDLMain.h"
#include "sdl_inc.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>

View file

@ -1,3 +1,4 @@
#include "compat.h"
#include "osxbits.h"
#import <Cocoa/Cocoa.h>
@ -5,18 +6,18 @@
# define MAC_OS_VERSION_10_3 1030
#endif
int osx_msgbox(char *name, char *msg)
int osx_msgbox(const char *name, const char *msg)
{
NSString *mmsg = [[NSString alloc] initWithCString: msg];
NSString *mmsg = [[NSString alloc] initWithUTF8String:msg];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: @"OK"];
[alert setInformativeText: mmsg];
[alert setAlertStyle: NSInformationalAlertStyle];
[alert runModal];
[alert release];
#else
@ -24,12 +25,15 @@ int osx_msgbox(char *name, char *msg)
#endif
[mmsg release];
UNREFERENCED_PARAMETER(name);
return 0;
}
int osx_ynbox(char *name, char *msg)
int osx_ynbox(const char *name, const char *msg)
{
NSString *mmsg = [[NSString alloc] initWithCString: msg];
NSString *mmsg = [[NSString alloc] initWithUTF8String:msg];
int r;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
@ -39,7 +43,7 @@ int osx_ynbox(char *name, char *msg)
[alert addButtonWithTitle:@"No"];
[alert setInformativeText: mmsg];
[alert setAlertStyle: NSInformationalAlertStyle];
r = ([alert runModal] == NSAlertFirstButtonReturn);
[alert release];
@ -48,5 +52,8 @@ int osx_ynbox(char *name, char *msg)
#endif
[mmsg release];
UNREFERENCED_PARAMETER(name);
return r;
}

View file

@ -688,7 +688,15 @@ int16_t viewangle;
int32_t depth;
_prmirror mirrors[10];
#if defined __clang__ && defined __APPLE__
// XXX: OS X 10.9 deprecated GLUtesselator.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
GLUtesselator* prtess;
#if defined __clang__ && defined __APPLE__
#pragma clang diagnostic pop
#endif
static int16_t cursky;
static char curskypal;

View file

@ -106,7 +106,9 @@ static float lastvidgcb[3];
//static SDL_Surface * loadtarga(const char *fn); // for loading the icon
static SDL_Surface *appicon = NULL;
#if !defined(__APPLE__) && !defined(__ANDROID__)
static SDL_Surface *loadappicon(void);
#endif
static mutex_t m_initprintf;

View file

@ -32,20 +32,27 @@ static id nsapp;
- (IBAction)alwaysShowClicked:(id)sender
{
UNREFERENCED_PARAMETER(sender);
}
- (IBAction)fullscreenClicked:(id)sender
{
UNREFERENCED_PARAMETER(sender);
// XXX: recalculate the video modes list to take into account the fullscreen status
}
- (IBAction)cancel:(id)sender
{
UNREFERENCED_PARAMETER(sender);
[nsapp abortModal];
}
- (IBAction)start:(id)sender
{
UNREFERENCED_PARAMETER(sender);
// XXX: write the states of the form controls to their respective homes
[nsapp stopModal];
}
@ -146,7 +153,7 @@ int startwin_puts(const char *s)
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
ns = [[NSString alloc] initWithUTF8String:s];
[startwin putsMessage:ns];
[ns release];
@ -160,7 +167,7 @@ int startwin_settitle(const char *s)
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
ns = [[NSString alloc] initWithUTF8String:s];
[startwin setTitle:ns];
[ns release];
@ -169,6 +176,8 @@ int startwin_settitle(const char *s)
int startwin_idle(void *v)
{
UNREFERENCED_PARAMETER(v);
if (startwin) [[startwin window] displayIfNeeded];
return 0;
}

View file

@ -7,7 +7,7 @@
*
*/
@interface GameListSource : NSObject
@interface GameListSource : NSObject <NSComboBoxDataSource>
{
NSMutableArray *list;
}
@ -17,7 +17,7 @@
- (int)findIndexForGrpname:(NSString*)grpname;
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex;
row:(NSInteger)rowIndex;
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
@end

View file

@ -9,6 +9,8 @@
#import <Cocoa/Cocoa.h>
#include "compat.h"
#import "GrpFile.game.h"
#import "GameListSource.game.h"
@ -25,7 +27,7 @@
for (p = foundgrps; p; p=p->next) {
for (i=0; i<NUMGRPFILES; i++) if (p->crcval == internalgrpfiles[i].crcval) break;
if (i == NUMGRPFILES) continue;
[list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithCString:internalgrpfiles[i].name]]];
[list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithCString:internalgrpfiles[i].name encoding:NSUTF8StringEncoding]]];
}
}
@ -45,8 +47,8 @@
- (int)findIndexForGrpname:(NSString*)grpname
{
int i;
for (i=0; i<[list count]; i++) {
NSUInteger i, listcount = [list count];
for (i=0; i<listcount; i++) {
if ([[[list objectAtIndex:i] grpname] isEqual:grpname]) return i;
}
return -1;
@ -54,9 +56,11 @@
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
row:(NSInteger)rowIndex
{
NSParameterAssert(rowIndex >= 0 && rowIndex < [list count]);
UNREFERENCED_PARAMETER(aTableView);
NSParameterAssert((NSUInteger)rowIndex < [list count]);
switch ([[aTableColumn identifier] intValue]) {
case 0: // name column
return [[list objectAtIndex:rowIndex] name];
@ -68,6 +72,8 @@
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
UNREFERENCED_PARAMETER(aTableView);
return [list count];
}
@end

View file

@ -31,7 +31,7 @@
}
- (NSString *)grpname
{
return [NSString stringWithCString:(fg->name)];
return [NSString stringWithCString:(fg->name) encoding:NSUTF8StringEncoding];
}
- (struct grpfile *)entryptr
{

View file

@ -11240,6 +11240,7 @@ int32_t app_main(int32_t argc, const char **argv)
#ifdef __APPLE__
if (!usecwd)
{
char cwd[BMAX_PATH];
char *homedir = Bgethomedir();
if (homedir)
Bsnprintf(cwd, sizeof(cwd), "%s/Library/Logs/eduke32.log", homedir);

View file

@ -79,7 +79,7 @@ static struct soundQuality_t {
{
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
int idx3d = -1;
int xdim, ydim, bpp;
int xdim = 0, ydim = 0, bpp = 0;
if (firstTime) {
xdim = settings.xdim3d;
@ -180,20 +180,27 @@ static struct soundQuality_t {
- (IBAction)alwaysShowClicked:(id)sender
{
UNREFERENCED_PARAMETER(sender);
}
- (IBAction)fullscreenClicked:(id)sender
{
UNREFERENCED_PARAMETER(sender);
[self populateVideoModes:NO];
}
- (IBAction)cancel:(id)sender
{
UNREFERENCED_PARAMETER(sender);
[nsapp abortModal];
}
- (IBAction)start:(id)sender
{
UNREFERENCED_PARAMETER(sender);
int mode = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue];
if (mode >= 0) {
settings.xdim3d = validmode[mode].xdim;
@ -241,7 +248,7 @@ static struct soundQuality_t {
[[gameList documentView] setDataSource:gamelistsrc];
[[gameList documentView] deselectAll:nil];
int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.selectedgrp]];
int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.selectedgrp encoding:NSUTF8StringEncoding]];
if (row >= 0) {
[[gameList documentView] scrollRowToVisible:row];
#if defined(MAC_OS_X_VERSION_10_3) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3)
@ -308,8 +315,6 @@ static StartupWinController *startwin = nil;
int startwin_open(void)
{
// PK: is this the entry point?
// fix for "ld: absolute address to symbol _NSApp in a different linkage unit not supported"
// (OS X 10.6) when building for PPC
nsapp = [NSApplication sharedApplication];
@ -323,7 +328,7 @@ int startwin_open(void)
static int soundQualityFrequencies[] = { 48000, 44100, 32000, 24000, 22050 };
static int soundQualitySampleSizes[] = { 16, 8 };
static int soundQualityChannels[] = { 2, 1 };
int f, b, c, i;
size_t f, b, c, i;
i = sizeof(soundQualityFrequencies) *
sizeof(soundQualitySampleSizes) *
@ -373,7 +378,7 @@ int startwin_puts(const char *s)
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
ns = [[NSString alloc] initWithUTF8String:s];
[startwin putsMessage:ns];
[ns release];
@ -387,7 +392,7 @@ int startwin_settitle(const char *s)
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
ns = [[NSString alloc] initWithUTF8String:s];
[startwin setTitle:ns];
[ns release];
@ -396,6 +401,8 @@ int startwin_settitle(const char *s)
int startwin_idle(void *v)
{
UNREFERENCED_PARAMETER(v);
if (startwin) [[startwin window] displayIfNeeded];
return 0;
}