[2.1] tons of warnings with GCC 8.2.1

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Boost113
Kobold
Posts: 35
Joined: Sun Sep 08, 2013 6:39 pm
x 6

[2.1] tons of warnings with GCC 8.2.1

Post by Boost113 »

Ogre Version: 74e79cd52360
Operating System: Linux
Render System: OpenGL3+

When compiling with "gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4)" there is a ton of warnings (some of these even show up when I try to compile my code as they are in the Ogre headers).

I picked each warning just once from my build log:
https://pastebin.com/rDZzmjPx (it was too long to post here directly)

Some of these have been happening for quite a while now and I'm not sure how many of these should be properly fixed.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] tons of warnings with GCC 8.2.1

Post by dark_sylinc »

Hi,

I do wish the build was warning-free. And absolutely the warnings should not happen on headers when included by users.

I can comment a few things to clarify/guide whoever wants to clean it up:

The warnings about HlmsPassPso:
int memcmp(const void*, const void*, size_t)” specified size 18446744073709551592 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
Are right. This is a bug. Fixed.

--------------------------------------------------------------------------------------------------

The majority of the -Wclass-memaccess warnings (all of them?) are false positives. The memsets/memcpys are intentional. GCC assumes because there's a constructor, that the object is not POD. But the constructor just initializes all values to 0 or makes a raw copy on purpose.
In particular the warnings about memcpy in OgreFastArray.h in growToFit are intentional. When we need to migrate the internal buffer, we perform a raw copy. This could indeed break very edge cases (where the iterators hold a pointer to its own internal address; which would be updated via the copy operator during iterator invalidation), but FastArray does not care about these extreme edge cases. If for some reasons this needed, then use std::vector instead.

GCC suggests to use value-initialization/copy-assignment instead of memset/memcpy. However we exactly want to avoid this, because value-initialization/copy-assignment needs to deal with hard edge cases that simply won't happen in our code and end up producing suboptimal code (or requires LTO, if it works, to be on which increases linking time a lot)

--------------------------------------------------------------------------------------------------

The fallthrough warnings for switch statements (-Wimplicit-fallthrough) are there because the code long predates the existence of this warning flag. The warnings can be silenced via a comment:

Code: Select all

switch( value )
{
case 0:
//fallthrough
case 1:
          code();
          break;
}
Or with C++17 "[[fallthrough]]" (we use C++03 in Ogre 2.1)
Most of these fallthrough are intentional, but I wouldn't rule out an accidental error. It's just a lot of switch() statements to analyze...

--------------------------------------------------------------------------------------------------

The -Woverflow bugs need a good look. Looks like code manages to work more by chance than anything else.
For example "size_t shadowMapIdx = 0;" in OgreScriptTranslator.cpp may be as well an uint32 to silence the warning:

Code: Select all

OgreMain/src/OgreScriptTranslator.cpp:7950:99: varoitus: conversion from ”long unsigned int” to ”unsigned int” changes value from ”18446744073709551615” to ”4294967295” [-Woverflow]
                                                                   std::numeric_limits<size_t>::max() );
as parseUnsignedInt is not a size_t.
However it's not that easy because in another path we perform:

Code: Select all

shadowMapIdx = any_cast<size_t>( obj->parent->context );
which means our caller is sending us a size_t object, and thus changing shadowMapIdx type means the caller's code needs to be adjusted as well.

But everything sorts out ok because in the end we perform:

Code: Select all

(*itor)->mShadowMapIdx      = static_cast<uint32>(shadowMapIdx);
TL;DR It's a tangled mess and a miracle it works at all.

--------------------------------------------------------------------------------------------------

The header from OgreMain/include/Math/Array/SSE2/Single/sse_mathfun.h came from a third party and I never bothered to fix the warnings. It "just works".

--------------------------------------------------------------------------------------------------

I do not know why GCC reports this one:

Code: Select all

RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp:1794:34: varoitus: ”minFilter” may be used uninitialized in this function [-Wmaybe-uninitialized]
         OCGE( glSamplerParameteri( samplerName, GL_TEXTURE_MIN_FILTER, minFilter ) );
My best guess is that perhaps it is catching the case where either newBlock->mMinFilter or newBlock->mMipFilter contain invalid integer values (i.e. a value that is not in FilterOptions). But if that's the reason then we don't care (the problem would be WAY bigger if mMinFilter/mMipFilter is invalid)

--------------------------------------------------------------------------------------------------

The -Wignored-attributes is a tough one. For starters we don't care if they're ignored. Second, most of them come from attributes that are NOT ignored by other compilers (e.g. MSVC or Clang, depending the attribute)
Boost113
Kobold
Posts: 35
Joined: Sun Sep 08, 2013 6:39 pm
x 6

Re: [2.1] tons of warnings with GCC 8.2.1

Post by Boost113 »

Unfortunately most of the warnings coming in my project from including Ogre are about the memset calls in OgreHlmsPso.h:

Code: Select all

[ 67%] Building CXX object src/CMakeFiles/ThriveLib.dir/generated/cell_stage_world.cpp.o
In file included from /home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreHardwareVertexBuffer.h:36,
                 from /home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgrePose.h:33,
                 from /home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreAnimationTrack.h:36,
                 from /home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreAnimation.h:34,
                 from /home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreMesh.h:36,
                 from /home/hhyyrylainen/Projects/thrive/src/microbe_stage/compound_cloud_system.h:12,
                 from /home/hhyyrylainen/Projects/thrive/src/microbe_stage/compound_absorber_system.h:6,
                 from /home/hhyyrylainen/Projects/thrive/src/microbe_stage/compound_absorber_system.cpp:1:
/home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreHlmsPso.h: Jäsenfunktio ”void Ogre::HlmsPso::initialize()”:
/home/hhyyrylainen/Projects/thrive/ThirdParty/Leviathan/build/ThirdParty/include/OGRE/OgreHlmsPso.h:206:51: varoitus: ”void* memset(void*, int, size_t)” clearing an object of non-trivial type ”struct Ogre::HlmsPassPso”; use assignment or value-initialization instead [-Wclass-memaccess]
             memset( &pass, 0, sizeof(HlmsPassPso) );
                                                   ^
That is repeated a ton and a few files also report this warning:

Code: Select all

In file included from /home/hhyyrylainen/Projects/Leviathan/Engine/Entities/Systems.cpp:12:
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/include/OGRE/Animation/OgreSkeletonAnimation.h: Globaalilla näkyvyysalueella:
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/include/OGRE/Animation/OgreSkeletonAnimation.h:58:58: varoitus: ignoring attributes on template argument ”Ogre::ArrayReal” {aka ”__vector(4) float”} [-Wignored-attributes]
         RawSimdUniquePtr<ArrayReal, MEMCATEGORY_ANIMATION> mBoneWeights;
                                                          ^
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/include/OGRE/Animation/OgreSkeletonAnimation.h:174:90: varoitus: ignoring attributes on template argument ”Ogre::ArrayReal” {aka ”__vector(4) float”} [-Wignored-attributes]
         void _swapBoneWeightsUniquePtr( RawSimdUniquePtr<ArrayReal, MEMCATEGORY_ANIMATION>
                                                                                          ^
If those were fixed I could read the compiler output for my project much more easily.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] tons of warnings with GCC 8.2.1

Post by dark_sylinc »

It does make sense to disable the warnings and then bring then back up.

After all that's what OgreHeaderPrefix.h and OgreHeaderSuffix.h are for. Though it may make more sense to disable just the warnings in those places, in case more valid warnings pop up.

Btw what's your command line arguments / setup? I'd wish to know why you get way more warnings than I do.
Boost113
Kobold
Posts: 35
Joined: Sun Sep 08, 2013 6:39 pm
x 6

Re: [2.1] tons of warnings with GCC 8.2.1

Post by Boost113 »

I get exactly the same warnings when compiling Ogre compared to my project. I don't think I have any really specific Ogre cmake options enabled:

Code: Select all

-- Cache values
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty
OGRE_ASSERT_MODE:STRING=0
OGRE_BUILD_COMPONENT_HLMS_PBS:BOOL=ON
OGRE_BUILD_COMPONENT_HLMS_PBS_MOBILE:BOOL=ON
OGRE_BUILD_COMPONENT_HLMS_UNLIT:BOOL=ON
OGRE_BUILD_COMPONENT_HLMS_UNLIT_MOBILE:BOOL=ON
OGRE_BUILD_COMPONENT_MESHLODGENERATOR:BOOL=ON
OGRE_BUILD_COMPONENT_OVERLAY:BOOL=OFF
OGRE_BUILD_COMPONENT_PAGING:BOOL=OFF
OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS:BOOL=OFF
OGRE_BUILD_COMPONENT_PROPERTY:BOOL=OFF
OGRE_BUILD_COMPONENT_RTSHADERSYSTEM:BOOL=OFF
OGRE_BUILD_COMPONENT_TERRAIN:BOOL=OFF
OGRE_BUILD_COMPONENT_VOLUME:BOOL=OFF
OGRE_BUILD_PLATFORM_NACL:BOOL=OFF
OGRE_BUILD_PLUGIN_PFX:BOOL=ON
OGRE_BUILD_RENDERSYSTEM_GL3PLUS:BOOL=ON
OGRE_BUILD_RENDERSYSTEM_GLES:BOOL=OFF
OGRE_BUILD_SAMPLES2:BOOL=ON
OGRE_BUILD_TESTS:BOOL=OFF
OGRE_BUILD_TOOLS:BOOL=ON
OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO:BOOL=OFF
OGRE_CONFIG_THREADS:STRING=0
OGRE_CONFIG_THREAD_PROVIDER:STRING=none
OGRE_DEBUG_LEVEL_DEBUG:STRING=3
OGRE_DEBUG_LEVEL_RELEASE:STRING=0
OGRE_DEPENDENCIES_DIR:PATH=
OGRE_IDSTRING_ALWAYS_READABLE:BOOL=OFF
OGRE_INSTALL_DOCS:BOOL=ON
OGRE_INSTALL_SAMPLES:BOOL=ON
OGRE_INSTALL_TOOLS:BOOL=ON
OGRE_LEGACY_ANIMATIONS:BOOL=ON
OGRE_PROFILING_EXHAUSTIVE:BOOL=OFF
OGRE_RESTRICT_ALIASING:BOOL=ON
OGRE_SIMD_NEON:BOOL=ON
OGRE_SIMD_SSE2:BOOL=ON
OGRE_STATIC:BOOL=OFF
OGRE_UNITY_BUILD:BOOL=OFF
OGRE_UNITY_FILES_PER_UNIT:STRING=50
Remotery_LIBRARIES_DBG:FILEPATH=Remotery_LIBRARIES_DBG-NOTFOUND
Remotery_LIBRARIES_REL:FILEPATH=Remotery_LIBRARIES_REL-NOTFOUND
SDL2MAIN_LIBRARY:FILEPATH=SDL2MAIN_LIBRARY-NOTFOUND
SDL2_INCLUDE_DIR:PATH=/usr/include/SDL2
SDL2_LIBRARY:STRING=/usr/lib64/libSDL2.so;-lpthread

and besides that I just compile my project with options like: "-std=c++17 -Wall -Wl,--no-undefined -Wl,--no-allow-shlib-undefined -O2 -g"

I think the warnings started when I updated GCC from 7 to 8. So that's a likely reason why you don't get the same warnings.

There's also some warnings that happen when my project is compiled on windows with visual studio 2017 (I can't take the time to swap over to windows to get the warnings there right now).
Boost113
Kobold
Posts: 35
Joined: Sun Sep 08, 2013 6:39 pm
x 6

Re: [2.1] tons of warnings with GCC 8.2.1

Post by Boost113 »

I finally got around to booting up windows. So here are warnings from Ogre when compiling my project:

Code: Select all

4>c:\projects\thrive\thirdparty\leviathan\engine\networking\networkclientinterface.cpp(430): warning C4065: switch statement contains 'default' but no 'case' labels
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\math\array\sse2\single\ogrearraymatrix4.inl(475): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\math\array\sse2\single\ogrearraymatrixaf4x3.inl(553): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\math\array\sse2\single\ogrearraymatrixaf4x3.inl(607): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\math\array\sse2\single\ogrearraymatrix4.inl(475): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogrememorystlallocator.h(130): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogrememorystlallocator.h(127): note: while compiling class template member function 'Ogre::CompositorPassDef **Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>::allocate(Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>::size_type,std::allocator<void>::const_pointer)'
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\vector(1500): note: see reference to function template instantiation 'Ogre::CompositorPassDef **Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>::allocate(Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>::size_type,std::allocator<void>::const_pointer)' being compiled
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(713): note: see reference to class template instantiation 'Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>' being compiled
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(905): note: see reference to class template instantiation 'std::_Normal_allocator_traits<_Alloc>' being compiled
4>        with
4>        [
4>            _Alloc=Ogre::STLAllocator<Ogre::CompositorPassDef *,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\vector(360): note: see reference to class template instantiation 'std::allocator_traits<_Alloc>' being compiled
4>        with
4>        [
4>            _Alloc=Ogre::STLAllocator<Ogre::CompositorPassDef *,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\vector(360): note: see reference to alias template instantiation 'std::_Rebind_alloc_t<Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>,_Ty>' being compiled
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *,
4>            _Ty=Ogre::CompositorPassDef *
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\vector(405): note: see reference to class template instantiation 'std::_Vec_base_types<_Ty,_Alloc>' being compiled
4>        with
4>        [
4>            _Ty=Ogre::CompositorPassDef *,
4>            _Alloc=Ogre::STLAllocator<Ogre::CompositorPassDef *,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\vector(626): note: see reference to class template instantiation 'std::_Vector_alloc<std::_Vec_base_types<_Ty,_Alloc>>' being compiled
4>        with
4>        [
4>            _Ty=Ogre::CompositorPassDef *,
4>            _Alloc=Ogre::STLAllocator<Ogre::CompositorPassDef *,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogreprerequisites.h(616): note: see reference to class template instantiation 'std::vector<T,A>' being compiled
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *,
4>            A=Ogre::STLAllocator<Ogre::CompositorPassDef *,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\compositor\pass\ogrecompositorpassdef.h(187): note: see reference to class template instantiation 'Ogre::vector<Ogre::CompositorPassDef *,Ogre::STLAllocator<T,Ogre::GeneralAllocPolicy>>' being compiled
4>        with
4>        [
4>            T=Ogre::CompositorPassDef *
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Threading\ThreadingManager.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogrememorystlallocator.h(130): warning C5033: 'register' is no longer a supported storage class (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogrememorystlallocator.h(127): note: while compiling class template member function 'std::_Tree_node<std::pair<const K,V>,void *> *Ogre::STLAllocator<U,AllocPolicy>::allocate(Ogre::STLAllocator<U,AllocPolicy>::size_type,std::allocator<void>::const_pointer)'
4>        with
4>        [
4>            K=size_t,
4>            V=Ogre::GpuLogicalIndexUse,
4>            U=std::_Tree_node<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,void *>,
4>            AllocPolicy=Ogre::GeneralAllocPolicy
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xtree(929): note: see reference to function template instantiation 'std::_Tree_node<std::pair<const K,V>,void *> *Ogre::STLAllocator<U,AllocPolicy>::allocate(Ogre::STLAllocator<U,AllocPolicy>::size_type,std::allocator<void>::const_pointer)' being compiled
4>        with
4>        [
4>            K=size_t,
4>            V=Ogre::GpuLogicalIndexUse,
4>            U=std::_Tree_node<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,void *>,
4>            AllocPolicy=Ogre::GeneralAllocPolicy
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(713): note: see reference to class template instantiation 'Ogre::STLAllocator<U,AllocPolicy>' being compiled
4>        with
4>        [
4>            U=std::_Tree_node<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,void *>,
4>            AllocPolicy=Ogre::GeneralAllocPolicy
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(905): note: see reference to class template instantiation 'std::_Normal_allocator_traits<_Alloc>' being compiled
4>        with
4>        [
4>            _Alloc=Ogre::STLAllocator<std::_Tree_node<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,void *>,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xtree(435): note: see reference to class template instantiation 'std::allocator_traits<Ogre::STLAllocator<U,AllocPolicy>>' being compiled
4>        with
4>        [
4>            U=std::_Tree_node<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,void *>,
4>            AllocPolicy=Ogre::GeneralAllocPolicy
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xtree(762): note: see reference to class template instantiation 'std::_Tree_base_types<std::pair<const K,V>,Ogre::STLAllocator<std::pair<const K,V>,Ogre::GeneralAllocPolicy>>' being compiled
4>        with
4>        [
4>            K=size_t,
4>            V=Ogre::GpuLogicalIndexUse
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xtree(1032): note: see reference to class template instantiation 'std::_Tree_comp_alloc<_Traits>' being compiled
4>        with
4>        [
4>            _Traits=std::_Tmap_traits<size_t,Ogre::GpuLogicalIndexUse,std::less<size_t>,Ogre::STLAllocator<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,Ogre::GeneralAllocPolicy>,false>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\map(82): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>' being compiled
4>        with
4>        [
4>            _Kty=size_t,
4>            _Ty=Ogre::GpuLogicalIndexUse,
4>            _Pr=std::less<size_t>,
4>            _Alloc=Ogre::STLAllocator<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogreprerequisites.h(658): note: see reference to class template instantiation 'std::map<K,V,P,A>' being compiled
4>        with
4>        [
4>            K=size_t,
4>            V=Ogre::GpuLogicalIndexUse,
4>            P=std::less<size_t>,
4>            A=Ogre::STLAllocator<std::pair<const size_t,Ogre::GpuLogicalIndexUse>,Ogre::GeneralAllocPolicy>
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
4>c:\projects\thrive\thirdparty\leviathan\build\thirdparty\include\ogre\ogregpuprogramparams.h(570): note: see reference to class template instantiation 'Ogre::map<size_t,Ogre::GpuLogicalIndexUse,std::less<K>,Ogre::STLAllocator<std::pair<const K,V>,Ogre::GeneralAllocPolicy>>' being compiled
4>        with
4>        [
4>            K=size_t,
4>            V=Ogre::GpuLogicalIndexUse
4>        ] (compiling source file C:\projects\Thrive\ThirdParty\Leviathan\Engine\Editor\Editor.cpp)
I cut out only a small part of all the warnings.

This is using Visual studio 2017 (15.9.4)
User avatar
Ybalrid
Halfling
Posts: 89
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 31
Contact:

Re: [2.1] tons of warnings with GCC 8.2.1

Post by Ybalrid »

It could be interesting - but I don't think there's an easy way - to get cmake to pass some flags to GCC to silence some of the warning we don't care about, like the ones about memset vs "value initialization" for theses HlmsStructures.

I never really looked at the insides of the CMake infrastructure Ogre uses, and it looks like it's a bit of a mess (unsurprisingly, it's old, and cmake was way worse to use few years ago), but that could be a good option to remove these ones when building ogre.

But the more important ones to take care of are the ones generated when a use build a program that consume Ogre's headers. As most of the time (unless you are hacking into Ogre) you are only building the library once (or if you follow one of the developing branch like we are doing when using 2.x, after a "hg pull && hg update" to get the new stuff). I think we should get that ironed out sooner than later.

Of that sort, the main warning that is annoying me (while building the test program of my glTF importer):

Code: Select all

In file included from /usr/local/include/OGRE/OgreInstancedEntity.h:34,
                 from /usr/local/include/OGRE/Ogre.h:63,
                 from /home/ybalrid/Programming/Ogre_glTF/pluginTest/main.cpp:1:
/usr/local/include/OGRE/Animation/OgreSkeletonInstance.h:80:58: warning: ignoring attributes on template argument ‘Ogre::ArrayReal’ {aka ‘__vector(4) float’} [-Wignored-attributes]
         RawSimdUniquePtr<ArrayReal, MEMCATEGORY_ANIMATION> mManualBones;
It also seems that more warnings are generated when Ogre (or an Ogre using app) is built with support for latter C++ standards. (I haven't A/B tested this claim, but feels like it).

I may have some free time on hand, and I'll be happy to try to cleanup some of theses warning, and PR that back to @dark_sylinc. It should be pretty simple, like the fallthrough comments (I've done some the same kind of things in the past)
Ogre_glTF Ogre v2-1 GLTF2 loader : topic link github repo
BtOgre21 Fork of btOgre, for Ogre v2-1 : topic link github repo
OIS Current maintainer : Official repository
Annwvyn VR focused game engine using Ogre : https://github.com/Ybalrid/Annwvyn https://annwvyn.org/
Boost113
Kobold
Posts: 35
Joined: Sun Sep 08, 2013 6:39 pm
x 6

Re: [2.1] tons of warnings with GCC 8.2.1

Post by Boost113 »

I finally got enough and opened a pull request: https://bitbucket.org/sinbad/ogre/pull- ... aders/diff
Post Reply