diff --git a/doc/snippets/MagnumShaderTools.cpp b/doc/snippets/MagnumShaderTools.cpp index 8897c2d96..da4bdca18 100644 --- a/doc/snippets/MagnumShaderTools.cpp +++ b/doc/snippets/MagnumShaderTools.cpp @@ -100,7 +100,11 @@ Containers::Optional> spirv = } { -Containers::Pointer converter; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer converter = manager.loadAndInstantiate("SomethingWhatever"); Containers::Array extract(const std::string&, const std::string&); /* [AbstractConverter-usage-callbacks] */ struct Data { @@ -136,7 +140,11 @@ auto result = converter->validateFile(ShaderTools::Stage::Fragment, "ssao.frag") } { -Containers::Pointer converter; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer converter = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractConverter-setInputFileCallback] */ converter->setInputFileCallback([](const std::string& filename, InputFileCallbackPolicy, void*) { @@ -147,7 +155,11 @@ converter->setInputFileCallback([](const std::string& filename, } { -Containers::Pointer converter; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer converter = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractConverter-setInputFileCallback-template] */ const Utility::Resource rs{"data"}; converter->setInputFileCallback([](const std::string& filename, diff --git a/doc/snippets/MagnumText.cpp b/doc/snippets/MagnumText.cpp index 4e21fb97a..5901d9a4c 100644 --- a/doc/snippets/MagnumText.cpp +++ b/doc/snippets/MagnumText.cpp @@ -39,6 +39,8 @@ #include "Magnum/Text/DistanceFieldGlyphCache.h" #include "Magnum/Text/Renderer.h" +#define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ + using namespace Magnum; using namespace Magnum::Math::Literals; @@ -61,7 +63,11 @@ font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) { -Containers::Pointer font; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; +Containers::Pointer font = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractFont-usage-callbacks] */ struct Data { std::unordered_mapopenFile("magnum-font.conf", 13.0f); #endif { -Containers::Pointer font; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; +Containers::Pointer font = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractFont-setFileCallback] */ font->setFileCallback([](const std::string& filename, InputFileCallbackPolicy, void*) { @@ -106,7 +116,11 @@ font->setFileCallback([](const std::string& filename, } { -Containers::Pointer font; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; +Containers::Pointer font = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractFont-setFileCallback-template] */ const Utility::Resource rs{"data"}; font->setFileCallback([](const std::string& filename, @@ -117,8 +131,12 @@ font->setFileCallback([](const std::string& filename, } { +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; /* [DistanceFieldGlyphCache-usage] */ -Containers::Pointer font; +Containers::Pointer font = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); Text::DistanceFieldGlyphCache cache{Vector2i{2048}, Vector2i{384}, 16}; font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -127,8 +145,12 @@ font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" } { +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; /* [GlyphCache-usage] */ -Containers::Pointer font; +Containers::Pointer font = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); Text::GlyphCache cache{Vector2i{512}}; font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -138,9 +160,13 @@ font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" { Matrix3 projectionMatrix; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the font pointer. I don't care, I just want you to check compilation errors, + not more! */ +PluginManager::Manager manager; /* [Renderer-usage1] */ /* Font instance, received from a plugin manager */ -Containers::Pointer font; +Containers::Pointer font = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); /* Configured glyph cache */ Text::GlyphCache cache{Vector2i{512}}; diff --git a/doc/snippets/MagnumTrade.cpp b/doc/snippets/MagnumTrade.cpp index 43eaad7d6..4c0359003 100644 --- a/doc/snippets/MagnumTrade.cpp +++ b/doc/snippets/MagnumTrade.cpp @@ -149,7 +149,11 @@ if(!image) Fatal{} << "Importing the image failed"; } { -Containers::Pointer importer; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer importer = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractImporter-usage-data] */ Utility::Resource rs{"data"}; Containers::ArrayView data = rs.getRaw("image.png"); @@ -162,7 +166,11 @@ if(!importer->openData(data)) /* or openMemory() */ #if defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) { -Containers::Pointer importer; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer importer = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractImporter-usage-callbacks] */ struct Data { std::unordered_mapopenFile("scene.gltf"); // memory-maps all files #endif { -Containers::Pointer importer; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer importer = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractImporter-setFileCallback] */ importer->setFileCallback([](const std::string& filename, InputFileCallbackPolicy, void*) { @@ -207,7 +219,11 @@ importer->setFileCallback([](const std::string& filename, } { -Containers::Pointer importer; +/* -Wnonnull in GCC 11+ "helpfully" says "this is null" if I don't initialize + the converter pointer. I don't care, I just want you to check compilation + errors, not more! */ +PluginManager::Manager manager; +Containers::Pointer importer = manager.loadAndInstantiate("SomethingWhatever"); /* [AbstractImporter-setFileCallback-template] */ const Utility::Resource rs{"data"}; importer->setFileCallback([](const std::string& filename,