From 8aab205d6d2f4082789e74d65585aea754b29e73 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 20 Mar 2025 12:12:39 +0100 Subject: [PATCH] qvkgen: fix Coverity complaint about uninit'ed data member Coverity complains that in the first return from VkSpecParser::parseCommand(), the c.deviceLevel member is left uninitialized. Correct, but harmless, since the only caller of the function discards results with an empty 'cmd.name`. To nonetheless fix this issue, return {} instead of c. This allows Coverity to continue diagnosing premature returns (which initializing c or c.deviceLevel explicitly would take away), at the cost of breaking NRVO in the function. qvkgen being a tool, I think we can live with that. Amends ff7dfd72162423e98d73728c5c9ea007b5960fe7. Coverity-Id: 478090 Change-Id: I8744765f893580c59215da351c37d3cbfa960e55 Reviewed-by: Laszlo Agocs --- src/tools/qvkgen/qvkgen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qvkgen/qvkgen.cpp b/src/tools/qvkgen/qvkgen.cpp index c5b48195b68..3caf921e57a 100644 --- a/src/tools/qvkgen/qvkgen.cpp +++ b/src/tools/qvkgen/qvkgen.cpp @@ -169,7 +169,7 @@ VkSpecParser::Command VkSpecParser::parseCommand() // skip commands with api="vulkansc", but the api attribute is optional if (!api.isEmpty() && !api.split(',').contains(QStringLiteral("vulkan"))) { skip(); - return c; + return {}; } while (!m_reader.atEnd()) {