Skip to content

Commit

Permalink
Fixed: Several compiler warnings suppressed/fixed
Browse files Browse the repository at this point in the history
There is a lot of thinkfunc_t related implicit casting from one
type of pointer to another. Eventually we need a safer solution for
this...
  • Loading branch information
skyjake committed Jan 28, 2013
1 parent adfec9a commit 21b2ef7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 21 deletions.
5 changes: 4 additions & 1 deletion doomsday/client/client.pro
Expand Up @@ -15,7 +15,10 @@ echo(Doomsday Client $${DENG_VERSION}.)

# Some messy old code here:
*-g++*|*-gcc*|*-clang* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers
QMAKE_CXXFLAGS_WARN_ON += \
-Wno-missing-field-initializers \
-Wno-unused-parameter \
-Wno-missing-braces
}

# External Dependencies ------------------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions doomsday/plugins/common/src/p_saveg.c
Expand Up @@ -194,7 +194,7 @@ static MaterialArchive* materialArchive;
static thinkerinfo_t thinkerInfo[] = {
{
TC_MOBJ,
P_MobjThinker,
(thinkfunc_t) P_MobjThinker,
TSF_SERVERONLY,
SV_WriteMobj,
SV_ReadMobj,
Expand Down Expand Up @@ -912,7 +912,7 @@ static thinkerinfo_t* infoForThinker(thinker_t* th)

static int removeThinker(thinker_t* th, void* context)
{
if(th->function == P_MobjThinker)
if(th->function == (thinkfunc_t) P_MobjThinker)
P_MobjRemove((mobj_t *) th, true);
else
Z_Free(th);
Expand Down Expand Up @@ -958,7 +958,7 @@ static uint SV_InitThingArchive(boolean load, boolean savePlayers)
else
{
// Count the number of mobjs we'll be writing.
Thinker_Iterate(P_MobjThinker, countMobjs, &params);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, countMobjs, &params);
}

thingArchive = calloc(params.count, sizeof(mobj_t*));
Expand Down Expand Up @@ -1014,7 +1014,7 @@ unsigned short SV_ThingArchiveNum(mobj_t* mo)
errorIfNotInited("SV_ThingArchiveNum");

// We only archive valid mobj thinkers.
if(mo == NULL || ((thinker_t *) mo)->function != P_MobjThinker)
if(mo == NULL || ((thinker_t *) mo)->function != (thinkfunc_t) P_MobjThinker)
return 0;

#if __JHEXEN__
Expand Down Expand Up @@ -4282,7 +4282,7 @@ static int archiveThinker(thinker_t* th, void* context)
boolean savePlayers = *(boolean*) context;

// Are we archiving players?
if(!(th->function == P_MobjThinker && ((mobj_t *) th)->player &&
if(!(th->function == (thinkfunc_t) P_MobjThinker && ((mobj_t *) th)->player &&
!savePlayers))
{
thinkerinfo_t* thInfo = infoForThinker(th);
Expand Down Expand Up @@ -4454,7 +4454,7 @@ static void rebuildCorpseQueue(void)
{
P_InitCorpseQueue();
// Search the thinker list for corpses and place them in the queue.
Thinker_Iterate(P_MobjThinker, rebuildCorpseQueueWorker, NULL/*no params*/);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, rebuildCorpseQueueWorker, NULL/*no params*/);
}
#endif

Expand Down Expand Up @@ -4569,7 +4569,7 @@ static void P_UnArchiveThinkers(void)
if(thInfo->thinkclass == TC_MOBJ)
{
th = (thinker_t*)
P_MobjCreateXYZ(P_MobjThinker, 0, 0, 0, 0, 64, 64, 0);
P_MobjCreateXYZ((thinkfunc_t) P_MobjThinker, 0, 0, 0, 0, 64, 64, 0);
}
else
{
Expand Down Expand Up @@ -4608,11 +4608,11 @@ static void P_UnArchiveThinkers(void)

// Update references to things.
#if __JHEXEN__
Thinker_Iterate(P_MobjThinker, restoreMobjLinks, NULL);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, restoreMobjLinks, NULL);
#else
if(IS_SERVER)
{
Thinker_Iterate(P_MobjThinker, restoreMobjLinks, NULL);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, restoreMobjLinks, NULL);

for(i = 0; i < numlines; ++i)
{
Expand Down
10 changes: 5 additions & 5 deletions doomsday/plugins/common/src/p_xgsec.c
Expand Up @@ -2173,7 +2173,7 @@ int C_DECL XSTrav_Teleport(Sector* sector, boolean ceiling, void* context,
thinker_t *th = (thinker_t*) mo;

// Not a mobj.
if(th->function != P_MobjThinker)
if(th->function != (thinkfunc_t) P_MobjThinker)
continue;

// Not a teleportman.
Expand Down Expand Up @@ -2918,7 +2918,7 @@ void XS_Thinker(xsthinker_t* xs)

params.sec = sector;
params.data = XSCE_FLOOR;
Thinker_Iterate(P_MobjThinker, XSTrav_SectorChain, &params);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, XSTrav_SectorChain, &params);
}

// Ceiling chain. Check any mobjs that are touching the ceiling.
Expand All @@ -2928,7 +2928,7 @@ void XS_Thinker(xsthinker_t* xs)

params.sec = sector;
params.data = XSCE_CEILING;
Thinker_Iterate(P_MobjThinker, XSTrav_SectorChain, &params);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, XSTrav_SectorChain, &params);
}

// Inside chain. Check any sectorlinked mobjs.
Expand All @@ -2938,7 +2938,7 @@ void XS_Thinker(xsthinker_t* xs)

params.sec = sector;
params.data = XSCE_INSIDE;
Thinker_Iterate(P_MobjThinker, XSTrav_SectorChain, &params);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, XSTrav_SectorChain, &params);
}

// Ticker chain. Send an activate event if TICKER_D flag is not set.
Expand Down Expand Up @@ -2995,7 +2995,7 @@ void XS_Thinker(xsthinker_t* xs)
xstrav_windparams_t params;

params.sec = sector;
Thinker_Iterate(P_MobjThinker, XSTrav_Wind, &params);
Thinker_Iterate((thinkfunc_t) P_MobjThinker, XSTrav_Wind, &params);
}
}

Expand Down
7 changes: 7 additions & 0 deletions doomsday/plugins/config_plugin.pri
Expand Up @@ -9,6 +9,13 @@ win32 {
TARGET_EXT = .dll
}

*-g++* | *-gcc* | *-clang* {
# In the game plugins there is a large number of thinkfunc_t related
# casting from various types of functions. This should be removed
# when the issue has been resolved:
QMAKE_CFLAGS_WARN_ON += -Wno-incompatible-pointer-types
}

INCLUDEPATH += $$DENG_API_DIR

!dengplugin_libdeng2_full {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/doom/src/p_oldsvg.c
Expand Up @@ -439,7 +439,7 @@ static void P_v19_UnArchiveWorld(void)

static int removeThinker(thinker_t* th, void* context)
{
if(th->function == P_MobjThinker)
if(th->function == (thinkfunc_t) P_MobjThinker)
P_MobjRemove((mobj_t *) th, true);
else
Z_Free(th);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/heretic/src/p_mobj.c
Expand Up @@ -877,7 +877,7 @@ void P_MobjThinker(mobj_t* mobj)
coord_t oldZ = mobj->origin[VZ];

P_MobjMoveZ(mobj);
if(mobj->thinker.function != P_MobjThinker)
if(mobj->thinker.function != (thinkfunc_t) P_MobjThinker)
return; // mobj was removed

/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/heretic/src/p_oldsvg.c
Expand Up @@ -459,7 +459,7 @@ static void P_v13_UnArchiveWorld(void)

static int removeThinker(thinker_t* th, void* context)
{
if(th->function == P_MobjThinker)
if(th->function == (thinkfunc_t) P_MobjThinker)
P_MobjRemove((mobj_t *) th, true);
else
Z_Free(th);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/hexen/src/po_man.c
Expand Up @@ -581,7 +581,7 @@ static void thrustMobj(struct mobj_s* mo, void* linep, void* pop)
pe = (polyevent_t*) po->specialData;
if(pe)
{
if(pe->thinker.function == T_RotatePoly)
if(pe->thinker.function == (thinkfunc_t) T_RotatePoly)
{
force = FIX2FLT(pe->intSpeed >> 8);
}
Expand Down
7 changes: 5 additions & 2 deletions doomsday/server/server.pro
Expand Up @@ -15,8 +15,11 @@ echo(Doomsday Server $${DENG_VERSION}.)
CONFIG -= app_bundle

# Some messy old code here:
*-g++*|*-gcc*|*-clang* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers
*-g++* | *-gcc* | *-clang* {
QMAKE_CXXFLAGS_WARN_ON += \
-Wno-missing-field-initializers \
-Wno-unused-parameter \
-Wno-missing-braces
}

# External Dependencies ------------------------------------------------------
Expand Down

0 comments on commit 21b2ef7

Please sign in to comment.