From 285b05438c07e0fb16ac139707a0f612031cda8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 5 Mar 2024 12:20:00 +0100 Subject: [PATCH] doc: work around linker warnings about main() being duplicated. --- doc/snippets/Magnum-application.cpp | 13 +++++++++++-- doc/snippets/Magnum.cpp | 7 +++++-- doc/snippets/MagnumAnimation.cpp | 7 +++++-- doc/snippets/MagnumAudio-scenegraph.cpp | 7 +++++-- doc/snippets/MagnumAudio.cpp | 7 +++++-- doc/snippets/MagnumDebugTools-gl.cpp | 6 +++++- doc/snippets/MagnumDebugTools.cpp | 6 +++++- doc/snippets/MagnumGL-application.cpp | 13 +++++++++---- doc/snippets/MagnumGL.cpp | 7 +++++-- doc/snippets/MagnumMaterialTools.cpp | 6 +++++- doc/snippets/MagnumMath-cpp14.cpp | 6 +++++- doc/snippets/MagnumMath-stl.cpp | 6 +++++- doc/snippets/MagnumMath.cpp | 6 +++++- doc/snippets/MagnumMathAlgorithms.cpp | 6 +++++- doc/snippets/MagnumMeshTools-gl.cpp | 7 +++++-- doc/snippets/MagnumMeshTools-stl.cpp | 7 +++++-- doc/snippets/MagnumMeshTools.cpp | 7 +++++-- doc/snippets/MagnumPlatform-custom.cpp | 2 ++ doc/snippets/MagnumPlatform-portability.cpp | 2 ++ doc/snippets/MagnumPlatform-windowless-custom.cpp | 2 ++ doc/snippets/MagnumPlatform-windowless-thread.cpp | 2 ++ doc/snippets/MagnumPlatform-windowless.cpp | 2 ++ doc/snippets/MagnumPlatform.cpp | 2 ++ doc/snippets/MagnumPrimitives.cpp | 6 +++++- doc/snippets/MagnumSceneGraph-gl.cpp | 8 +++++--- doc/snippets/MagnumSceneGraph.cpp | 6 +++++- doc/snippets/MagnumSceneTools.cpp | 6 +++++- doc/snippets/MagnumShaderTools.cpp | 6 +++++- doc/snippets/MagnumShaders-gl.cpp | 7 +++++-- doc/snippets/MagnumText-gl.cpp | 7 +++++-- doc/snippets/MagnumText.cpp | 7 +++++-- doc/snippets/MagnumTextureTools.cpp | 6 +++++- doc/snippets/MagnumTrade.cpp | 7 +++++-- doc/snippets/MagnumVk.cpp | 7 +++++-- doc/snippets/platforms-html5.cpp | 6 +++++- doc/snippets/plugins.cpp | 7 +++++-- 36 files changed, 172 insertions(+), 50 deletions(-) diff --git a/doc/snippets/Magnum-application.cpp b/doc/snippets/Magnum-application.cpp index 675199be0..47275f17a 100644 --- a/doc/snippets/Magnum-application.cpp +++ b/doc/snippets/Magnum-application.cpp @@ -31,6 +31,10 @@ using namespace Magnum; #define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ #define DOXYGEN_IGNORE(...) __VA_ARGS__ +/* Wrapping in a namespace to not conflict with MyApplication defined in + Platform.cpp */ +namespace A { + class MyApplication: public Platform::Application { public: explicit MyApplication(const Arguments& arguments); @@ -67,6 +71,11 @@ void MyApplication::drawEvent() { } /* [Timeline-usage] */ -int main() { - return 0; /* on iOS SDL redefines main to SDL_main and then return is needed */ } + +/* To prevent macOS ranlib from complaining that there are no symbols. OTOH + also make sure the name doesn't conflict with any other snippets to avoid + linker warnings, AND unlike with `int main()` there now has to be a + declaration to avoid -Wmisssing-prototypes */ +void mainMagnum(); +void mainMagnum() {} diff --git a/doc/snippets/Magnum.cpp b/doc/snippets/Magnum.cpp index b63474d70..1b59404db 100644 --- a/doc/snippets/Magnum.cpp +++ b/doc/snippets/Magnum.cpp @@ -68,8 +68,11 @@ class MeshResourceLoader: public AbstractResourceLoader { } #endif -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMagnum(); +void mainMagnum() { { /* [features-using-namespace] */ using namespace Corrade; diff --git a/doc/snippets/MagnumAnimation.cpp b/doc/snippets/MagnumAnimation.cpp index fcfc2067c..c3af4e5a0 100644 --- a/doc/snippets/MagnumAnimation.cpp +++ b/doc/snippets/MagnumAnimation.cpp @@ -38,8 +38,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainAnimation(); +void mainAnimation() { { Float t{}; { diff --git a/doc/snippets/MagnumAudio-scenegraph.cpp b/doc/snippets/MagnumAudio-scenegraph.cpp index 251589992..517b03080 100644 --- a/doc/snippets/MagnumAudio-scenegraph.cpp +++ b/doc/snippets/MagnumAudio-scenegraph.cpp @@ -36,8 +36,11 @@ using namespace Magnum; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainAudioSceneGraph(); +void mainAudioSceneGraph() { { typedef SceneGraph::Object Object3D; typedef SceneGraph::Scene Scene3D; diff --git a/doc/snippets/MagnumAudio.cpp b/doc/snippets/MagnumAudio.cpp index c88698b78..2adc76259 100644 --- a/doc/snippets/MagnumAudio.cpp +++ b/doc/snippets/MagnumAudio.cpp @@ -55,8 +55,11 @@ CORRADE_PLUGIN_REGISTER(MyAudioImporter, MyNamespace::MyAudioImporter, MAGNUM_AUDIO_ABSTRACTIMPORTER_PLUGIN_INTERFACE) /* [MAGNUM_AUDIO_ABSTRACTIMPORTER_PLUGIN_INTERFACE] */ -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainAudio(); +void mainAudio() { { /* [Context-isExtensionSupported] */ if(Audio::Context::current().isExtensionSupported()) { diff --git a/doc/snippets/MagnumDebugTools-gl.cpp b/doc/snippets/MagnumDebugTools-gl.cpp index 3bb60fd5e..a82b14213 100644 --- a/doc/snippets/MagnumDebugTools-gl.cpp +++ b/doc/snippets/MagnumDebugTools-gl.cpp @@ -56,7 +56,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainDebugTools(); +void mainDebugTools() { { SceneGraph::Object* object{}; /* [debug-tools-renderers] */ diff --git a/doc/snippets/MagnumDebugTools.cpp b/doc/snippets/MagnumDebugTools.cpp index dd71603d3..07358cce8 100644 --- a/doc/snippets/MagnumDebugTools.cpp +++ b/doc/snippets/MagnumDebugTools.cpp @@ -139,7 +139,11 @@ void MyApp::drawEventAgain() { } /* [FrameProfiler-usage-console] */ -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainDebugTools(); +void mainDebugTools() { { /* [FrameProfiler-setup-immediate] */ using std::chrono::high_resolution_clock; diff --git a/doc/snippets/MagnumGL-application.cpp b/doc/snippets/MagnumGL-application.cpp index a007b658c..03e87458c 100644 --- a/doc/snippets/MagnumGL-application.cpp +++ b/doc/snippets/MagnumGL-application.cpp @@ -35,6 +35,9 @@ using namespace Magnum; #define DOXYGEN_ELLIPSIS(...) __VA_ARGS__ +/* Namespace used to avoid a conflict with MyApplication defined in + MagnumPlatform.cpp where it *has to* be in the root namespace */ +namespace C { /* [opengl-wrapping-nocreate] */ class MyApplication: public Platform::Application { DOXYGEN_ELLIPSIS(explicit MyApplication(const Arguments& arguments);) @@ -57,6 +60,7 @@ MyApplication::MyApplication(const Arguments& arguments): _shader = Shaders::PhongGL{}; } /* [opengl-wrapping-nocreate] */ +} struct A: Platform::Sdl2Application { /* [DefaultFramebuffer-usage-viewport] */ @@ -99,8 +103,11 @@ void drawEvent() override { /* [Framebuffer-usage-draw] */ }; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainGLApplication(); +void mainGLApplication() { { SDL_Window* _window{}; SDL_GLContext* _otherGLContext{}; @@ -123,6 +130,4 @@ Platform::GLContext::makeCurrent(&other); GL::Buffer b; // implicitly tied to `other` /* [Context-makeCurrent] */ } - -return 0; /* on iOS SDL redefines main to SDL_main and then return is needed */ } diff --git a/doc/snippets/MagnumGL.cpp b/doc/snippets/MagnumGL.cpp index e7555e98d..54c422319 100644 --- a/doc/snippets/MagnumGL.cpp +++ b/doc/snippets/MagnumGL.cpp @@ -285,8 +285,11 @@ MyShader::MyShader(DOXYGEN_ELLIPSIS(int a)): MyShader{compile(DOXYGEN_ELLIPSIS(a } #endif -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainGL(); +void mainGL() { #ifndef MAGNUM_TARGET_GLES2 { ImageView2D diffuse{PixelFormat::RGBA8Unorm, {}}; diff --git a/doc/snippets/MagnumMaterialTools.cpp b/doc/snippets/MagnumMaterialTools.cpp index fd77ede59..6e61bc256 100644 --- a/doc/snippets/MagnumMaterialTools.cpp +++ b/doc/snippets/MagnumMaterialTools.cpp @@ -37,7 +37,11 @@ using namespace Magnum; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMaterialTools(); +void mainMaterialTools() { { /* -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, diff --git a/doc/snippets/MagnumMath-cpp14.cpp b/doc/snippets/MagnumMath-cpp14.cpp index b78d03004..38c28ab16 100644 --- a/doc/snippets/MagnumMath-cpp14.cpp +++ b/doc/snippets/MagnumMath-cpp14.cpp @@ -28,7 +28,11 @@ using namespace Magnum; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMathCpp14(); +void mainMathCpp14() { { /* [BitVector-indexing] */ BitVector4 a{0b0010}; diff --git a/doc/snippets/MagnumMath-stl.cpp b/doc/snippets/MagnumMath-stl.cpp index 46d07af36..03668ad61 100644 --- a/doc/snippets/MagnumMath-stl.cpp +++ b/doc/snippets/MagnumMath-stl.cpp @@ -38,7 +38,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMathStl(); +void mainMathStl() { { Nanoseconds previousFrameTime; /* The (void) is to avoid -Wvexing-parse */ diff --git a/doc/snippets/MagnumMath.cpp b/doc/snippets/MagnumMath.cpp index ed0b61d33..7a07eb991 100644 --- a/doc/snippets/MagnumMath.cpp +++ b/doc/snippets/MagnumMath.cpp @@ -44,7 +44,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMath(); +void mainMath() { { /* [matrix-vector-construct] */ Matrix2x3 a; // zero-filled diff --git a/doc/snippets/MagnumMathAlgorithms.cpp b/doc/snippets/MagnumMathAlgorithms.cpp index d47e1c2df..f51f0f296 100644 --- a/doc/snippets/MagnumMathAlgorithms.cpp +++ b/doc/snippets/MagnumMathAlgorithms.cpp @@ -35,7 +35,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMathAlgorithms(); +void mainMathAlgorithms() { { /* [kahanSum] */ std::vector data(100000000, 1.0f); diff --git a/doc/snippets/MagnumMeshTools-gl.cpp b/doc/snippets/MagnumMeshTools-gl.cpp index 384df0076..4c4d19210 100644 --- a/doc/snippets/MagnumMeshTools-gl.cpp +++ b/doc/snippets/MagnumMeshTools-gl.cpp @@ -44,8 +44,11 @@ using namespace Magnum; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMeshToolsGL(); +void mainMeshToolsGL() { { Trade::MeshData meshData{MeshPrimitive::Lines, 5}; /* [compile-external] */ diff --git a/doc/snippets/MagnumMeshTools-stl.cpp b/doc/snippets/MagnumMeshTools-stl.cpp index f97528cd7..6f1332262 100644 --- a/doc/snippets/MagnumMeshTools-stl.cpp +++ b/doc/snippets/MagnumMeshTools-stl.cpp @@ -32,8 +32,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMeshToolsStl(); +void mainMeshToolsStl() { { /* THe include below is okay as the header guards make it empty */ /* [generateFlatNormalsInto] */ diff --git a/doc/snippets/MagnumMeshTools.cpp b/doc/snippets/MagnumMeshTools.cpp index 5388953e4..ef26394c5 100644 --- a/doc/snippets/MagnumMeshTools.cpp +++ b/doc/snippets/MagnumMeshTools.cpp @@ -47,8 +47,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainMeshTools(); +void mainMeshTools() { #ifdef MAGNUM_BUILD_DEPRECATED { CORRADE_IGNORE_DEPRECATED_PUSH diff --git a/doc/snippets/MagnumPlatform-custom.cpp b/doc/snippets/MagnumPlatform-custom.cpp index 9d9765b6e..03c91535c 100644 --- a/doc/snippets/MagnumPlatform-custom.cpp +++ b/doc/snippets/MagnumPlatform-custom.cpp @@ -27,6 +27,8 @@ using namespace Magnum; +/* In this case `int main()` won't conflict with any other snippets as the + source is compiled into a standalone static library */ /* [custom] */ int main() { // Create OpenGL context ... diff --git a/doc/snippets/MagnumPlatform-portability.cpp b/doc/snippets/MagnumPlatform-portability.cpp index a5ad8fc42..daefa649d 100644 --- a/doc/snippets/MagnumPlatform-portability.cpp +++ b/doc/snippets/MagnumPlatform-portability.cpp @@ -47,3 +47,5 @@ class MyApplication: public Platform::Application { MAGNUM_APPLICATION_MAIN(MyApplication) /* [application] */ +/* In this case `int main()` won't conflict with any other snippets as the + source is compiled into a standalone static library */ diff --git a/doc/snippets/MagnumPlatform-windowless-custom.cpp b/doc/snippets/MagnumPlatform-windowless-custom.cpp index 96e903746..1a7e4a54d 100644 --- a/doc/snippets/MagnumPlatform-windowless-custom.cpp +++ b/doc/snippets/MagnumPlatform-windowless-custom.cpp @@ -32,6 +32,8 @@ EGLDisplay display{}; EGLSurface surface{}; EGLContext anotherContext{}; +/* In this case `int main()` won't conflict with any other snippets as the + source is compiled into a standalone static library */ /* [custom] */ int main(int argc, char** argv) { Platform::WindowlessGLContext glContext{{}}; diff --git a/doc/snippets/MagnumPlatform-windowless-thread.cpp b/doc/snippets/MagnumPlatform-windowless-thread.cpp index 6e4460b35..2c1ffb17d 100644 --- a/doc/snippets/MagnumPlatform-windowless-thread.cpp +++ b/doc/snippets/MagnumPlatform-windowless-thread.cpp @@ -29,6 +29,8 @@ using namespace Magnum; +/* In this case `int main()` won't conflict with any other snippets as the + source is compiled into a standalone static library */ /* [thread] */ int main() { Platform::WindowlessGLContext glContext{{}}; diff --git a/doc/snippets/MagnumPlatform-windowless.cpp b/doc/snippets/MagnumPlatform-windowless.cpp index ecb4c5207..332c79aed 100644 --- a/doc/snippets/MagnumPlatform-windowless.cpp +++ b/doc/snippets/MagnumPlatform-windowless.cpp @@ -51,3 +51,5 @@ int MyApplication::exec() { /* main() function implementation */ MAGNUM_WINDOWLESSAPPLICATION_MAIN(MyApplication) /* [windowless] */ +/* In this case `int main()` won't conflict with any other snippets as the + source is compiled into a standalone static library */ diff --git a/doc/snippets/MagnumPlatform.cpp b/doc/snippets/MagnumPlatform.cpp index 168391fb0..300d8e12d 100644 --- a/doc/snippets/MagnumPlatform.cpp +++ b/doc/snippets/MagnumPlatform.cpp @@ -61,6 +61,8 @@ void MyApplication::drawEvent() { /* main() function implementation */ MAGNUM_APPLICATION_MAIN(MyApplication) /* [windowed] */ +/* In this case `int main()` can't be avoided, but other snippets compiled into + the same static library all use a different name so it shouldn't conflict */ namespace B { diff --git a/doc/snippets/MagnumPrimitives.cpp b/doc/snippets/MagnumPrimitives.cpp index 0a858b1d5..9a8fcc8ae 100644 --- a/doc/snippets/MagnumPrimitives.cpp +++ b/doc/snippets/MagnumPrimitives.cpp @@ -30,7 +30,11 @@ using namespace Magnum; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainPrimitives(); +void mainPrimitives() { { Color4 colorLeft, colorRight, colorBottom, colorTop; /* [gradient2DHorizontal] */ diff --git a/doc/snippets/MagnumSceneGraph-gl.cpp b/doc/snippets/MagnumSceneGraph-gl.cpp index dd643057d..481f22111 100644 --- a/doc/snippets/MagnumSceneGraph-gl.cpp +++ b/doc/snippets/MagnumSceneGraph-gl.cpp @@ -215,7 +215,11 @@ void MyApplication::drawEvent() { } -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainSceneGraphGL(); +void mainSceneGraphGL() { /* [Drawable-usage-instance] */ Scene3D scene; SceneGraph::DrawableGroup3D drawables; @@ -234,6 +238,4 @@ new RedCubeDrawable{*redCube, &drawables}; ->translate(Vector3::yAxis(-0.3f)) .rotateX(30.0_degf); /* [Drawable-usage-instance-multiple-inheritance] */ - -return 0; /* on iOS SDL redefines main to SDL_main and then return is needed */ } diff --git a/doc/snippets/MagnumSceneGraph.cpp b/doc/snippets/MagnumSceneGraph.cpp index 16bcf1883..76a6b5c0d 100644 --- a/doc/snippets/MagnumSceneGraph.cpp +++ b/doc/snippets/MagnumSceneGraph.cpp @@ -163,7 +163,11 @@ class TransformingFeature: public SceneGraph::AbstractFeature3D { } -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainSceneGraph(); +void mainSceneGraph() { { /* [method-chaining] */ Scene3D scene; diff --git a/doc/snippets/MagnumSceneTools.cpp b/doc/snippets/MagnumSceneTools.cpp index e0c84c16a..76d9a1a76 100644 --- a/doc/snippets/MagnumSceneTools.cpp +++ b/doc/snippets/MagnumSceneTools.cpp @@ -43,7 +43,11 @@ using namespace Magnum; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainSceneTools(); +void mainSceneTools() { { /* [filterFieldEntries-shared-mapping] */ Trade::SceneData scene = DOXYGEN_ELLIPSIS(Trade::SceneData{{}, 0, nullptr, {}}); diff --git a/doc/snippets/MagnumShaderTools.cpp b/doc/snippets/MagnumShaderTools.cpp index 248593bc1..177220f78 100644 --- a/doc/snippets/MagnumShaderTools.cpp +++ b/doc/snippets/MagnumShaderTools.cpp @@ -62,7 +62,11 @@ CORRADE_PLUGIN_REGISTER(MyShaderConverter, MyNamespace::MyShaderConverter, MAGNUM_SHADERTOOLS_ABSTRACTCONVERTER_PLUGIN_INTERFACE) /* [MAGNUM_SHADERTOOLS_ABSTRACTCONVERTER_PLUGIN_INTERFACE] */ -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainShaderTools(); +void mainShaderTools() { { /* [AbstractConverter-usage-validation] */ PluginManager::Manager manager; diff --git a/doc/snippets/MagnumShaders-gl.cpp b/doc/snippets/MagnumShaders-gl.cpp index ddceee3c7..7f1d4c6a9 100644 --- a/doc/snippets/MagnumShaders-gl.cpp +++ b/doc/snippets/MagnumShaders-gl.cpp @@ -82,8 +82,11 @@ using namespace Magnum; using namespace Magnum::Math::Literals; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainShadersGL(); +void mainShadersGL() { /* internal compiler error: in gimplify_init_constructor, at gimplify.c:4271 on GCC 4.8 in the [60] array */ #if !defined(CORRADE_TARGET_GCC) || defined(CORRADE_TARGET_CLANG) || __GNUC__ >= 5 diff --git a/doc/snippets/MagnumText-gl.cpp b/doc/snippets/MagnumText-gl.cpp index 8236367a9..a78b2f705 100644 --- a/doc/snippets/MagnumText-gl.cpp +++ b/doc/snippets/MagnumText-gl.cpp @@ -45,8 +45,11 @@ namespace { Vector2 dpiScaling() { return {}; } } -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainTextGL(); +void mainTextGL() { { /* [AbstractFont-usage] */ PluginManager::Manager manager; diff --git a/doc/snippets/MagnumText.cpp b/doc/snippets/MagnumText.cpp index 9435bb56f..f4e820005 100644 --- a/doc/snippets/MagnumText.cpp +++ b/doc/snippets/MagnumText.cpp @@ -92,8 +92,11 @@ CORRADE_PLUGIN_REGISTER(MyFontConverter, MyNamespace::MyFontConverter, MAGNUM_TEXT_ABSTRACTFONTCONVERTER_PLUGIN_INTERFACE) /* [MAGNUM_TEXT_ABSTRACTFONTCONVERTER_PLUGIN_INTERFACE] */ -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainText(); +void mainText() { { PluginManager::Manager manager; Containers::Pointer font = diff --git a/doc/snippets/MagnumTextureTools.cpp b/doc/snippets/MagnumTextureTools.cpp index 7e64af428..cc606ff2b 100644 --- a/doc/snippets/MagnumTextureTools.cpp +++ b/doc/snippets/MagnumTextureTools.cpp @@ -44,7 +44,11 @@ using namespace Magnum; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainTextureTools(); +void mainTextureTools() { { /* [AtlasLandfill-usage] */ Containers::ArrayView images = DOXYGEN_ELLIPSIS({}); diff --git a/doc/snippets/MagnumTrade.cpp b/doc/snippets/MagnumTrade.cpp index e2ee10b6b..e7e1de286 100644 --- a/doc/snippets/MagnumTrade.cpp +++ b/doc/snippets/MagnumTrade.cpp @@ -130,8 +130,11 @@ CORRADE_PLUGIN_REGISTER(MySceneConverter, MyNamespace::MySceneConverter, MAGNUM_TRADE_ABSTRACTSCENECONVERTER_PLUGIN_INTERFACE) /* [MAGNUM_TRADE_ABSTRACTSCENECONVERTER_PLUGIN_INTERFACE] */ -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainTrade(); +void mainTrade() { { Vector2i size; /* [AbstractImageConverter-usage-file] */ diff --git a/doc/snippets/MagnumVk.cpp b/doc/snippets/MagnumVk.cpp index 58e6e5779..8540f6758 100644 --- a/doc/snippets/MagnumVk.cpp +++ b/doc/snippets/MagnumVk.cpp @@ -124,8 +124,11 @@ MyApplication::MyApplication(DOXYGEN_ELLIPSIS(Vk::Instance& instance)) { } -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainVk(); +void mainVk() { { /* [wrapping-extending-create-info] */ Vk::InstanceCreateInfo info{DOXYGEN_ELLIPSIS()}; diff --git a/doc/snippets/platforms-html5.cpp b/doc/snippets/platforms-html5.cpp index 9dcb24955..4b0820faf 100644 --- a/doc/snippets/platforms-html5.cpp +++ b/doc/snippets/platforms-html5.cpp @@ -28,7 +28,11 @@ using namespace Corrade; -int main() { +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainPlatformsHtml5(); +void mainPlatformsHtml5() { { /* [emasm-dollar] */ #pragma GCC diagnostic push diff --git a/doc/snippets/plugins.cpp b/doc/snippets/plugins.cpp index f831595b5..66d6fa967 100644 --- a/doc/snippets/plugins.cpp +++ b/doc/snippets/plugins.cpp @@ -45,8 +45,11 @@ using namespace Magnum; -int main() { - +/* Make sure the name doesn't conflict with any other snippets to avoid linker + warnings, unlike with `int main()` there now has to be a declaration to + avoid -Wmisssing-prototypes */ +void mainPlugins(); +void mainPlugins() { /* [loading] */ { PluginManager::Manager manager;