Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve compiler warnings #426

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Core/Entities/PlayerEntityControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@
static BOOL gammaControlPressed;
#endif
static BOOL fovControlPressed;
#if OOLITE_WINDOWS
static BOOL hdrMaxBrightnessControlPressed;
static BOOL hdrPaperWhiteControlPressed;
#endif
static BOOL colorblindModeControlPressed;
static BOOL shaderSelectKeyPressed;
static BOOL selectPressed;
Expand Down
2 changes: 0 additions & 2 deletions src/Core/OOMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ OOINLINE bool OOMatrixIsIdentity(OOMatrix m)

OOINLINE void OOMatrixGetBasisVectors(OOMatrix m, Vector *outRight, Vector *outUp, Vector *outForward)
{
assert(outRight != NULL && outUp != NULL && outForward != NULL);

*outRight = make_vector(m.m[0][0], m.m[1][0], m.m[2][0]);
*outUp = make_vector(m.m[0][1], m.m[1][1], m.m[2][1]);
*outForward = make_vector(m.m[0][2], m.m[1][2], m.m[2][2]);
Expand Down
3 changes: 0 additions & 3 deletions src/Core/OOOpenGLStateManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ static void GetCurrentOpenGLState(OOOpenGLState *state)

static bool StatesEqual(const OOOpenGLState *a, const OOOpenGLState *b)
{
NSCParameterAssert(a != NULL && b != NULL);

#define ITEM_STATEFLAG(NAME) do { if (a->NAME != b->NAME && a->NAME != kStateMaybe && b->NAME != kStateMaybe) return false; } while (0)
#define ITEM_CLIENTSTATEFLAG(NAME) do { if (a->NAME != b->NAME) return false; } while (0)
#define ITEM_SPECIAL(NAME, _, __) do { if (a->NAME != b->NAME) return false; } while (0)
Expand Down Expand Up @@ -403,7 +401,6 @@ void OOSetOpenGLState(OOOpenGLStateID state)

static void SwitchOpenGLStateInternal(const OOOpenGLState *sourceState, const OOOpenGLState *targetState)
{
NSCParameterAssert(sourceState != NULL && targetState != NULL);
OO_ENTER_OPENGL();

#define ITEM_STATEFLAG(NAME) \
Expand Down
20 changes: 10 additions & 10 deletions src/Core/OOPolygonSprite.m
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ - (BOOL) loadPolygons:(NSArray *)dataArray outlineWidth:(float)outlineWidth
dataArray = DataArrayToPoints(&polygonData, dataArray);

/*** Tesselate polygon fill ***/
gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, TessBeginCallback);
gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, TessVertexCallback);
gluTessCallback(tesselator, GLU_TESS_END_DATA, TessEndCallback);
gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, ErrorCallback);
gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, TessCombineCallback);
gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, (_GLUfuncptr) TessBeginCallback);
gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, (_GLUfuncptr) TessVertexCallback);
gluTessCallback(tesselator, GLU_TESS_END_DATA, (_GLUfuncptr) TessEndCallback);
gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, (_GLUfuncptr) ErrorCallback);
gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, (_GLUfuncptr) TessCombineCallback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and all the above (_GLUfuncptr) casts break the Windows build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have access to a Windows machine to test on. I was hoping there would be build actions set up here so that I could get some results from other platforms. Can you share the errors it produces?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. The error is this:

Compiling file src/Core/OOMeshToOctreeConverter.m ... src/Core/OOPolygonSprite.m: In function '-[OOPolygonSprite loadPolygons:outlineWidth:]': src/Core/OOPolygonSprite.m:286:52: error: '_GLUfuncptr' undeclared (first use in this function) src/Core/OOPolygonSprite.m:286:52: note: each undeclared identifier is reported only once for each function it appears in src/Core/OOPolygonSprite.m:286:65: error: expected ')' before 'TessBeginCallback' src/Core/OOPolygonSprite.m:287:66: error: expected ')' before 'TessVertexCallback' src/Core/OOPolygonSprite.m:288:63: error: expected ')' before 'TessEndCallback' src/Core/OOPolygonSprite.m:289:65: error: expected ')' before 'ErrorCallback' src/Core/OOPolygonSprite.m:290:67: error: expected ')' before 'TessCombineCallback' src/Core/OOPolygonSprite.m:354:65: error: expected ')' before 'TessBeginCallback' src/Core/OOPolygonSprite.m:355:66: error: expected ')' before 'TessVertexCallback' src/Core/OOPolygonSprite.m:356:63: error: expected ')' before 'TessEndCallback' src/Core/OOPolygonSprite.m:357:65: error: expected ')' before 'ErrorCallback' src/Core/OOPolygonSprite.m:358:67: error: expected ')' before 'TessCombineCallback' src/Core/OOPolygonSprite.m: At top level: src/Core/OOPolygonSprite.m:657:22: warning: 'TessBeginCallback' defined but not used [-Wunused-function] src/Core/OOPolygonSprite.m:669:22: warning: 'TessVertexCallback' defined but not used [-Wunused-function] src/Core/OOPolygonSprite.m:758:22: warning: 'TessCombineCallback' defined but not used [-Wunused-function] src/Core/OOPolygonSprite.m:765:22: warning: 'TessEndCallback' defined but not used [-Wunused-function] src/Core/OOPolygonSprite.m:777:22: warning: 'ErrorCallback' defined but not used [-Wunused-function] make[3]: *** [obj.win.spk/oolite.obj/OOPolygonSprite.m.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [internal-objc_program-all_] Error 2 make[1]: *** [oolite.all.objc-program.variables] Error 2 make: *** [internal-all] Error 2

_GLUfuncptr is not defined in the Windows headers.


gluTessBeginPolygon(tesselator, &polygonData);
SVGDumpBeginGroup(&polygonData, @"Fill");
Expand Down Expand Up @@ -351,11 +351,11 @@ - (BOOL) loadPolygons:(NSArray *)dataArray outlineWidth:(float)outlineWidth
polygonData.generatingOutline = YES;
#endif

gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, TessBeginCallback);
gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, TessVertexCallback);
gluTessCallback(tesselator, GLU_TESS_END_DATA, TessEndCallback);
gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, ErrorCallback);
gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, TessCombineCallback);
gluTessCallback(tesselator, GLU_TESS_BEGIN_DATA, (_GLUfuncptr) TessBeginCallback);
gluTessCallback(tesselator, GLU_TESS_VERTEX_DATA, (_GLUfuncptr) TessVertexCallback);
gluTessCallback(tesselator, GLU_TESS_END_DATA, (_GLUfuncptr) TessEndCallback);
gluTessCallback(tesselator, GLU_TESS_ERROR_DATA, (_GLUfuncptr) ErrorCallback);
gluTessCallback(tesselator, GLU_TESS_COMBINE_DATA, (_GLUfuncptr) TessCombineCallback);
gluTessProperty(tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);

gluTessBeginPolygon(tesselator, &polygonData);
Expand Down
18 changes: 6 additions & 12 deletions src/Core/OXPVerifier/OOOXPVerifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ of this software and associated documentation files (the "Software"), to deal

static void SwitchLogFile(NSString *name);
static void NoteVerificationStage(NSString *displayName, NSString *stage);
static void OpenLogFile(NSString *name);
static bool OpenLogFile(NSString *name);

@interface OOOXPVerifier (OOPrivate)

Expand Down Expand Up @@ -717,29 +717,23 @@ static void NoteVerificationStage(NSString *displayName, NSString *stage)
}


static void OpenLogFile(NSString *name)
static bool OpenLogFile(NSString *name)
{
// Open log file in appropriate application / provide feedback.

if ([[NSUserDefaults standardUserDefaults] oo_boolForKey:@"oxp-verifier-open-log" defaultValue:YES])
{
#if OOLITE_MAC_OS_X
[[NSWorkspace sharedWorkspace] openFile:OOLogHandlerGetLogPath()];
return [[NSWorkspace sharedWorkspace] openFile:OOLogHandlerGetLogPath()];
#elif OOLITE_WINDOWS
// start wordpad (for historical reasons wordpad is called write from the command prompt)
system([[NSString stringWithFormat:@"write \"Logs\\%@.log\"", name] UTF8String]);
return system([[NSString stringWithFormat:@"write \"Logs\\%@.log\"", name] UTF8String]);
#elif OOLITE_LINUX
// MKW - needed to suppress 'ignoring return value' warning for system() call
// int ret;
// CIM - and now the compiler complains about that too... casting return
// value to void seems to keep it quiet for now
// Nothing to do here, since we dump to stdout instead of to a file.
//OOLogOutputHandlerStopLoggingToStdout();
(void) system([[NSString stringWithFormat:@"cat \"%@\"", OOLogHandlerGetLogPath()] UTF8String]);
#else
do {} while (0);
return system([[NSString stringWithFormat:@"cat \"%@\"", OOLogHandlerGetLogPath()] UTF8String]);
#endif
}
return true;
}


Expand Down
7 changes: 6 additions & 1 deletion src/Core/Octree.m
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,13 @@ these ivars are unused (but may be used by categories, which they are).
*/
- (BOOL) suppressClangStuff
{
return &_stateStack && 0;
/* This define exists purely to suppress gcc warnings that &_stateStack is
always true
*/
#define RETVAL &_stateStack && 0
return RETVAL;
}
#undef RETVAL
#endif

@end
2 changes: 1 addition & 1 deletion src/SDL/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


#ifndef NDEBUG
uint32_t gDebugFlags = 0;
NSUInteger gDebugFlags = 0;
#endif


Expand Down