From d253757bc48db875ee894deaf7c5ed0de06b2450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 23 Nov 2023 14:09:11 +0100 Subject: [PATCH] doc: work around annoying GCC warnings in doc snippets. Ugh! --- doc/snippets/MagnumText.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/snippets/MagnumText.cpp b/doc/snippets/MagnumText.cpp index 325ca9b68..95de01108 100644 --- a/doc/snippets/MagnumText.cpp +++ b/doc/snippets/MagnumText.cpp @@ -261,8 +261,12 @@ for(std::size_t i = 0; i != fontGlyphIds.size(); ++i) { } { +/* -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; /* [AbstractShaper-shape] */ -Containers::Pointer font = DOXYGEN_ELLIPSIS({}); +Containers::Pointer font = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); Containers::Pointer shaper = font->createShaper(); /* Set text properties and shape it */ @@ -287,7 +291,11 @@ shaper->glyphOffsetsAdvancesInto( } { -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"); Containers::Pointer shaper = font->createShaper(); /* [AbstractShaper-shape-features] */ shaper->shape("Hello, world!", { @@ -302,9 +310,13 @@ struct GlyphInfo { Vector2 offset; Vector2 advance; }; +/* -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; /* [AbstractShaper-shape-multiple] */ -Containers::Pointer font = DOXYGEN_ELLIPSIS({}); -Containers::Pointer boldFont = DOXYGEN_ELLIPSIS({}); +Containers::Pointer font = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); +Containers::Pointer boldFont = DOXYGEN_ELLIPSIS(manager.loadAndInstantiate("SomethingWhatever")); Containers::Pointer shaper = font->createShaper(); Containers::Pointer boldShaper = boldFont->createShaper(); DOXYGEN_ELLIPSIS()