diff --git a/doc/snippets/MagnumAnimation.cpp b/doc/snippets/MagnumAnimation.cpp index 9f91e21fc..6f804f4d6 100644 --- a/doc/snippets/MagnumAnimation.cpp +++ b/doc/snippets/MagnumAnimation.cpp @@ -33,6 +33,8 @@ #include "Magnum/Animation/Easing.h" #include "Magnum/Animation/Player.h" +#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ + using namespace Magnum; using namespace Magnum::Math::Literals; @@ -55,7 +57,7 @@ static_cast(result2); { /* [unpack] */ -UnsignedShort a, b; +UnsignedShort a = DOXYGEN_ELLIPSIS(0), b = DOXYGEN_ELLIPSIS(0); auto lerpPacked = Animation::unpack>(); @@ -68,7 +70,7 @@ static_cast(result2); { /* [unpackEase] */ -UnsignedShort a, b; +UnsignedShort a = DOXYGEN_ELLIPSIS(0), b = DOXYGEN_ELLIPSIS(0); auto lerpPackedBounceIn = Animation::unpackEase, Animation::Easing::bounceIn>(); @@ -150,8 +152,6 @@ player.add(scaling, objectScaling) /* [Player-usage] */ } -/* WinRT has warnings-as-errors and fails on the unitialized object var */ -#ifndef CORRADE_TARGET_WINDOWS_RT { const Animation::TrackView translation; const Animation::TrackView rotation; @@ -161,15 +161,8 @@ struct Object3D { Object3D& setRotation(const Quaternion&) { return *this; } Object3D& setScaling(const Vector3&) { return *this; } }; -#ifdef __clang__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" -#elif defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif /* [Player-usage-callback] */ -Object3D* object; +Object3D* object = DOXYGEN_ELLIPSIS({}); Animation::Player player; player.addWithCallback(scaling, @@ -185,11 +178,7 @@ player.addWithCallback(translation, object.setTranslation(translation); }, *object); /* [Player-usage-callback] */ -#if defined(__clang__) || defined(__GNUC__) -#pragma GCC diagnostic pop -#endif } -#endif { /* [Player-usage-playback] */ diff --git a/doc/snippets/MagnumMath.cpp b/doc/snippets/MagnumMath.cpp index 89e9eb864..e32ee1dbb 100644 --- a/doc/snippets/MagnumMath.cpp +++ b/doc/snippets/MagnumMath.cpp @@ -627,7 +627,7 @@ static_cast(radians); } { -#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11 +#if (defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11) || defined(CORRADE_TARGET_CLANG) #pragma GCC diagnostic push /* Stupid thing. YES I WANT THIS TO BE A FUNCTION, CAN YOU SHUT UP */ #pragma GCC diagnostic ignored "-Wvexing-parse" @@ -641,7 +641,7 @@ Radd radians{foo()}; /* [Deg-usage-convert] */ static_cast(degrees); static_cast(radians); -#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11 +#if (defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11) || defined(CORRADE_TARGET_CLANG) #pragma GCC diagnostic pop #endif } @@ -656,7 +656,7 @@ static_cast(b); } { -#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11 +#if (defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11) || defined(CORRADE_TARGET_CLANG) #pragma GCC diagnostic push /* Stupid thing. YES I WANT THIS TO BE A FUNCTION, CAN YOU SHUT UP */ #pragma GCC diagnostic ignored "-Wvexing-parse" @@ -669,7 +669,7 @@ Deg x = angle(); // convert to degrees for easier comparison if(x < 30.0_degf) foo(); //if(x > 1.57_radf) bar(); // error, both need to be of the same type /* [Deg-usage-comparison] */ -#if defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11 +#if (defined(CORRADE_TARGET_GCC) && __GNUC__ >= 11) || defined(CORRADE_TARGET_CLANG) #pragma GCC diagnostic pop #endif } diff --git a/doc/snippets/MagnumPlatform.cpp b/doc/snippets/MagnumPlatform.cpp index a1f312e97..915a1f3da 100644 --- a/doc/snippets/MagnumPlatform.cpp +++ b/doc/snippets/MagnumPlatform.cpp @@ -23,6 +23,8 @@ DEALINGS IN THE SOFTWARE. */ +#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ + /* [windowed] */ #include #include @@ -182,14 +184,10 @@ void MyApplication::globalDrawEvent() { void foo(); void foo() { -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -#endif /* [ScreenedApplication-for-range] */ MyApplication app; for(Platform::Screen& screen: app.screens()) { - // ... + DOXYGEN_ELLIPSIS(static_cast(screen)); } /* [ScreenedApplication-for-range] */ @@ -198,9 +196,6 @@ for(Platform::Screen* s = app.screens().first(); s; s = s->nextFartherScreen()) // ... } /* [ScreenedApplication-for] */ -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif } } diff --git a/doc/snippets/MagnumSceneGraph.cpp b/doc/snippets/MagnumSceneGraph.cpp index e8c32dcc7..e4ba04d25 100644 --- a/doc/snippets/MagnumSceneGraph.cpp +++ b/doc/snippets/MagnumSceneGraph.cpp @@ -38,6 +38,8 @@ #include "Magnum/SceneGraph/Object.h" #include "Magnum/SceneGraph/Scene.h" +#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ + using namespace Magnum; using namespace Magnum::Math::Literals; @@ -63,6 +65,11 @@ class TransformingFeature: public SceneGraph::AbstractFeature3D { template explicit TransformingFeature(SceneGraph::Object& object): SceneGraph::AbstractFeature3D{object}, _transformation{object} {} + DOXYGEN_ELLIPSIS(void foo() { + /* to avoid warnings about an unused private field */ + _transformation.translate({}); + }) + private: SceneGraph::AbstractTranslationRotation3D& _transformation; }; @@ -138,23 +145,21 @@ class CachingObject: public Object3D, SceneGraph::AbstractFeature3D { namespace { -#ifdef __clang__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-private-field" -#endif /* [transformation] */ class TransformingFeature: public SceneGraph::AbstractFeature3D { public: template explicit TransformingFeature(SceneGraph::Object& object): SceneGraph::AbstractFeature3D(object), _transformation(object) {} + DOXYGEN_ELLIPSIS(void foo() { + /* to avoid warnings about an unused private field */ + _transformation.translate({}); + }) + private: SceneGraph::AbstractTranslationRotation3D& _transformation; }; /* [transformation] */ -#ifdef __clang__ -#pragma GCC diagnostic pop -#endif } @@ -271,13 +276,9 @@ class MyObject: MyFeature, public Object3D { { SceneGraph::Object object; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -#endif /* [AbstractObject-features-range] */ for(SceneGraph::AbstractFeature3D& feature: object.features()) { - // ... + DOXYGEN_ELLIPSIS(static_cast(feature)); } /* [AbstractObject-features-range] */ @@ -285,17 +286,14 @@ for(SceneGraph::AbstractFeature3D& feature: object.features()) { /* [Object-children-range] */ Object3D o; for(Object3D& child: o.children()) { - // ... + DOXYGEN_ELLIPSIS(static_cast(child)); } /* [Object-children-range] */ } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif /* [AbstractObject-features] */ for(SceneGraph::AbstractFeature3D* feature = object.features().first(); feature; feature = feature->nextFeature()) { - // ... + DOXYGEN_ELLIPSIS() } /* [AbstractObject-features] */ @@ -303,7 +301,7 @@ for(SceneGraph::AbstractFeature3D* feature = object.features().first(); feature; Object3D o; /* [Object-children] */ for(Object3D* child = o.children().first(); child; child = child->nextSibling()) { - // ... + DOXYGEN_ELLIPSIS() } /* [Object-children] */ } @@ -315,7 +313,7 @@ SceneGraph::AnimableGroup3D animables; (new AnimableObject(&scene, &animables)) ->setState(SceneGraph::AnimationState::Running); -// ... +DOXYGEN_ELLIPSIS() /* [Animable-usage] */ } @@ -365,7 +363,7 @@ SceneGraph::DrawableGroup3D drawableGroup; struct CullableDrawable3D: SceneGraph::Drawable3D { Range3D aabb; /* Relative to world origin */ - // ... + DOXYGEN_ELLIPSIS() }; /* Camera frustum relative to world origin */