- Fixed: All clang 5.0 warnings.

- Renamed autostart/autozend since Xcode’s build process links in strictly alphabetical order.
This commit is contained in:
Braden Obrzut 2014-01-05 19:50:09 -05:00
parent cd3f5db16a
commit d8ff4ec281
31 changed files with 57 additions and 81 deletions

View file

@ -3,7 +3,7 @@ cmake_minimum_required( VERSION 2.4 )
make_release_only()
if( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -fomit-frame-pointer" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
endif( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
add_library( jpeg

View file

@ -412,7 +412,7 @@ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
set( CMAKE_CXX_FLAGS_MINSIZEREL "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
set( CMAKE_CXX_FLAGS "-Wall -Wno-unused -Wextra -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" )
# Remove extra warnings when using the official DirectX headers.
# Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid,
@ -748,7 +748,7 @@ set( NOT_COMPILED_SOURCE_FILES
add_executable( zdoom WIN32
${HEADER_FILES}
${NOT_COMPILED_SOURCE_FILES}
autostart.cpp
__autostart.cpp
${ASM_SOURCES}
${SYSTEM_SOURCES}
${X86_SOURCES}
@ -1052,7 +1052,7 @@ add_executable( zdoom WIN32
r_data/renderstyle.cpp
r_data/r_interpolate.cpp
r_data/r_translate.cpp
autozend.cpp
zzautozend.cpp
)
set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" )
@ -1160,7 +1160,7 @@ source_group("Render Data\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE
source_group("Render Interface" FILES r_defs.h r_renderer.h r_sky.cpp r_sky.h r_state.h r_utility.cpp r_utility.h)
source_group("Resource Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/resourcefiles/.+")
source_group("SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sdl/.+")
source_group("SFML" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
source_group("SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
source_group("Shared Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_shared/.+")
source_group("Versioning" FILES version.h win32/zdoom.rc)
source_group("Win32 Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/win32/.+")

View file

@ -610,8 +610,6 @@ static int FlushLines (const char *start, const char *stop)
break;
}
}
if (i != TopLine)
i = i;
return i;
}

View file

@ -370,8 +370,8 @@ extern "C" void bz_internal_error (int errcode)
//
//==========================================================================
static void *SzAlloc(void *p, size_t size) { p = p; return malloc(size); }
static void SzFree(void *p, void *address) { p = p; free(address); }
static void *SzAlloc(void *, size_t size) { return malloc(size); }
static void SzFree(void *, void *address) { free(address); }
ISzAlloc g_Alloc = { SzAlloc, SzFree };
FileReaderLZMA::FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip)

View file

@ -73,6 +73,7 @@ public:
~DHUDPicManager() {}
void Serialize(FArchive & ar);
virtual void DoDraw (int linenum, int x, int y, int hudheight, float translucent);
void DoDraw (int, int, int, bool, int) { assert(false); }
} ;
IMPLEMENT_CLASS(DHUDPicManager)

View file

@ -303,6 +303,8 @@ class SBarInfoMainBlock : public SBarInfoCommandFlowControl
int Alpha() const { return currentAlpha; }
// Same as Draw but takes into account ForceScaled and temporarily sets the scaling if needed.
void DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statusBar, int xOffset, int yOffset, int alpha);
// Silence hidden overload warning since this is a special use class.
using SBarInfoCommandFlowControl::Draw;
void Draw(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, int xOffset, int yOffset, int alpha)
{
this->xOffset = xOffset;

View file

@ -74,12 +74,12 @@ public:
{
}
double GetValue()
double GetSliderValue()
{
return SELECTED_JOYSTICK->GetSensitivity();
}
void SetValue(double val)
void SetSliderValue(double val)
{
SELECTED_JOYSTICK->SetSensitivity(float(val));
}
@ -104,14 +104,14 @@ public:
mNeg = 1;
}
double GetValue()
double GetSliderValue()
{
double d = SELECTED_JOYSTICK->GetAxisScale(mAxis);
mNeg = d < 0? -1:1;
return d;
}
void SetValue(double val)
void SetSliderValue(double val)
{
SELECTED_JOYSTICK->SetAxisScale(mAxis, float(val * mNeg));
}
@ -136,14 +136,14 @@ public:
mNeg = 1;
}
double GetValue()
double GetSliderValue()
{
double d = SELECTED_JOYSTICK->GetAxisDeadZone(mAxis);
mNeg = d < 0? -1:1;
return d;
}
void SetValue(double val)
void SetSliderValue(double val)
{
SELECTED_JOYSTICK->SetAxisDeadZone(mAxis, float(val * mNeg));
}

View file

@ -553,7 +553,6 @@ public:
}
~FOptionMenuItem();
virtual bool CheckCoordinate(FOptionMenuDescriptor *desc, int x, int y);
virtual int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected);
virtual bool Selectable();
virtual int GetIndent();

View file

@ -468,11 +468,6 @@ FOptionMenuItem::~FOptionMenuItem()
if (mLabel != NULL) delete [] mLabel;
}
bool FOptionMenuItem::CheckCoordinate(FOptionMenuDescriptor *desc, int x, int y)
{
return false;
}
int FOptionMenuItem::Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
{
return indent;

View file

@ -560,8 +560,8 @@ public:
mSliderShort = 0;
}
virtual double GetValue() = 0;
virtual void SetValue(double val) = 0;
virtual double GetSliderValue() = 0;
virtual void SetSliderValue(double val) = 0;
//=============================================================================
//
@ -614,14 +614,14 @@ public:
{
drawLabel(indent, y, selected? OptionSettings.mFontColorSelection : OptionSettings.mFontColor);
mDrawX = indent + CURSORSPACE;
DrawSlider (mDrawX, y, mMin, mMax, GetValue(), mShowValue, indent);
DrawSlider (mDrawX, y, mMin, mMax, GetSliderValue(), mShowValue, indent);
return indent;
}
//=============================================================================
bool MenuEvent (int mkey, bool fromcontroller)
{
double value = GetValue();
double value = GetSliderValue();
if (mkey == MKEY_Left)
{
@ -635,7 +635,7 @@ public:
{
return FOptionMenuItem::MenuEvent(mkey, fromcontroller);
}
SetValue(clamp(value, mMin, mMax));
SetSliderValue(clamp(value, mMin, mMax));
S_Sound (CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE);
return true;
}
@ -662,9 +662,9 @@ public:
x = clamp(x, slide_left, slide_right);
double v = mMin + ((x - slide_left) * (mMax - mMin)) / (slide_right - slide_left);
if (v != GetValue())
if (v != GetSliderValue())
{
SetValue(v);
SetSliderValue(v);
//S_Sound (CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE);
}
if (type == DMenu::MOUSE_Click)
@ -692,7 +692,7 @@ public:
mCVar = FindCVar(menu, NULL);
}
double GetValue()
double GetSliderValue()
{
if (mCVar != NULL)
{
@ -704,7 +704,7 @@ public:
}
}
void SetValue(double val)
void SetSliderValue(double val)
{
if (mCVar != NULL)
{
@ -732,12 +732,12 @@ public:
mPVal = pVal;
}
double GetValue()
double GetSliderValue()
{
return *mPVal;
}
void SetValue(double val)
void SetSliderValue(double val)
{
*mPVal = (float)val;
}

View file

@ -504,10 +504,6 @@ int FNodeBuilder::SelectSplitter (DWORD set, node_t &node, DWORD &splitseg, int
nosplitters = true;
}
}
else
{
pseg = pseg;
}
}
seg = pseg->next;

View file

@ -139,7 +139,7 @@ DiskWriterIO::~DiskWriterIO()
//
//==========================================================================
int DiskWriterIO::OPLinit(uint numchips, bool dontcare)
int DiskWriterIO::OPLinit(uint numchips, bool, bool)
{
// If the file extension is unknown or not present, the default format
// is RAW. Otherwise, you can use DRO.

View file

@ -195,7 +195,7 @@ struct DiskWriterIO : public OPLio
DiskWriterIO(const char *filename);
~DiskWriterIO();
int OPLinit(uint numchips, bool notused=false);
int OPLinit(uint numchips, bool notused=false, bool notused2=false);
void OPLdeinit();
void OPLwriteReg(int which, uint reg, uchar data);
void SetClockRate(double samples_per_tick);

View file

@ -15,7 +15,6 @@ public:
virtual void WriteReg(int reg, int v) = 0;
virtual void Update(float *buffer, int length) = 0;
virtual void SetPanning(int c, float left, float right) = 0;
virtual FString GetVoiceString() { return FString(); }
};
OPLEmul *YM3812Create(bool stereo);

View file

@ -6807,12 +6807,16 @@ scriptwait:
break;
case PCD_PRINTBINARY:
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))
#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6)))) || defined(__clang__)
#define HAS_DIAGNOSTIC_PRAGMA
#endif
#ifdef HAS_DIAGNOSTIC_PRAGMA
#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wformat-invalid-specifier"
#else
#pragma GCC diagnostic ignored "-Wformat="
#endif
#pragma GCC diagnostic ignored "-Wformat-extra-args"
#endif
work.AppendFormat ("%B", STACK(1));

View file

@ -364,8 +364,6 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
{
static int dieticks[MAXPLAYERS];
int pnum = int(this->player-players);
if (dieticks[pnum] == gametic)
gametic=gametic;
dieticks[pnum] = gametic;
fprintf (debugfile, "died (%d) on tic %d (%s)\n", pnum, gametic,
this->player->cheats&CF_PREDICTING?"predicting":"real");

View file

@ -230,8 +230,6 @@ fixed_t sector_t::FindNextLowestFloor (vertex_t **v) const
check = lines[i];
if (NULL != (other = getNextSector (check, this)))
{
if (other - sectors == 6)
other = other;
ofloor = other->floorplane.ZatPoint (check->v1);
floor = floorplane.ZatPoint (check->v1);
if (ofloor < floor && floor - ofloor < heightdiff && !IsLinked(other, false))

View file

@ -706,10 +706,6 @@ void R_EnterMirror (drawseg_t *ds, int depth)
R_EnterMirror (drawsegs + WallMirrors[mirrorsAtStart], depth + 1);
}
}
else
{
depth = depth;
}
viewangle = startang;
viewx = startx;

View file

@ -560,7 +560,7 @@ static visplane_t *new_visplane (unsigned hash)
{
check = (visplane_t *)M_Malloc (sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2));
memset(check, 0, sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2));
check->bottom = &check->top[MAXWIDTH+2];
check->bottom = check->top + MAXWIDTH+2;
}
else if (NULL == (freetail = freetail->next))
{

View file

@ -192,7 +192,7 @@ static size_t safe_write(int fd, const void *buf, size_t len)
static void crash_catcher(int signum, siginfo_t *siginfo, void *context)
{
ucontext_t *ucontext = (ucontext_t*)context;
//ucontext_t *ucontext = (ucontext_t*)context;
pid_t dbg_pid;
int fd[2];

View file

@ -719,7 +719,7 @@ bool I_WriteIniFailed ()
static const char *pattern;
#if defined(__APPLE__) && !defined(__llvm__)
#if defined(__APPLE__) && !defined(__MAC_10_8)
static int matchfile (struct dirent *ent)
#else
static int matchfile (const struct dirent *ent)

View file

@ -48,13 +48,16 @@ enum
static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
// Class to convert the IWAD data into a form that Cocoa can use.
@interface IWADTableData : NSObject// <NSTableViewDataSource>
@interface IWADTableData : NSObject
#ifdef __MAC_10_6
<NSTableViewDataSource>
#endif
{
NSMutableArray *data;
}
- (void)dealloc;
- (IWADTableData *)init:(WadStuff *) wads:(int) numwads;
- (IWADTableData *)init:(WadStuff *) wads num:(int) numwads;
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
@ -69,7 +72,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
[super dealloc];
}
- (IWADTableData *)init:(WadStuff *) wads:(int) numwads
- (IWADTableData *)init:(WadStuff *) wads num:(int) numwads
{
data = [[NSMutableArray alloc] initWithCapacity:numwads];
@ -116,13 +119,13 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
- (void)buttonPressed:(id) sender;
- (void)doubleClicked:(id) sender;
- (void)makeLabel:(NSTextField *)label:(const char*) str;
- (int)pickIWad:(WadStuff *)wads:(int) numwads:(bool) showwin:(int) defaultiwad;
- (void)makeLabel:(NSTextField *)label withString:(const char*) str;
- (int)pickIWad:(WadStuff *)wads num:(int) numwads showWindow:(bool) showwin defaultWad:(int) defaultiwad;
@end
@implementation IWADPicker
- (void)buttonPressed:(id) sender;
- (void)buttonPressed:(id) sender
{
if(sender == cancelButton)
cancelled = true;
@ -131,7 +134,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
[app stopModal];
}
- (void)doubleClicked:(id) sender;
- (void)doubleClicked:(id) sender
{
if ([sender clickedRow] >= 0)
{
@ -142,7 +145,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
// Apparently labels in Cocoa are uneditable text fields, so lets make this a
// little more automated.
- (void)makeLabel:(NSTextField *)label:(const char*) str
- (void)makeLabel:(NSTextField *)label withString:(const char*) str
{
[label setStringValue:[NSString stringWithUTF8String:str]];
[label setBezeled:NO];
@ -151,7 +154,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
[label setSelectable:NO];
}
- (int)pickIWad:(WadStuff *)wads:(int) numwads:(bool) showwin:(int) defaultiwad
- (int)pickIWad:(WadStuff *)wads num:(int) numwads showWindow:(bool) showwin defaultWad:(int) defaultiwad
{
cancelled = false;
@ -163,7 +166,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
[window setTitle:windowTitle];
NSTextField *description = [[NSTextField alloc] initWithFrame:NSMakeRect(22, 379, 412, 50)];
[self makeLabel:description:"ZDoom found more than one IWAD\nSelect from the list below to determine which one to use:"];
[self makeLabel:description withString:"ZDoom found more than one IWAD\nSelect from the list below to determine which one to use:"];
[[window contentView] addSubview:description];
[description release];
@ -171,7 +174,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
//NSScrollView *iwadScroller = [[NSScrollView alloc] initWithFrame:NSMakeRect(20, 103, 412, 288)];
NSScrollView *iwadScroller = [[NSScrollView alloc] initWithFrame:NSMakeRect(20, 50, 412, 341)];
NSTableView *iwadTable = [[NSTableView alloc] initWithFrame:[iwadScroller bounds]];
IWADTableData *tableData = [[IWADTableData alloc] init:wads:numwads];
IWADTableData *tableData = [[IWADTableData alloc] init:wads num:numwads];
for(int i = 0;i < NUM_COLUMNS;i++)
{
NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithUTF8String:tableHeaders[i]]];
@ -242,7 +245,7 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad)
{
IWADPicker *picker = [IWADPicker alloc];
int ret = [picker pickIWad:wads:numwads:showwin:defaultiwad];
int ret = [picker pickIWad:wads num:numwads showWindow:showwin defaultWad:defaultiwad];
[picker release];
return ret;
}

View file

@ -709,7 +709,7 @@ class OPLMUSDumper : public OPLMUSSong
{
public:
OPLMUSDumper(const OPLMUSSong *original, const char *filename);
void Play(bool looping);
void Play(bool looping, int);
};
// CD track/disk played through the multimedia system -----------------------

View file

@ -100,7 +100,7 @@ OPLMUSDumper::OPLMUSDumper(const OPLMUSSong *original, const char *filename)
{
}
void OPLMUSDumper::Play(bool looping)
void OPLMUSDumper::Play(bool looping, int)
{
Music->Dump();
}

View file

@ -795,7 +795,7 @@ bool DSimpleCanvas::IsValid ()
//
//==========================================================================
bool DSimpleCanvas::Lock ()
bool DSimpleCanvas::Lock (bool)
{
if (LockCount == 0)
{

View file

@ -157,8 +157,7 @@ public:
virtual bool IsValid ();
// Access control
virtual bool Lock () = 0; // Returns true if the surface was lost since last time
virtual bool Lock (bool usesimplecanvas) { return Lock(); }
virtual bool Lock (bool buffered=true) = 0; // Returns true if the surface was lost since last time
virtual void Unlock () = 0;
virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
@ -287,7 +286,7 @@ public:
~DSimpleCanvas ();
bool IsValid ();
bool Lock ();
bool Lock (bool buffered=true);
void Unlock ();
protected:

View file

@ -1033,11 +1033,6 @@ bool D3DFB::IsFullscreen ()
//
//==========================================================================
bool D3DFB::Lock ()
{
return Lock(true);
}
bool D3DFB::Lock (bool buffered)
{
if (LockCount++ > 0)

View file

@ -815,11 +815,6 @@ HRESULT DDrawFB::GetHR ()
return LastHR;
}
bool DDrawFB::Lock ()
{
return Lock (false);
}
bool DDrawFB::Lock (bool useSimpleCanvas)
{
static int lock_num;

View file

@ -148,7 +148,6 @@ public:
~DDrawFB ();
bool IsValid ();
bool Lock ();
bool Lock (bool buffer);
void Unlock ();
void ForceBuffering (bool force);
@ -231,7 +230,6 @@ public:
~D3DFB ();
bool IsValid ();
bool Lock ();
bool Lock (bool buffered);
void Unlock ();
void Update ();