Browse Source

GCC 11, your fancy new warnings are NOT helpful.

pull/527/head
Vladimír Vondruš 5 years ago
parent
commit
f216320da6
  1. 8
      doc/snippets/MagnumGL.cpp
  2. 16
      doc/snippets/MagnumMath.cpp
  3. 12
      src/Magnum/Trade/Test/MeshDataTest.cpp
  4. 4
      src/Magnum/Trade/Test/SkinDataTest.cpp

8
doc/snippets/MagnumGL.cpp

@ -121,7 +121,15 @@ carBumpTexture.setStorage(5, GL::TextureFormat::RGB8, {256, 256})
#endif #endif
{ {
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic push
/* Stupid thing. YES I WANT THIS TO BE A FUNCTION, CAN YOU SHUT UP */
#pragma GCC diagnostic ignored "-Wvexing-parse"
#endif
auto importSomeMesh() -> std::tuple<GL::Mesh, GL::Buffer, GL::Buffer>; auto importSomeMesh() -> std::tuple<GL::Mesh, GL::Buffer, GL::Buffer>;
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic pop
#endif
/* [opengl-wrapping-nocreate] */ /* [opengl-wrapping-nocreate] */
GL::Mesh mesh{NoCreate}; GL::Mesh mesh{NoCreate};
GL::Buffer vertices{NoCreate}, indices{NoCreate}; GL::Buffer vertices{NoCreate}, indices{NoCreate};

16
doc/snippets/MagnumMath.cpp

@ -625,6 +625,11 @@ static_cast<void>(radians);
} }
{ {
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic push
/* Stupid thing. YES I WANT THIS TO BE A FUNCTION, CAN YOU SHUT UP */
#pragma GCC diagnostic ignored "-Wvexing-parse"
#endif
/* [Deg-usage-convert] */ /* [Deg-usage-convert] */
Double foo(); Double foo();
@ -634,6 +639,9 @@ Radd radians{foo()};
/* [Deg-usage-convert] */ /* [Deg-usage-convert] */
static_cast<void>(degrees); static_cast<void>(degrees);
static_cast<void>(radians); static_cast<void>(radians);
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic pop
#endif
} }
{ {
@ -646,6 +654,11 @@ static_cast<void>(b);
} }
{ {
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic push
/* Stupid thing. YES I WANT THIS TO BE A FUNCTION, CAN YOU SHUT UP */
#pragma GCC diagnostic ignored "-Wvexing-parse"
#endif
Double foo(); Double foo();
/* [Deg-usage-comparison] */ /* [Deg-usage-comparison] */
Rad angle(); Rad angle();
@ -654,6 +667,9 @@ Deg x = angle(); // convert to degrees for easier comparison
if(x < 30.0_degf) foo(); if(x < 30.0_degf) foo();
//if(x > 1.57_radf) bar(); // error, both need to be of the same type //if(x > 1.57_radf) bar(); // error, both need to be of the same type
/* [Deg-usage-comparison] */ /* [Deg-usage-comparison] */
#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11
#pragma GCC diagnostic pop
#endif
} }
{ {

12
src/Magnum/Trade/Test/MeshDataTest.cpp

@ -1552,8 +1552,8 @@ void MeshDataTest::constructAttributelessNotOwned() {
} }
void MeshDataTest::constructIndexlessAttributeless() { void MeshDataTest::constructIndexlessAttributeless() {
int importerState; int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */
MeshData data{MeshPrimitive::TriangleStrip, 37, &importerState}; MeshData data{MeshPrimitive::TriangleStrip, 37, &state};
/* These are both empty so it doesn't matter, but this is a nice /* These are both empty so it doesn't matter, but this is a nice
non-restrictive default */ non-restrictive default */
CORRADE_COMPARE(data.indexDataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(data.indexDataFlags(), DataFlag::Owned|DataFlag::Mutable);
@ -1562,7 +1562,7 @@ void MeshDataTest::constructIndexlessAttributeless() {
CORRADE_VERIFY(!data.attributeData()); CORRADE_VERIFY(!data.attributeData());
CORRADE_COMPARE(data.indexData(), nullptr); CORRADE_COMPARE(data.indexData(), nullptr);
CORRADE_COMPARE(data.vertexData(), nullptr); CORRADE_COMPARE(data.vertexData(), nullptr);
CORRADE_COMPARE(data.importerState(), &importerState); CORRADE_COMPARE(data.importerState(), &state);
CORRADE_VERIFY(!data.isIndexed()); CORRADE_VERIFY(!data.isIndexed());
CORRADE_COMPARE(data.vertexCount(), 37); CORRADE_COMPARE(data.vertexCount(), 37);
@ -1570,13 +1570,13 @@ void MeshDataTest::constructIndexlessAttributeless() {
} }
void MeshDataTest::constructIndexlessAttributelessZeroVertices() { void MeshDataTest::constructIndexlessAttributelessZeroVertices() {
int importerState; int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */
MeshData data{MeshPrimitive::TriangleStrip, 0, &importerState}; MeshData data{MeshPrimitive::TriangleStrip, 0, &state};
CORRADE_COMPARE(data.primitive(), MeshPrimitive::TriangleStrip); CORRADE_COMPARE(data.primitive(), MeshPrimitive::TriangleStrip);
CORRADE_VERIFY(!data.attributeData()); CORRADE_VERIFY(!data.attributeData());
CORRADE_COMPARE(data.indexData(), nullptr); CORRADE_COMPARE(data.indexData(), nullptr);
CORRADE_COMPARE(data.vertexData(), nullptr); CORRADE_COMPARE(data.vertexData(), nullptr);
CORRADE_COMPARE(data.importerState(), &importerState); CORRADE_COMPARE(data.importerState(), &state);
CORRADE_VERIFY(!data.isIndexed()); CORRADE_VERIFY(!data.isIndexed());
CORRADE_COMPARE(data.vertexCount(), 0); CORRADE_COMPARE(data.vertexCount(), 0);

4
src/Magnum/Trade/Test/SkinDataTest.cpp

@ -56,7 +56,7 @@ SkinDataTest::SkinDataTest() {
} }
void SkinDataTest::construct() { void SkinDataTest::construct() {
int state; int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */
SkinData3D data{{0, 2, 3}, { SkinData3D data{{0, 2, 3}, {
Matrix4::translation(Vector3::zAxis(0.0f)), Matrix4::translation(Vector3::zAxis(0.0f)),
Matrix4::translation(Vector3::zAxis(2.0f)), Matrix4::translation(Vector3::zAxis(2.0f)),
@ -102,7 +102,7 @@ void SkinDataTest::constructCopy() {
} }
void SkinDataTest::constructMove() { void SkinDataTest::constructMove() {
int state; int state{}; /* GCC 11 complains that "maybe uninitialized" w/o the {} */
SkinData3D a{{0, 2, 3}, { SkinData3D a{{0, 2, 3}, {
Matrix4::translation(Vector3::zAxis(0.0f)), Matrix4::translation(Vector3::zAxis(0.0f)),
Matrix4::translation(Vector3::zAxis(2.0f)), Matrix4::translation(Vector3::zAxis(2.0f)),

Loading…
Cancel
Save