From aed459be28f44a535965d510523ee3f84638f4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 20 Jan 2022 11:51:42 +0100 Subject: [PATCH] Trade: ahh GCC 11 you and your useless warnings. The previous commits changed *nothing* related to this code, yet somehow a Release build started warning about this variable maybe being used uninitialized in the attribute checking loop even though it's *clearly* not the case. Tools are getting less useful and more annoying DAY BY DAY. --- src/Magnum/Trade/MeshData.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Trade/MeshData.cpp b/src/Magnum/Trade/MeshData.cpp index a7eeabb02..24e956468 100644 --- a/src/Magnum/Trade/MeshData.cpp +++ b/src/Magnum/Trade/MeshData.cpp @@ -111,7 +111,14 @@ MeshData::MeshData(const MeshPrimitive primitive, Containers::Array&& inde CORRADE_ASSERT(vertexCount != ImplicitVertexCount, "Trade::MeshData: vertex count can't be implicit if there are no attributes", ); _vertexCount = vertexCount; - /* No attributes, so we won't be checking anything */ + #ifndef CORRADE_NO_ASSERT + /* No attributes, so we won't be checking anything. GCC 11 however + insists that "warning: ‘expectedAttributeVertexCount’ may be used + uninitialized in this function" so I initialize the variable here to + make the damn thing shut up. YOUR NEW WARNINGS ARE NOT USEFUL, + GCC. */ + expectedAttributeVertexCount = ~UnsignedInt{}; + #endif } else if(vertexCount != ImplicitVertexCount) { _vertexCount = vertexCount; #ifndef CORRADE_NO_ASSERT