From 360ca834e17870e56f987bb6ecca308ab9889409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 24 Jul 2021 19:14:50 +0200 Subject: [PATCH] Trade: GCC 11 CAN YOU STOP with the pointless fucking warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "funniest" of all is that those get printed in a totally random fashion. Some in Debug, some in Release, some not at all (like, half of the MaterialDataTest doesn'ลง initialize `state` and yet it doesn't complain). Fuck these half-assed features that achieve nothing except bullying people WHO KNOW WHAT THEY ARE DOING FFS. --- src/Magnum/Trade/Test/ImageDataTest.cpp | 30 ++++++++++--------- src/Magnum/Trade/Test/LightDataTest.cpp | 34 +++++++++++----------- src/Magnum/Trade/Test/MaterialDataTest.cpp | 4 +-- src/Magnum/Trade/Test/SkinDataTest.cpp | 2 +- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/Magnum/Trade/Test/ImageDataTest.cpp b/src/Magnum/Trade/Test/ImageDataTest.cpp index ca72fdcfd..e1dd98e4b 100644 --- a/src/Magnum/Trade/Test/ImageDataTest.cpp +++ b/src/Magnum/Trade/Test/ImageDataTest.cpp @@ -201,7 +201,7 @@ namespace Vk { void ImageDataTest::constructGeneric() { { auto data = new char[4*4]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelFormat::RGBA8Unorm, {1, 3}, Containers::Array{data, 4*4}, &state}; CORRADE_COMPARE(a.dataFlags(), DataFlag::Owned|DataFlag::Mutable); @@ -220,7 +220,7 @@ void ImageDataTest::constructGeneric() { CORRADE_COMPARE(a.importerState(), &state); } { auto data = new char[3*2]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), PixelFormat::R16UI, {1, 3}, Containers::Array{data, 3*2}, &state}; @@ -245,7 +245,7 @@ void ImageDataTest::constructImplementationSpecific() { /* Single format */ { auto data = new char[3*12]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), Vk::PixelFormat::R32G32B32F, {1, 3}, Containers::Array{data, 3*12}, &state}; @@ -268,7 +268,7 @@ void ImageDataTest::constructImplementationSpecific() { /* Format + extra */ { auto data = new char[3*6]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), GL::PixelFormat::RGB, GL::PixelType::UnsignedShort, {1, 3}, Containers::Array{data, 3*6}, &state}; @@ -290,7 +290,7 @@ void ImageDataTest::constructImplementationSpecific() { /* Manual pixel size */ { auto data = new char[3*6]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), 666, 1337, 6, {1, 3}, Containers::Array{data, 3*6}, &state}; CORRADE_COMPARE(a.dataFlags(), DataFlag::Owned|DataFlag::Mutable); @@ -313,7 +313,7 @@ void ImageDataTest::constructImplementationSpecific() { void ImageDataTest::constructCompressedGeneric() { { auto data = new char[8]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, Containers::Array{data, 8}, &state}; @@ -329,7 +329,7 @@ void ImageDataTest::constructCompressedGeneric() { CORRADE_COMPARE(a.importerState(), &state); } { auto data = new char[8]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), CompressedPixelFormat::Bc1RGBAUnorm, {4, 4}, Containers::Array{data, 8}, &state}; @@ -351,7 +351,7 @@ void ImageDataTest::constructCompressedImplementationSpecific() { /* Format with autodetection */ { auto data = new char[8]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), GL::CompressedPixelFormat::RGBS3tcDxt1, {4, 4}, Containers::Array{data, 8}, &state}; @@ -675,7 +675,7 @@ void ImageDataTest::constructCopy() { void ImageDataTest::constructMoveGeneric() { auto data = new char[3*16]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), PixelFormat::RGBA32F, {1, 3}, Containers::Array{data, 3*16}, &state}; ImageData2D b(std::move(a)); @@ -718,7 +718,7 @@ void ImageDataTest::constructMoveGeneric() { void ImageDataTest::constructMoveImplementationSpecific() { auto data = new char[3*6]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{PixelStorage{}.setAlignment(1), GL::PixelFormat::RGB, GL::PixelType::UnsignedShort, {1, 3}, Containers::Array{data, 3*6}, &state}; ImageData2D b(std::move(a)); @@ -759,7 +759,7 @@ void ImageDataTest::constructMoveImplementationSpecific() { void ImageDataTest::constructMoveCompressedGeneric() { auto data = new char[8]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{ CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), CompressedPixelFormat::Bc3RGBAUnorm, {4, 4}, Containers::Array{data, 8}, &state}; @@ -796,7 +796,7 @@ void ImageDataTest::constructMoveCompressedGeneric() { void ImageDataTest::constructMoveCompressedImplementationSpecific() { auto data = new char[8]; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ ImageData2D a{ CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), GL::CompressedPixelFormat::RGBS3tcDxt1, {4, 4}, Containers::Array{data, 8}, &state}; @@ -833,7 +833,8 @@ void ImageDataTest::constructMoveCompressedImplementationSpecific() { void ImageDataTest::constructMoveAttachState() { auto data = new char[3*6]; - int stateOld, stateNew; + /* GCC 11 pointlessly complains that "maybe uninitialized" w/o the {} */ + int stateOld{}, stateNew{}; ImageData2D a{PixelStorage{}.setAlignment(1), GL::PixelFormat::RGB, GL::PixelType::UnsignedShort, {1, 3}, Containers::Array{data, 3*6}, &stateOld}; ImageData2D b{std::move(a), &stateNew}; @@ -855,7 +856,8 @@ void ImageDataTest::constructMoveAttachState() { void ImageDataTest::constructMoveCompressedAttachState() { auto data = new char[8]; - int stateOld, stateNew; + /* GCC 11 pointlessly complains that "maybe uninitialized" w/o the {} */ + int stateOld{}, stateNew{}; ImageData2D a{ CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), GL::CompressedPixelFormat::RGBS3tcDxt1, {4, 4}, Containers::Array{data, 8}, &stateOld}; diff --git a/src/Magnum/Trade/Test/LightDataTest.cpp b/src/Magnum/Trade/Test/LightDataTest.cpp index 0660437ee..fe7bc3fb5 100644 --- a/src/Magnum/Trade/Test/LightDataTest.cpp +++ b/src/Magnum/Trade/Test/LightDataTest.cpp @@ -102,7 +102,7 @@ LightDataTest::LightDataTest() { void LightDataTest::construct() { { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, 15.0f, @@ -120,7 +120,7 @@ void LightDataTest::construct() { /* Implicit spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, 15.0f, @@ -137,7 +137,7 @@ void LightDataTest::construct() { /* Implicit non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Point, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, 15.0f, @@ -157,7 +157,7 @@ void LightDataTest::construct() { void LightDataTest::constructAttenuation() { /* Implicit range */ { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, @@ -175,7 +175,7 @@ void LightDataTest::constructAttenuation() { /* Implicit range + spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, @@ -192,7 +192,7 @@ void LightDataTest::constructAttenuation() { /* Implicit range + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Point, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, @@ -212,7 +212,7 @@ void LightDataTest::constructAttenuation() { void LightDataTest::constructRange() { /* Implicit attenuation for a spot */ { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, 15.0f, @@ -230,7 +230,7 @@ void LightDataTest::constructRange() { /* Implicit attenuation for a spot + spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, 15.0f, @@ -247,7 +247,7 @@ void LightDataTest::constructRange() { /* Implicit attenuation for a point + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Point, 0xccff33_rgbf, 0.8f, 15.0f, @@ -264,7 +264,7 @@ void LightDataTest::constructRange() { /* Implicit attenuation for an ambient + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Ambient, 0xccff33_rgbf, 0.8f, Constants::inf(), @@ -281,7 +281,7 @@ void LightDataTest::constructRange() { /* Implicit attenuation for a directional + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Directional, 0xccff33_rgbf, 0.8f, Constants::inf(), @@ -301,7 +301,7 @@ void LightDataTest::constructRange() { void LightDataTest::constructNone() { /* Implicit attenuation + range for a spot */ { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, 15.0_degf, 35.0_degf, @@ -318,7 +318,7 @@ void LightDataTest::constructNone() { /* Implicit attenuation + range for a spot + spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, &a}; @@ -334,7 +334,7 @@ void LightDataTest::constructNone() { /* Implicit attenuation + range for a point + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Point, 0xccff33_rgbf, 0.8f, &a}; @@ -350,7 +350,7 @@ void LightDataTest::constructNone() { /* Implicit attenuation for an ambient + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Ambient, 0xccff33_rgbf, 0.8f, &a}; @@ -366,7 +366,7 @@ void LightDataTest::constructNone() { /* Implicit attenuation for a directional + non-spot angles */ } { - int a; + int a{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData data{LightData::Type::Directional, 0xccff33_rgbf, 0.8f, &a}; @@ -402,7 +402,7 @@ void LightDataTest::constructCopy() { } void LightDataTest::constructMove() { - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ LightData a{LightData::Type::Spot, 0xccff33_rgbf, 0.8f, {0.1f, 0.5f, 0.7f}, 15.0f, diff --git a/src/Magnum/Trade/Test/MaterialDataTest.cpp b/src/Magnum/Trade/Test/MaterialDataTest.cpp index 0c5824543..609027115 100644 --- a/src/Magnum/Trade/Test/MaterialDataTest.cpp +++ b/src/Magnum/Trade/Test/MaterialDataTest.cpp @@ -1188,7 +1188,7 @@ void MaterialDataTest::constructNonOwned() { {"highlightColor"_s, Vector4{0.2f, 0.6f, 0.4f, 1.0f}} }; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ MaterialData data{MaterialType::Phong, {}, attributes, &state}; /* Expecting the same output as in construct() */ @@ -1230,7 +1230,7 @@ void MaterialDataTest::constructNonOwnedLayers() { 2, 5, 5, 7 }; - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ MaterialData data{MaterialType::Phong, {}, attributes, {}, layers, &state}; diff --git a/src/Magnum/Trade/Test/SkinDataTest.cpp b/src/Magnum/Trade/Test/SkinDataTest.cpp index 35fed740a..7b11a7a68 100644 --- a/src/Magnum/Trade/Test/SkinDataTest.cpp +++ b/src/Magnum/Trade/Test/SkinDataTest.cpp @@ -69,7 +69,7 @@ void SkinDataTest::construct() { } void SkinDataTest::constructNonOwned() { - int state; + int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */ const UnsignedInt jointData[]{0, 2, 3}; const Matrix4 inverseBindMatrixData[]{ Matrix4::translation(Vector3::zAxis(0.0f)),