[Nit] Fixup nontrivial memcall warning

* Silenced -Wnontrivial-memcall in asmjit

* Silenced -Wnontrivial-memcall in tools

* Silenced -Wnontrivial-memcall

* (to squash) Silenced -Wnontrivial-memcall (as reviewed by Jay)

* (to squash) Silenced -Wnontrivial-memcall (as reviewed by Jay [again])
This commit is contained in:
Marcus Minhorst 2025-09-19 15:38:53 -04:00 committed by GitHub
commit e2bd23dfa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 156 additions and 76 deletions

View file

@ -5,6 +5,7 @@
**---------------------------------------------------------------------------
** Copyright 1998-2016 Randy Heit
** Copyright 2005-2016 Christoph Oelckers
** Copyright 2017-2025 GZDoom Maintainers and Contributors
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -816,7 +817,7 @@ void PClass::BuildFlatPointers() const
else
{
pairType *flat = (pairType*)ClassDataAllocator.Alloc(sizeof(pairType) * NativePointers.Size());
memcpy(flat, NativePointers.Data(), sizeof(pairType) * NativePointers.Size());
std::copy(NativePointers.Data(), NativePointers.Data() + NativePointers.Size(), flat);
FlatPointers = flat;
FlatPointersSize = NativePointers.Size();
@ -849,15 +850,15 @@ void PClass::BuildFlatPointers() const
if (ParentClass->FlatPointersSize > 0)
{
memcpy (flat, ParentClass->FlatPointers, sizeof(pairType) * ParentClass->FlatPointersSize);
std::copy(ParentClass->FlatPointers, ParentClass->FlatPointers + ParentClass->FlatPointersSize, flat);
}
if (NativePointers.Size() > 0)
{
memcpy(flat + ParentClass->FlatPointersSize, NativePointers.Data(), sizeof(pairType) * NativePointers.Size());
std::copy(NativePointers.Data(), NativePointers.Data() + NativePointers.Size(), flat + ParentClass->FlatPointersSize);
}
if (ScriptPointers.Size() > 0)
{
memcpy(flat + ParentClass->FlatPointersSize + NativePointers.Size(), &ScriptPointers[0], sizeof(pairType) * ScriptPointers.Size());
std::copy(&ScriptPointers[0], &ScriptPointers[0] + ScriptPointers.Size(), flat + ParentClass->FlatPointersSize + NativePointers.Size());
}
FlatPointers = flat;
FlatPointersSize = ParentClass->FlatPointersSize + NativePointers.Size() + ScriptPointers.Size();
@ -913,12 +914,12 @@ void PClass::BuildArrayPointers() const
pairType *flat = (pairType*)ClassDataAllocator.Alloc(sizeof(pairType) * (ParentClass->ArrayPointersSize + ScriptPointers.Size()));
if (ParentClass->ArrayPointersSize > 0)
{
memcpy(flat, ParentClass->ArrayPointers, sizeof(pairType) * ParentClass->ArrayPointersSize);
std::copy(ParentClass->ArrayPointers, ParentClass->ArrayPointers + ParentClass->ArrayPointersSize, flat);
}
if (ScriptPointers.Size() > 0)
{
memcpy(flat + ParentClass->ArrayPointersSize, ScriptPointers.Data(), sizeof(pairType) * ScriptPointers.Size());
std::copy(ScriptPointers.Data(), ScriptPointers.Data() + ScriptPointers.Size(), flat + ParentClass->ArrayPointersSize);
}
ArrayPointers = flat;
@ -974,12 +975,12 @@ void PClass::BuildMapPointers() const
pairType *flat = (pairType*)ClassDataAllocator.Alloc(sizeof(pairType) * (ParentClass->MapPointersSize + ScriptPointers.Size()));
if (ParentClass->MapPointersSize > 0)
{
memcpy(flat, ParentClass->MapPointers, sizeof(pairType) * ParentClass->MapPointersSize);
std::copy(ParentClass->MapPointers, ParentClass->MapPointers + ParentClass->MapPointersSize, flat);
}
if (ScriptPointers.Size() > 0)
{
memcpy(flat + ParentClass->MapPointersSize, ScriptPointers.Data(), sizeof(pairType) * ScriptPointers.Size());
std::copy(ScriptPointers.Data(), ScriptPointers.Data() + ScriptPointers.Size(), flat + ParentClass->MapPointersSize);
}
MapPointers = flat;
MapPointersSize = ParentClass->MapPointersSize + ScriptPointers.Size();

View file

@ -3,6 +3,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2005-2010 Christoph Oelckers
** Copyright 2017-2025 GZDoom Maintainers and Contributors
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -442,20 +443,25 @@ bool MapLoader::LoadGLSubsectors(FileReader &lump)
lump.Seek(0, FileReader::SeekSet);
auto datab = lump.Read();
const unsigned numsegs = Level->segs.Size();
if (numsubsectors == 0)
{
return false;
}
if (!format5 && memcmp(datab.data(), "gNd3", 4))
{
auto data = (const mapsubsector_t*) datab.data();
numsubsectors /= sizeof(mapsubsector_t);
Level->subsectors.Alloc(numsubsectors);
auto &subsectors = Level->subsectors;
memset(&subsectors[0],0,numsubsectors * sizeof(subsector_t));
for (i = 0; i < numsubsectors; i++)
{
subsectors[i].sprites.Clear();
memset((void*)&subsectors[i], 0, sizeof(mapsubsector_t));
}
for (i=0; i<numsubsectors; i++)
{
subsectors[i].numlines = LittleShort(data[i].numsegs );
@ -476,8 +482,13 @@ bool MapLoader::LoadGLSubsectors(FileReader &lump)
numsubsectors /= sizeof(gl3_mapsubsector_t);
Level->subsectors.Alloc(numsubsectors);
auto &subsectors = Level->subsectors;
memset(&subsectors[0],0,numsubsectors * sizeof(subsector_t));
for (i = 0; i < numsubsectors; i++)
{
subsectors[i].sprites.Clear();
memset((void*)&subsectors[i], 0, sizeof(mapsubsector_t));
}
for (i=0; i<numsubsectors; i++)
{
subsectors[i].numlines = LittleLong(data[i].numsegs );

View file

@ -5,6 +5,7 @@
// Copyright 1999-2016 Randy Heit
// Copyright 2002-2018 Christoph Oelckers
// Copyright 2010 James Haley
// Copyright 2017-2025 GZDoom Maintainers and Contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -595,7 +596,12 @@ void MapLoader::LoadZNodes(FileReader &data, int glnodes)
uint32_t currSeg;
uint32_t numSubs = data.ReadUInt32();
Level->subsectors.Alloc(numSubs);
memset (&Level->subsectors[0], 0, Level->subsectors.Size()*sizeof(subsector_t));
for (i = 0; i < Level->subsectors.Size(); i++)
{
Level->subsectors[i].sprites.Clear();
memset((void*)&Level->subsectors[i], 0, sizeof(mapsubsector_t));
}
for (i = currSeg = 0; i < numSubs; ++i)
{
@ -1012,9 +1018,13 @@ bool MapLoader::LoadSubsectors (MapData * map)
auto &subsectors = Level->subsectors;
subsectors.Alloc(numsubsectors);
auto &fr = map->Reader(ML_SSECTORS);
memset (&subsectors[0], 0, numsubsectors*sizeof(subsector_t));
for (unsigned i = 0; i < numsubsectors; i++)
{
subsectors[i].sprites.Clear();
memset((void*)&subsectors[i], 0, sizeof(mapsubsector_t));
}
for (unsigned i = 0; i < numsubsectors; i++)
{
subsectortype subd;

View file

@ -1,7 +1,8 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2005-2016 Christoph Oelckers
// Copyright 2005-2016 Christoph Oelckers
// Copyright 2017-2025 GZDoom Maintainers and Contributors
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@ -937,7 +938,10 @@ void MapLoader::FixHoles()
DPrintf(DMSG_NOTIFY, "Adding dummy subsector for sector %d\n", Index(segloop[0]->Subsector->render_sector));
subsector_t &sub = Level->subsectors[newssstart++];
memset(&sub, 0, sizeof(sub));
sub.sprites.Clear();
memset((void*)&sub, 0, sizeof(sub));
sub.sector = segloop[0]->frontsector;
sub.render_sector = segloop[0]->Subsector->render_sector;
sub.numlines = segloop.Size();

View file

@ -5,6 +5,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2008 Christoph Oelckers
** Copyright 2017-2025 GZDoom Maintainers and Contributors
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -2629,7 +2630,7 @@ public:
// Create the real vertices
Level->vertexes.Alloc(ParsedVertices.Size());
memcpy(&Level->vertexes[0], &ParsedVertices[0], Level->vertexes.Size() * sizeof(vertex_t));
std::copy(&ParsedVertices[0], &ParsedVertices[0] + ParsedVertices.Size(), &Level->vertexes[0]);
// Create the real sectors
Level->sectors.Alloc(ParsedSectors.Size());

View file

@ -1,7 +1,8 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2004-2016 Christoph Oelckers
// Copyright 2004-2016 Christoph Oelckers
// Copyright 2017-2025 GZDoom Maintainers and Contributors
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@ -86,7 +87,7 @@ static FDynamicLight *GetLight(FLevelLocals *Level)
FreeList.Pop(ret);
}
else ret = (FDynamicLight*)DynLightArena.Alloc(sizeof(FDynamicLight));
memset(ret, 0, sizeof(*ret));
memset((void*)ret, 0, sizeof(*ret));
ret = new(ret)FDynamicLight();
ret->m_cycler.m_increment = true;
ret->next = Level->lights;

View file

@ -1,7 +1,8 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2005-2016 Christoph Oelckers
// Copyright 2005-2016 Christoph Oelckers
// Copyright 2017-2025 GZDoom Maintainers and Contributors
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@ -19,6 +20,7 @@
//
//--------------------------------------------------------------------------
//
/*
** gl_models.cpp
**
@ -694,7 +696,7 @@ void InitModels()
{
FVoxelModel *md = (FVoxelModel*)Models[VoxelDefs[i]->Voxel->VoxelIndex];
FSpriteModelFrame smf;
memset(&smf, 0, sizeof(smf));
memset((void*)&smf, 0, sizeof(smf));
smf.isVoxel = true;
smf.modelsAmount = 1;
smf.modelframes.Alloc(1);
@ -772,7 +774,7 @@ void ParseModelDefLump(int Lump)
sc.MustGetString();
FSpriteModelFrame smf;
memset(&smf, 0, sizeof(smf));
memset((void*)&smf, 0, sizeof(smf));
smf.xscale=smf.yscale=smf.zscale=1.f;
auto type = PClass::FindClass(sc.String);
@ -1187,7 +1189,7 @@ FSpriteModelFrame * FindModelFrameRaw(const AActor * actorDefaults, const PClass
{
FSpriteModelFrame smf;
memset(&smf, 0, sizeof(smf));
memset((void*)&smf, 0, sizeof(smf));
smf.type = ti;
smf.sprite = sprite;
smf.frame = frame;

View file

@ -6,6 +6,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2002-2006 Randy Heit
** Copyright 2017-2025 GZDoom Maintainers and Contributors
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -54,13 +55,11 @@
void FNodeBuilder::Extract (FLevelLocals &theLevel)
{
int i;
auto &outVerts = theLevel.vertexes;
int vertCount = Vertices.Size ();
outVerts.Alloc(vertCount);
for (i = 0; i < vertCount; ++i)
for (int i = 0; i < vertCount; ++i)
{
outVerts[i].set(Vertices[i].x, Vertices[i].y);
}
@ -68,13 +67,17 @@ void FNodeBuilder::Extract (FLevelLocals &theLevel)
auto &outSubs = theLevel.subsectors;
auto subCount = Subsectors.Size();
outSubs.Alloc(subCount);
memset(&outSubs[0], 0, subCount * sizeof(subsector_t));
memset((void*)&outSubs[0], 0, subCount * sizeof(subsector_t));
auto &outNodes = theLevel.nodes;
auto nodeCount = Nodes.Size ();
outNodes.Alloc(nodeCount);
memcpy (&outNodes[0], &Nodes[0], nodeCount*sizeof(node_t));
for (unsigned i = 0; i < nodeCount; ++i)
{
outNodes[i] = Nodes[i];
}
for (unsigned i = 0; i < nodeCount; ++i)
{
D(Printf(PRINT_LOG, "Node %d: Splitter[%08x,%08x] [%08x,%08x]\n", i,
@ -135,7 +138,11 @@ void FNodeBuilder::Extract (FLevelLocals &theLevel)
}
else
{
memcpy (&outSubs[0], &Subsectors[0], subCount*sizeof(subsector_t));
for (unsigned i = 0; i < subCount; ++i)
{
outSubs[i] = Subsectors[i];
}
auto segCount = Segs.Size ();
outSegs.Alloc(segCount);
for (unsigned i = 0; i < segCount; ++i)
@ -161,7 +168,7 @@ void FNodeBuilder::Extract (FLevelLocals &theLevel)
D(Printf("%i segs, %i nodes, %i subsectors\n", segCount, nodeCount, subCount));
for (i = 0; i < Level.NumLines; ++i)
for (int i = 0; i < Level.NumLines; ++i)
{
Level.Lines[i].v1 = &outVerts[(size_t)Level.Lines[i].v1];
Level.Lines[i].v2 = &outVerts[(size_t)Level.Lines[i].v2];
@ -180,10 +187,18 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp)
}
bsp->Subsectors.Resize(Subsectors.Size());
memset(&bsp->Subsectors[0], 0, Subsectors.Size() * sizeof(subsector_t));
for (i = 0; i < bsp->Subsectors.Size(); ++i)
{
bsp->Subsectors[i].sprites.Clear();
memset((void*)&bsp->Subsectors[i], 0, sizeof(mapsubsector_t));
}
bsp->Nodes.Resize(Nodes.Size());
memcpy(&bsp->Nodes[0], &Nodes[0], Nodes.Size()*sizeof(node_t));
for (i = 0; i < Nodes.Size(); ++i)
{
bsp->Nodes[i] = Nodes[i];
}
for (i = 0; i < Nodes.Size(); ++i)
{
D(Printf(PRINT_LOG, "Node %d:\n", i));
@ -228,7 +243,11 @@ void FNodeBuilder::ExtractMini (FMiniBSP *bsp)
}
else
{
memcpy(&bsp->Subsectors[0], &Subsectors[0], Subsectors.Size()*sizeof(subsector_t));
for (i = 0; i < Subsectors.Size(); ++i)
{
bsp->Subsectors[i] = Subsectors[i];
}
bsp->Segs.Resize(Segs.Size());
for (i = 0; i < Segs.Size(); ++i)
{