Skip to content

Commit 0f262fe

Browse files
committed
cppcheck fixes
1 parent 179c85c commit 0f262fe

7 files changed

Lines changed: 26 additions & 11 deletions

File tree

cmake/cppcheck-suppression-list.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,23 @@ constVariablePointer:*/src/vsg/app/SecondaryCommandGraph.cpp
244244
passedByValue:*/src/vsg/vk/Device.cpp
245245
passedByValue:*/src/vsg/vk/Instance.cpp
246246

247-
// suppress inapproach functionStatic warnings
247+
// suppress inappropriate warnings
248248
functionStatic:*/include/vsg/io/Output.h
249249
functionStatic:*/include/vsg/io/Input.h
250+
functionStatic:*/src/vsg/app/CompileManager.h
251+
functionStatic:*/include/vsg/app/RecordTraversal.h
252+
functionStatic:*/include/vsg/io/VSG.h
253+
functionStatic:*/include/vsg/io/json.h
254+
functionStatic:*/include/vsg/io/txt.h
255+
functionStatic:*/include/vsg/io/tile.h
256+
functionStatic:*/include/vsg/state/QueryPool.h
257+
functionStatic:*/include/vsg/state/ArrayState.h
258+
functionStatic:*/include/vsg/text/StandardLayout.h
259+
functionStatic:*/include/vsg/utils/Builder.h
260+
functionStatic:*/include/vsg/utils/ShaderCompiler.h
261+
functionStatic:*/
262+
functionStatic:*/
263+
264+
265+
// suppress inappropriate warnings
266+
suspiciousFloatingPointCast:*/src/vsg/maths/maths_transform.cpp

include/vsg/utils/TracyInstrumentation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace vsg
8080
mutable std::map<ref_ptr<Device>, std::pair<tracy::VkCtx*, bool>> ctxMap;
8181

8282
protected:
83-
~TracyContexts()
83+
~TracyContexts() override
8484
{
8585
for (auto itr = ctxMap.begin(); itr != ctxMap.end(); ++itr)
8686
{

src/vsg/app/Viewer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void Viewer::removeWindow(ref_ptr<Window> window)
9292
CommandGraphs commandGraphs;
9393
for (const auto& task : recordAndSubmitTasks)
9494
{
95-
for (auto& cg : task->commandGraphs)
95+
for (const auto& cg : task->commandGraphs)
9696
{
9797
if (cg->window != window) commandGraphs.push_back(cg);
9898
}
@@ -582,7 +582,7 @@ void Viewer::addRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
582582
CommandGraphs combinedCommandGraphs;
583583
for (const auto& task : recordAndSubmitTasks)
584584
{
585-
for (auto& cg : task->commandGraphs)
585+
for (const auto& cg : task->commandGraphs)
586586
{
587587
combinedCommandGraphs.push_back(cg);
588588
}

src/vsg/commands/ExecuteCommands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void ExecuteCommands::record(CommandBuffer& commandBuffer) const
7171

7272
std::scoped_lock lock(_mutex);
7373
std::vector<VkCommandBuffer> vk_commandBuffers;
74-
for (auto& entry : _commandGraphsAndBuffers)
74+
for (const auto& entry : _commandGraphsAndBuffers)
7575
{
7676
if (entry.cb) vk_commandBuffers.push_back(*entry.cb);
7777
}

src/vsg/state/ViewDependentState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ void ViewDependentState::traverse(RecordTraversal& rt) const
658658
dbox eyeSpaceRegionBounds;
659659
for (auto& [mv, regionOfInterest] : rt.regionsOfInterest)
660660
{
661-
for (auto& v : regionOfInterest->points)
661+
for (const auto& v : regionOfInterest->points)
662662
{
663663
eyeSpaceRegionBounds.add(mv * v);
664664
}

src/vsg/utils/ComputeBounds.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void ComputeBounds::add(const dbox& bb)
302302
}
303303
else
304304
{
305-
auto& matrix = matrixStack.back();
305+
const auto& matrix = matrixStack.back();
306306
bounds.add(matrix * bb.min);
307307
bounds.add(matrix * dvec3(bb.max.x, bb.min.y, bb.min.z));
308308
bounds.add(matrix * dvec3(bb.max.x, bb.max.y, bb.min.z));
@@ -323,7 +323,7 @@ void ComputeBounds::add(const dsphere& bs)
323323
}
324324
else
325325
{
326-
auto& matrix = matrixStack.back();
326+
const auto& matrix = matrixStack.back();
327327
bounds.add(matrix * dvec3(bs.center.x - bs.radius, bs.center.y - bs.radius, bs.center.z - bs.radius));
328328
bounds.add(matrix * dvec3(bs.center.x + bs.radius, bs.center.y - bs.radius, bs.center.z - bs.radius));
329329
bounds.add(matrix * dvec3(bs.center.x - bs.radius, bs.center.y + bs.radius, bs.center.z - bs.radius));

src/vsg/utils/ShaderCompiler.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ bool ShaderCompiler::compile(ShaderStages& shaders, const std::vector<std::strin
281281
std::string finalShaderSource = vsg::insertIncludes(vsg_shader->module->source, options);
282282

283283
std::vector<std::string> combinedDefines(defines);
284-
for (auto& define : settings->defines) combinedDefines.push_back(define);
284+
for (const auto& define : settings->defines) combinedDefines.push_back(define);
285285
if (!combinedDefines.empty()) finalShaderSource = combineSourceAndDefines(finalShaderSource, combinedDefines);
286286

287287
vsg::debug("ShaderCompiler::compile() combinedDefines = ", combinedDefines);
@@ -472,8 +472,6 @@ std::string ShaderCompiler::combineSourceAndDefines(const std::string& source, c
472472
const std::string versionmatch = "#version";
473473
const std::string importdefinesmatch = "#pragma import_defines";
474474

475-
std::vector<std::string> finaldefines;
476-
477475
for (std::string line; std::getline(iss, line);)
478476
{
479477
std::string sanitisedline = line;

0 commit comments

Comments
 (0)