Browse Source

doc: work around linker warnings about main() being duplicated.

pull/638/head
Vladimír Vondruš 2 years ago
parent
commit
285b05438c
  1. 13
      doc/snippets/Magnum-application.cpp
  2. 7
      doc/snippets/Magnum.cpp
  3. 7
      doc/snippets/MagnumAnimation.cpp
  4. 7
      doc/snippets/MagnumAudio-scenegraph.cpp
  5. 7
      doc/snippets/MagnumAudio.cpp
  6. 6
      doc/snippets/MagnumDebugTools-gl.cpp
  7. 6
      doc/snippets/MagnumDebugTools.cpp
  8. 13
      doc/snippets/MagnumGL-application.cpp
  9. 7
      doc/snippets/MagnumGL.cpp
  10. 6
      doc/snippets/MagnumMaterialTools.cpp
  11. 6
      doc/snippets/MagnumMath-cpp14.cpp
  12. 6
      doc/snippets/MagnumMath-stl.cpp
  13. 6
      doc/snippets/MagnumMath.cpp
  14. 6
      doc/snippets/MagnumMathAlgorithms.cpp
  15. 7
      doc/snippets/MagnumMeshTools-gl.cpp
  16. 7
      doc/snippets/MagnumMeshTools-stl.cpp
  17. 7
      doc/snippets/MagnumMeshTools.cpp
  18. 2
      doc/snippets/MagnumPlatform-custom.cpp
  19. 2
      doc/snippets/MagnumPlatform-portability.cpp
  20. 2
      doc/snippets/MagnumPlatform-windowless-custom.cpp
  21. 2
      doc/snippets/MagnumPlatform-windowless-thread.cpp
  22. 2
      doc/snippets/MagnumPlatform-windowless.cpp
  23. 2
      doc/snippets/MagnumPlatform.cpp
  24. 6
      doc/snippets/MagnumPrimitives.cpp
  25. 8
      doc/snippets/MagnumSceneGraph-gl.cpp
  26. 6
      doc/snippets/MagnumSceneGraph.cpp
  27. 6
      doc/snippets/MagnumSceneTools.cpp
  28. 6
      doc/snippets/MagnumShaderTools.cpp
  29. 7
      doc/snippets/MagnumShaders-gl.cpp
  30. 7
      doc/snippets/MagnumText-gl.cpp
  31. 7
      doc/snippets/MagnumText.cpp
  32. 6
      doc/snippets/MagnumTextureTools.cpp
  33. 7
      doc/snippets/MagnumTrade.cpp
  34. 7
      doc/snippets/MagnumVk.cpp
  35. 6
      doc/snippets/platforms-html5.cpp
  36. 7
      doc/snippets/plugins.cpp

13
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() {}

7
doc/snippets/Magnum.cpp

@ -68,8 +68,11 @@ class MeshResourceLoader: public AbstractResourceLoader<GL::Mesh> {
}
#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;

7
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{};
{

7
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<SceneGraph::MatrixTransformation3D> Object3D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;

7
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<Audio::Extensions::ALC::SOFTX::HRTF>()) {

6
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<SceneGraph::MatrixTransformation3D>* object{};
/* [debug-tools-renderers] */

6
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;

13
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 */
}

7
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, {}};

6
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,

6
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};

6
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 */

6
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

6
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<Float> data(100000000, 1.0f);

7
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] */

7
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] */

7
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

2
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 ...

2
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 */

2
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{{}};

2
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{{}};

2
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 */

2
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 {

6
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] */

8
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 */
}

6
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;

6
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, {}});

6
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<ShaderTools::AbstractConverter> manager;

7
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

7
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<Text::AbstractFont> manager;

7
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<Text::AbstractFont> manager;
Containers::Pointer<Text::AbstractFont> font =

6
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<const ImageView2D> images = DOXYGEN_ELLIPSIS({});

7
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] */

7
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()};

6
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

7
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<Trade::AbstractImporter> manager;

Loading…
Cancel
Save