mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
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:
parent
0130fc27cc
commit
cb5ddeff25
9 changed files with 16 additions and 19 deletions
|
@ -134,14 +134,14 @@ bool LevelAABBTree::OverlapRayAABB(const DVector2 &ray_start2d, const DVector2 &
|
|||
|
||||
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;
|
||||
|
||||
if (abs(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 ||
|
||||
abs(c.X * w.Y - c.Y * w.X) > h.X * v.Y + h.Y * v.X)
|
||||
if (fabs(c.Y * w.Z - c.Z * w.Y) > h.Y * v.Z + h.Z * v.Y ||
|
||||
fabs(c.X * w.Z - c.Z * w.X) > h.X * v.Z + h.Z * v.X ||
|
||||
fabs(c.X * w.Y - c.Y * w.X) > h.X * v.Y + h.Y * v.X)
|
||||
return false; // disjoint;
|
||||
|
||||
return true; // overlap;
|
||||
|
@ -164,7 +164,7 @@ double LevelAABBTree::IntersectRayLine(const DVector2 &ray_start, const DVector2
|
|||
DVector2 line_delta(line.dx, line.dy);
|
||||
|
||||
double den = raynormal | line_delta;
|
||||
if (abs(den) > epsilon)
|
||||
if (fabs(den) > epsilon)
|
||||
{
|
||||
double t_line = (rayd - (raynormal | line_pos)) / den;
|
||||
if (t_line >= 0.0 && t_line <= 1.0)
|
||||
|
|
|
@ -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,
|
||||
// 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();
|
||||
|
||||
if (mAABBTree)
|
||||
|
|
|
@ -147,9 +147,9 @@ public:
|
|||
// Used to speed up angle calculations during clipping
|
||||
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
|
||||
|
|
|
@ -362,9 +362,9 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
|
|||
for (unsigned i = 0; i < numsubsectors; i += 6)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ FSerializer &SerializeSubsectors(FSerializer &arc, const char *key)
|
|||
.StringPtr(nullptr, str)
|
||||
.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;
|
||||
int sub = 0;
|
||||
|
|
|
@ -1549,7 +1549,7 @@ void P_LoadNodes (MapData * map)
|
|||
}
|
||||
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());
|
||||
ForceNodeBuild = true;
|
||||
level.nodes.Clear();
|
||||
|
|
|
@ -328,7 +328,7 @@ static FxExpression *StringConstToChar(FxExpression *basex)
|
|||
// If the string is UTF-8, allow a single character UTF-8 sequence.
|
||||
int 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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
: 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();
|
||||
// Group top-level nodes by type
|
||||
|
|
|
@ -124,7 +124,6 @@ private:
|
|||
void CompileStates();
|
||||
FxExpression *SetupActionFunction(PClass *cls, ZCC_TreeNode *sl, int stateflags);
|
||||
|
||||
bool SimplifyingConstant;
|
||||
TArray<ZCC_ConstantDef *> Constants;
|
||||
TArray<ZCC_StructWork *> Structs;
|
||||
TArray<ZCC_ClassWork *> Classes;
|
||||
|
|
|
@ -109,10 +109,8 @@ void DrawerThreads::WorkerMain(DrawerThread *thread)
|
|||
start_lock.unlock();
|
||||
|
||||
// Do the work:
|
||||
size_t size = list->commands.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
for (auto& command : list->commands)
|
||||
{
|
||||
auto &command = list->commands[i];
|
||||
command->Execute(thread);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue