Fixed compilation warnings reported by Clang

src/gl/scene/gl_clipper.h:150:23: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
src/gl/dynlights/gl_aabbtree.cpp:137:24: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:137:34: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:137:44: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:30: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:139:54: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:142:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:143:3: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:144:3: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_aabbtree.cpp:167:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
src/gl/dynlights/gl_shadowmap.cpp:163:31: warning: '&&' within '||' [-Wlogical-op-parentheses]
src/p_saveg.cpp:367:16: warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare]
src/p_saveg.cpp:402:60: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
src/p_setup.cpp:1553:39: warning: format specifies type 'ptrdiff_t' (aka 'long') but the argument has type 'int' [-Wformat]
src/scripting/zscript/zcc_compile.cpp:293:74: warning: field 'AST' will be initialized after field 'mVersion' [-Wreorder]
src/swrenderer/drawers/r_thread.cpp:113:21: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
This commit is contained in:
alexey.lysiuk 2017-03-18 14:59:23 +02:00
parent 0130fc27cc
commit cb5ddeff25
9 changed files with 16 additions and 19 deletions

View file

@ -134,14 +134,14 @@ bool LevelAABBTree::OverlapRayAABB(const DVector2 &ray_start2d, const DVector2 &
c -= (aabb_max + aabb_min) * 0.5f; // aabb.center(); c -= (aabb_max + aabb_min) * 0.5f; // aabb.center();
DVector3 v = DVector3(abs(w.X), abs(w.Y), abs(w.Z)); DVector3 v = DVector3(fabs(w.X), fabs(w.Y), fabs(w.Z));
if (abs(c.X) > v.X + h.X || abs(c.Y) > v.Y + h.Y || abs(c.Z) > v.Z + h.Z) if (fabs(c.X) > v.X + h.X || fabs(c.Y) > v.Y + h.Y || fabs(c.Z) > v.Z + h.Z)
return false; // disjoint; return false; // disjoint;
if (abs(c.Y * w.Z - c.Z * w.Y) > h.Y * v.Z + h.Z * v.Y || if (fabs(c.Y * w.Z - c.Z * w.Y) > h.Y * v.Z + h.Z * v.Y ||
abs(c.X * w.Z - c.Z * w.X) > h.X * v.Z + h.Z * v.X || fabs(c.X * w.Z - c.Z * w.X) > h.X * v.Z + h.Z * v.X ||
abs(c.X * w.Y - c.Y * w.X) > h.X * v.Y + h.Y * v.X) fabs(c.X * w.Y - c.Y * w.X) > h.X * v.Y + h.Y * v.X)
return false; // disjoint; return false; // disjoint;
return true; // overlap; return true; // overlap;
@ -164,7 +164,7 @@ double LevelAABBTree::IntersectRayLine(const DVector2 &ray_start, const DVector2
DVector2 line_delta(line.dx, line.dy); DVector2 line_delta(line.dx, line.dy);
double den = raynormal | line_delta; double den = raynormal | line_delta;
if (abs(den) > epsilon) if (fabs(den) > epsilon)
{ {
double t_line = (rayd - (raynormal | line_pos)) / den; double t_line = (rayd - (raynormal | line_pos)) / den;
if (t_line >= 0.0 && t_line <= 1.0) if (t_line >= 0.0 && t_line <= 1.0)

View file

@ -160,7 +160,7 @@ void FShadowMap::UploadAABBTree()
{ {
// Just comparing the level info is not enough. If two MAPINFO-less levels get played after each other, // Just comparing the level info is not enough. If two MAPINFO-less levels get played after each other,
// they can both refer to the same default level info. // they can both refer to the same default level info.
if (level.info != mLastLevel && level.nodes.Size() != mLastNumNodes || level.segs.Size() != mLastNumSegs) if (level.info != mLastLevel && (level.nodes.Size() != mLastNumNodes || level.segs.Size() != mLastNumSegs))
Clear(); Clear();
if (mAABBTree) if (mAABBTree)

View file

@ -147,9 +147,9 @@ public:
// Used to speed up angle calculations during clipping // Used to speed up angle calculations during clipping
inline angle_t GetClipAngle(vertex_t *v) inline angle_t GetClipAngle(vertex_t *v)
{ {
return v->angletime == starttime ? v->viewangle : (v->angletime = starttime, v->viewangle = R_PointToPseudoAngle(v->p.X, v->p.Y)); return unsigned(v->angletime) == starttime ? v->viewangle : (v->angletime = starttime, v->viewangle = R_PointToPseudoAngle(v->p.X, v->p.Y));
} }
}; };
#endif #endif

View file

@ -362,9 +362,9 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
for (unsigned i = 0; i < numsubsectors; i += 6) for (unsigned i = 0; i < numsubsectors; i += 6)
{ {
by = 0; by = 0;
for (int j = 0; j < 6; j++) for (unsigned j = 0; j < 6; j++)
{ {
if (i + j < (int)numsubsectors && (level.subsectors[i + j].flags & SSECF_DRAWN)) if (i + j < numsubsectors && (level.subsectors[i + j].flags & SSECF_DRAWN))
{ {
by |= (1 << j); by |= (1 << j);
} }
@ -399,7 +399,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
.StringPtr(nullptr, str) .StringPtr(nullptr, str)
.EndArray(); .EndArray();
if (num_verts == (int)level.vertexes.Size() && num_subs == numsubsectors && hasglnodes) if (num_verts == (int)level.vertexes.Size() && num_subs == (int)numsubsectors && hasglnodes)
{ {
success = true; success = true;
int sub = 0; int sub = 0;

View file

@ -1549,7 +1549,7 @@ void P_LoadNodes (MapData * map)
} }
else if ((unsigned)child >= numnodes) else if ((unsigned)child >= numnodes)
{ {
Printf ("BSP node %d references invalid node %td.\n" Printf ("BSP node %d references invalid node %d.\n"
"The BSP will be rebuilt.\n", i, ((node_t *)no->children[j])->Index()); "The BSP will be rebuilt.\n", i, ((node_t *)no->children[j])->Index());
ForceNodeBuild = true; ForceNodeBuild = true;
level.nodes.Clear(); level.nodes.Clear();

View file

@ -328,7 +328,7 @@ static FxExpression *StringConstToChar(FxExpression *basex)
// If the string is UTF-8, allow a single character UTF-8 sequence. // If the string is UTF-8, allow a single character UTF-8 sequence.
int size; int size;
int c = utf8_decode(str.GetChars(), &size); int c = utf8_decode(str.GetChars(), &size);
if (c >= 0 && size == str.Len()) if (c >= 0 && size_t(size) == str.Len())
{ {
return new FxConstant(str[0], basex->ScriptPosition); return new FxConstant(str[0], basex->ScriptPosition);
} }

View file

@ -290,7 +290,7 @@ void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *treenode, ZC
//========================================================================== //==========================================================================
ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols, PNamespace *_outnamespc, int lumpnum, const VersionInfo &ver) ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols, PNamespace *_outnamespc, int lumpnum, const VersionInfo &ver)
: Outer(_outer), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), mVersion(ver), Lump(lumpnum) : mVersion(ver), Outer(_outer), ConvertClass(nullptr), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), Lump(lumpnum)
{ {
FScriptPosition::ResetErrorCounter(); FScriptPosition::ResetErrorCounter();
// Group top-level nodes by type // Group top-level nodes by type

View file

@ -124,7 +124,6 @@ private:
void CompileStates(); void CompileStates();
FxExpression *SetupActionFunction(PClass *cls, ZCC_TreeNode *sl, int stateflags); FxExpression *SetupActionFunction(PClass *cls, ZCC_TreeNode *sl, int stateflags);
bool SimplifyingConstant;
TArray<ZCC_ConstantDef *> Constants; TArray<ZCC_ConstantDef *> Constants;
TArray<ZCC_StructWork *> Structs; TArray<ZCC_StructWork *> Structs;
TArray<ZCC_ClassWork *> Classes; TArray<ZCC_ClassWork *> Classes;

View file

@ -109,10 +109,8 @@ void DrawerThreads::WorkerMain(DrawerThread *thread)
start_lock.unlock(); start_lock.unlock();
// Do the work: // Do the work:
size_t size = list->commands.size(); for (auto& command : list->commands)
for (int i = 0; i < size; i++)
{ {
auto &command = list->commands[i];
command->Execute(thread); command->Execute(thread);
} }