Fix some warnings reported by gcc

This commit is contained in:
Magnus Norddahl 2025-06-22 08:01:47 +02:00
commit c8509d000c
14 changed files with 43 additions and 30 deletions

View file

@ -55,6 +55,7 @@ static void ShaderSetUniform1f(const FString &shaderName, const FString &uniform
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
break;
case UniformType::Int:
@ -111,6 +112,7 @@ DEFINE_ACTION_FUNCTION(_PPShader, SetUniform2f)
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
break;
case UniformType::Int:
@ -159,6 +161,7 @@ DEFINE_ACTION_FUNCTION(_PPShader, SetUniform3f)
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
break;
case UniformType::Int:
@ -208,6 +211,7 @@ DEFINE_ACTION_FUNCTION(_PPShader, SetUniform4f)
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
break;
case UniformType::Int:
@ -254,6 +258,7 @@ DEFINE_ACTION_FUNCTION(_PPShader, SetUniform1i)
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
break;
case UniformType::Int:

View file

@ -62,8 +62,9 @@ static void PrintUniform(const char * shaderName, const char * uniformName, cons
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
Printf("Shader '%s': could not find uniform '%s': %f %f %f\n", shaderName, uniformName);
Printf("Shader '%s': could not find uniform '%s'\n", shaderName, uniformName);
break;
case UniformType::Int:
Printf("Shader '%s' uniform '%s': %d\n", shaderName, uniformName, *i);
@ -72,13 +73,13 @@ static void PrintUniform(const char * shaderName, const char * uniformName, cons
Printf("Shader '%s' uniform '%s': %f\n", shaderName, uniformName, *f);
break;
case UniformType::Vec2:
Printf("Shader '%s' uniform '%s': %f %f\n", shaderName, uniformName, f[0], f[1]);
Printf("Shader '%s' uniform '%s': %f %f\n", shaderName, uniformName, (double)f[0], (double)f[1]);
break;
case UniformType::Vec3:
Printf("Shader '%s' uniform '%s': %f %f %f\n", shaderName, uniformName, f[0], f[1], f[2]);
Printf("Shader '%s' uniform '%s': %f %f %f\n", shaderName, uniformName, (double)f[0], (double)f[1], (double)f[2]);
break;
case UniformType::Vec4:
Printf("Shader '%s' uniform '%s': %f %f %f %f\n", shaderName, uniformName, f[0], f[1], f[2], f[3]);
Printf("Shader '%s' uniform '%s': %f %f %f %f\n", shaderName, uniformName, (double)f[0], (double)f[1], (double)f[2], (double)f[3]);
break;
}
}
@ -106,8 +107,9 @@ CCMD (shaderuniform)
int * i = (int *)uniform.Value;
switch(uniform.Type)
{
default:
case UniformType::Undefined:
Printf("Shader '%s': could not find uniform '%s': %f %f %f\n", shaderName, uniformName);
Printf("Shader '%s': could not find uniform '%s'\n", shaderName, uniformName);
break;
case UniformType::Int:
*i = atoi(argv[3]);

View file

@ -253,7 +253,7 @@ void VkShaderCache::Load()
VkCachedCompile cachedCompile;
cachedCompile.LastUsed = readUInt64(fr);
cachedCompile.Code.resize(readUInt32(fr));
if (fr.Read(cachedCompile.Code.data(), cachedCompile.Code.size() * sizeof(uint32_t)) != (FileReader::Size)cachedCompile.Code.size() * sizeof(uint32_t))
if (fr.Read(cachedCompile.Code.data(), cachedCompile.Code.size() * sizeof(uint32_t)) != (FileReader::Size)(cachedCompile.Code.size() * sizeof(uint32_t)))
return;
uint32_t includecount = readUInt32(fr);

View file

@ -188,7 +188,7 @@ void VkTextureManager::CreateBrdfLutTexture()
if (lump == -1) I_FatalError("Unable to load '%s'", lumpname);
auto fd = fileSystem.ReadFile(lump);
if (fd.size() != 512 * 512 * 2 * sizeof(uint16_t))
I_FatalError("Unexpected file size for '%s'");
I_FatalError("Unexpected file size for 'bdrf.lut'");
BrdfLutTexture = ImageBuilder()
.Format(VK_FORMAT_R16G16_SFLOAT)

View file

@ -259,14 +259,6 @@ BBox &BBox::operator*=(const FVector3 &vec)
return *this;
}
BBox &BBox::operator=(const BBox &bbox)
{
min = bbox.min;
max = bbox.max;
return *this;
}
FVector3 BBox::operator[](int index) const
{
assert(index >= 0 && index < 2);

View file

@ -56,7 +56,6 @@ public:
BBox& operator-=(const float radius);
BBox operator*(const FVector3& vec) const;
BBox& operator*=(const FVector3& vec);
BBox& operator=(const BBox& bbox);
FVector3 operator[](int index) const;
FVector3& operator[](int index);

View file

@ -666,7 +666,7 @@ public:
void SortedInsertUnique(const T &item)
{
int foundIndex = SortedFind (item, false);
unsigned int foundIndex = SortedFind (item, false);
if (foundIndex >= Count || Array[foundIndex] != item)
{
Insert (foundIndex, item);

View file

@ -1331,7 +1331,7 @@ CCMD (mapinfo)
if (myLevel->Music.IsNotEmpty())
Printf(" Music: %s%s\n", myLevel->Music[0] == '$'? "D_" : "", testlocalised(myLevel->Music.GetChars()));
Printf(" PixelStretch: %f\n", myLevel->pixelstretch);
Printf(" PixelStretch: %f\n", myLevel->pixelstretch);
if (myLevel->RedirectType != NAME_None)
Printf(" Redirect (Item): %s\n", myLevel->RedirectType.GetChars());
@ -1345,7 +1345,7 @@ CCMD (mapinfo)
if (myLevel->RedirectCVARMapName.IsNotEmpty())
Printf(" CVAR_Redirect (Map): %s\n", myLevel->RedirectCVARMapName.GetChars());
Printf(" LightMode: %i\n", (int8_t)myLevel->lightmode);
Printf(" LightMode: %i\n", (int8_t)myLevel->lightmode);
if (players[consoleplayer].mo && players[consoleplayer].mo->Level)
{

View file

@ -1,4 +1,8 @@
#ifndef NO_SEND_STATS
#define NO_SEND_STATS
#endif
#ifdef NO_SEND_STATS
void D_DoAnonStats()

View file

@ -316,6 +316,8 @@ void setUniformI(UniformField field, int val)
case UniformType::Float:
((float *)field.Value)[0] = val;
break;
default:
break;
}
}
@ -335,6 +337,8 @@ void setUniformF(UniformField field, float val)
case UniformType::Float:
((float *)field.Value)[0] = val;
break;
default:
break;
}
}
@ -354,6 +358,8 @@ void setUniformF(UniformField field, const FVector2 &val)
case UniformType::Float:
((float *)field.Value)[0] = val.X;
break;
default:
break;
}
}
@ -373,6 +379,8 @@ void setUniformF(UniformField field, const FVector3 &val)
case UniformType::Float:
((float *)field.Value)[0] = val.X;
break;
default:
break;
}
}
@ -392,6 +400,8 @@ void setUniformF(UniformField field, const FVector4 &val)
case UniformType::Float:
((float *)field.Value)[0] = val.X;
break;
default:
break;
}
}
@ -2535,7 +2545,8 @@ class GLDefsParser
sc.MustGetFloat();
Values[3] = sc.Float;
break;
default:
break;
}
}

View file

@ -850,7 +850,7 @@ void DoomLevelMesh::ReleaseTiles(int surf)
void DoomLevelMesh::FreeSide(FLevelLocals& doomMap, unsigned int sideIndex)
{
if (sideIndex < 0 || sideIndex >= Sides.Size())
if (sideIndex >= Sides.Size())
return;
ReleaseTiles(Sides[sideIndex].FirstSurface);
@ -887,7 +887,7 @@ void DoomLevelMesh::FreeSide(FLevelLocals& doomMap, unsigned int sideIndex)
void DoomLevelMesh::FreeFlat(FLevelLocals& doomMap, unsigned int sectorIndex)
{
if (sectorIndex < 0 || sectorIndex >= Flats.Size())
if (sectorIndex >= Flats.Size())
return;
for (FSection& section : level.sections.SectionsForSector(&doomMap.sectors[sectorIndex]))
@ -2023,8 +2023,8 @@ void DoomLevelMesh::GetVisibleSurfaces(LightmapTile* tile, TArray<int>& outSurfa
while (surf != -1)
{
const auto& sinfo = DoomSurfaceInfos[surf];
int controlSector = sinfo.ControlSector ? sinfo.ControlSector->Index() : (int)0xffffffffUL;
if (sinfo.Type == tile->Binding.Type && controlSector == tile->Binding.ControlSector)
uint32_t controlSector = sinfo.ControlSector ? (uint32_t)sinfo.ControlSector->Index() : (uint32_t)0xffffffffUL;
if (sinfo.Type == (DoomLevelMeshSurfaceType)tile->Binding.Type && controlSector == tile->Binding.ControlSector)
{
outSurfaces.Push(surf);
}
@ -2084,7 +2084,7 @@ void DoomLevelMesh::DumpMesh(const FString& objFilename, const FString& mtlFilen
for (unsigned i = 0, count = Mesh.IndexCount; i + 2 < count; i += 3)
{
auto index = Mesh.SurfaceIndexes[i / 3];
uint32_t index = Mesh.SurfaceIndexes[i / 3];
if (index != lastSurfaceIndex)
{
@ -2429,7 +2429,7 @@ TArray<MapLump> LoadMapLumps(FileReader* reader, const char* wadType)
for (uint32_t i = 0; i < numlumps; i++)
{
if (reader->Seek(offsets[i], FileReader::SeekSet) == -1) return {};
if (reader->Read(lumps[i].Data.data(), lumps[i].Data.size()) != lumps[i].Data.size()) return {};
if (reader->Read(lumps[i].Data.data(), lumps[i].Data.size()) != (FileReader::Size)lumps[i].Data.size()) return {};
}
return lumps;

View file

@ -459,7 +459,7 @@ static void UpdatePlaneLightmap(FRenderState& renderstate, sector_t* sec, int pl
{
if (origin->sub)
{
int lightmap = origin->sub->LightmapTiles[origin->plane].Size() > origin->lightmapSlot ? origin->sub->LightmapTiles[origin->plane][origin->lightmapSlot] : -1;
int lightmap = origin->sub->LightmapTiles[origin->plane].Size() > (unsigned int)origin->lightmapSlot ? origin->sub->LightmapTiles[origin->plane][origin->lightmapSlot] : -1;
if (lightmap >= 0) // tile may be missing if the subsector is degenerate triangle
{
const auto& tile = level.levelMesh->Lightmap.Tiles[lightmap];

View file

@ -672,7 +672,7 @@ void CameraFrustum::Set(const VSMatrix& worldToProjection, const DVector3& viewp
Planes[5] = FarFrustum(worldToProjection);
// Move back near plane to be slightly behind the camera position
Planes[0].W = -(Planes[0].XYZ() | viewpoint.ToXZY() - 1.0);
Planes[0].W = -((Planes[0].XYZ() | viewpoint.ToXZY()) - 1.0);
for (int i = 0; i < 6; i++)
{

View file

@ -1580,9 +1580,9 @@ void HWWall::BuildFFBlock(HWWallDispatcher *di, FRenderState& state, seg_t * seg
if (di->di)
{
if (seg->sidedef == seg->linedef->sidedef[0])
lightmaptile = seg->linedef->sidedef[1]->LightmapTiles.Size() > 4 + roverIndex ? seg->linedef->sidedef[1]->LightmapTiles[4 + roverIndex] : -1;
lightmaptile = seg->linedef->sidedef[1]->LightmapTiles.Size() > (unsigned int)(4 + roverIndex) ? seg->linedef->sidedef[1]->LightmapTiles[4 + roverIndex] : -1;
else
lightmaptile = seg->linedef->sidedef[0]->LightmapTiles.Size() > 4 + roverIndex ? seg->linedef->sidedef[0]->LightmapTiles[4 + roverIndex] : -1;
lightmaptile = seg->linedef->sidedef[0]->LightmapTiles.Size() > (unsigned int)(4 + roverIndex) ? seg->linedef->sidedef[0]->LightmapTiles[4 + roverIndex] : -1;
if (lightmaptile >= 0)
{