From bd149b909feb037a09f9c23c0c55f4f8df61e74c Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 16:37:38 +0100 Subject: [PATCH 01/10] Remove unused virtual modifiers in ShadowManager /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:100:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall] setupShadowSettings(); ^ /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:100:9: note: This constructor of an object of type 'ShadowManager' has not returned when the virtual method was called /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:100:9: note: Call to virtual function during construction /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall] enableOutdoorMode(); ^ /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: note: This constructor of an object of type 'ShadowManager' has not returned when the virtual method was called /home/elsid/dev/openmw/components/sceneutil/shadow.cpp:104:9: note: Call to virtual function during construction --- components/sceneutil/shadow.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/sceneutil/shadow.hpp b/components/sceneutil/shadow.hpp index 928de4543..c823ecf86 100644 --- a/components/sceneutil/shadow.hpp +++ b/components/sceneutil/shadow.hpp @@ -19,15 +19,13 @@ namespace SceneUtil ShadowManager(osg::ref_ptr sceneRoot, osg::ref_ptr rootNode, unsigned int outdoorShadowCastingMask, unsigned int indoorShadowCastingMask, Shader::ShaderManager &shaderManager); - virtual ~ShadowManager() = default; + void setupShadowSettings(); - virtual void setupShadowSettings(); + Shader::ShaderManager::DefineMap getShadowDefines(); - virtual Shader::ShaderManager::DefineMap getShadowDefines(); + void enableIndoorMode(); - virtual void enableIndoorMode(); - - virtual void enableOutdoorMode(); + void enableOutdoorMode(); protected: bool mEnableShadows; From 2e1d8a5e5593b5174b0ccf7959f4397a708990e3 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 16:49:03 +0100 Subject: [PATCH 02/10] Remove unused virtual modifiers in DebugHUD /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall] addAnotherShadowMap(); ^ /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is true. Entering loop body for (int i = 0; i < 2; ++i) ^ /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is true. Entering loop body /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3094:5: note: Loop condition is false. Execution continues on line 3102 /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3126:21: note: Assuming 'i' is < 'numberOfShadowMapsPerLight' for (int i = 0; i < numberOfShadowMapsPerLight; ++i) ^ /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3126:5: note: Loop condition is true. Entering loop body for (int i = 0; i < numberOfShadowMapsPerLight; ++i) ^ /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: note: This constructor of an object of type 'DebugHUD' has not returned when the virtual method was called addAnotherShadowMap(); ^ /home/elsid/dev/openmw/components/sceneutil/mwshadowtechnique.cpp:3127:9: note: Call to virtual function during construction --- components/sceneutil/mwshadowtechnique.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/sceneutil/mwshadowtechnique.hpp b/components/sceneutil/mwshadowtechnique.hpp index 1aa25585f..165613f3c 100644 --- a/components/sceneutil/mwshadowtechnique.hpp +++ b/components/sceneutil/mwshadowtechnique.hpp @@ -261,18 +261,18 @@ namespace SceneUtil { float _shadowFadeStart = 0.0; - class DebugHUD : public osg::Referenced + class DebugHUD final : public osg::Referenced { public: DebugHUD(int numberOfShadowMapsPerLight); - virtual void draw(osg::ref_ptr texture, unsigned int shadowMapNumber, const osg::Matrixd &matrix, osgUtil::CullVisitor& cv); + void draw(osg::ref_ptr texture, unsigned int shadowMapNumber, const osg::Matrixd &matrix, osgUtil::CullVisitor& cv); - virtual void releaseGLObjects(osg::State* state = 0) const; + void releaseGLObjects(osg::State* state = 0) const; - virtual void setFrustumVertices(osg::ref_ptr vertices, unsigned int traversalNumber); + void setFrustumVertices(osg::ref_ptr vertices, unsigned int traversalNumber); protected: - virtual void addAnotherShadowMap(); + void addAnotherShadowMap(); static const int sDebugTextureUnit = 0; From 4cd2ff9a3da1a02d4a159dd185a930f1bf7330c0 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 16:53:29 +0100 Subject: [PATCH 03/10] Avoid virtual call in TerrainGrid dtor /home/elsid/dev/openmw/components/terrain/terraingrid.cpp:31:9: warning: Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall] unloadCell(mGrid.begin()->first.first, mGrid.begin()->first.second); ^ /home/elsid/dev/openmw/components/terrain/terraingrid.cpp:29:12: note: Assuming the condition is true while (!mGrid.empty()) ^ /home/elsid/dev/openmw/components/terrain/terraingrid.cpp:29:5: note: Loop condition is true. Entering loop body while (!mGrid.empty()) ^ /home/elsid/dev/openmw/components/terrain/terraingrid.cpp:31:9: note: This destructor of an object of type '~TerrainGrid' has not returned when the virtual method was called unloadCell(mGrid.begin()->first.first, mGrid.begin()->first.second); ^ /home/elsid/dev/openmw/components/terrain/terraingrid.cpp:31:9: note: Call to virtual function during destruction --- components/terrain/terraingrid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/terrain/terraingrid.cpp b/components/terrain/terraingrid.cpp index c91240334..7310846c2 100644 --- a/components/terrain/terraingrid.cpp +++ b/components/terrain/terraingrid.cpp @@ -28,7 +28,7 @@ TerrainGrid::~TerrainGrid() { while (!mGrid.empty()) { - unloadCell(mGrid.begin()->first.first, mGrid.begin()->first.second); + TerrainGrid::unloadCell(mGrid.begin()->first.first, mGrid.begin()->first.second); } } From b07a6afa91ecf85dcaca86bb62d4383b6a06916a Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 17:01:30 +0100 Subject: [PATCH 04/10] Avoid virtual call in GraphicsWindowSDL2 ctor /home/elsid/dev/openmw/components/sdlutil/sdlgraphicswindow.cpp:23:8: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall] if(valid()) ^ /home/elsid/dev/openmw/components/sdlutil/sdlgraphicswindow.cpp:23:8: note: This constructor of an object of type 'GraphicsWindowSDL2' has not returned when the virtual method was called /home/elsid/dev/openmw/components/sdlutil/sdlgraphicswindow.cpp:23:8: note: Call to virtual function during construction --- components/sdlutil/sdlgraphicswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sdlutil/sdlgraphicswindow.cpp b/components/sdlutil/sdlgraphicswindow.cpp index ad8454b25..cd5e80c31 100644 --- a/components/sdlutil/sdlgraphicswindow.cpp +++ b/components/sdlutil/sdlgraphicswindow.cpp @@ -20,7 +20,7 @@ GraphicsWindowSDL2::GraphicsWindowSDL2(osg::GraphicsContext::Traits *traits) _traits = traits; init(); - if(valid()) + if(GraphicsWindowSDL2::valid()) { setState(new osg::State); getState()->setGraphicsContext(this); From cf01df31be22354f98370bd0e5a3b85d333000c7 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 17:02:35 +0100 Subject: [PATCH 05/10] Remove unused variable initialization /home/elsid/dev/openmw/apps/openmw/mwrender/animation.cpp:518:28: warning: Value stored to 'material' during its initialization is never read [clang-analyzer-deadcode.DeadStores] osg::Material* material = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); ^ /home/elsid/dev/openmw/apps/openmw/mwrender/animation.cpp:518:28: note: Value stored to 'material' during its initialization is never read --- apps/openmw/mwrender/animation.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 56c3846af..37a39cdc4 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -515,13 +515,11 @@ namespace MWRender protected: virtual void setDefaults(osg::StateSet* stateset) { - osg::Material* material = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); - osg::BlendFunc* blendfunc (new osg::BlendFunc); stateset->setAttributeAndModes(blendfunc, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); // FIXME: overriding diffuse/ambient/emissive colors - material = new osg::Material; + osg::Material* material = new osg::Material; material->setColorMode(osg::Material::OFF); material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,mAlpha)); material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1)); From b55f5ab64840a3317e0da4aca4549a9ce2f91806 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 17:10:09 +0100 Subject: [PATCH 06/10] Avoid virtual call in WindowManager ctor /home/elsid/dev/openmw/apps/openmw/mwgui/windowmanagerimp.cpp:244:9: warning: Call to virtual function during construction [clang-analyzer-optin.cplusplus.VirtualCall] loadUserFonts(); ^ /home/elsid/dev/openmw/apps/openmw/mwgui/windowmanagerimp.cpp:244:9: note: This constructor of an object of type 'WindowManager' has not returned when the virtual method was called /home/elsid/dev/openmw/apps/openmw/mwgui/windowmanagerimp.cpp:244:9: note: Call to virtual function during construction --- apps/openmw/mwgui/windowmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 02bedee86..0524945fd 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -241,7 +241,7 @@ namespace MWGui MyGUI::FactoryManager::getInstance().registerFactory("Resource", "ResourceImageSetPointer"); MyGUI::FactoryManager::getInstance().registerFactory("Resource", "AutoSizedResourceSkin"); MyGUI::ResourceManager::getInstance().load("core.xml"); - loadUserFonts(); + WindowManager::loadUserFonts(); bool keyboardNav = Settings::Manager::getBool("keyboard navigation", "GUI"); mKeyboardNavigation.reset(new KeyboardNavigation()); From b4794e8ca593de22d9588bef159347df88ef1264 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 17:26:08 +0100 Subject: [PATCH 07/10] Avoid virtual call in OpenAL_Output dtor /home/elsid/dev/openmw/apps/openmw/mwsound/openal_output.cpp:1492:5: warning: Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall] deinit(); ^ /home/elsid/dev/openmw/apps/openmw/mwsound/openal_output.cpp:1492:5: note: This destructor of an object of type '~OpenAL_Output' has not returned when the virtual method was called /home/elsid/dev/openmw/apps/openmw/mwsound/openal_output.cpp:1492:5: note: Call to virtual function during destruction --- apps/openmw/mwsound/openal_output.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 4c41a5b40..9c87cac19 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -1489,7 +1489,7 @@ OpenAL_Output::OpenAL_Output(SoundManager &mgr) OpenAL_Output::~OpenAL_Output() { - deinit(); + OpenAL_Output::deinit(); } } From 8083df4567ae75d05afb65e848936a572fe8bf66 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 18:46:58 +0100 Subject: [PATCH 08/10] Avoid virtual call in Animation dtor --- apps/openmw/mwrender/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 37a39cdc4..3505ea261 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -633,7 +633,7 @@ namespace MWRender Animation::~Animation() { - setLightEffect(0.f); + Animation::setLightEffect(0.f); if (mObjectRoot) mInsert->removeChild(mObjectRoot); From f156c9522e03b1bffed5194a0a59674da92570ab Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 18:49:13 +0100 Subject: [PATCH 09/10] Avoid virtual call in SoundManager dtor --- apps/openmw/mwsound/soundmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index e01df7aa9..5c277d09e 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -1362,7 +1362,7 @@ namespace MWSound void SoundManager::clear() { - stopMusic(); + SoundManager::stopMusic(); for(SoundMap::value_type &snd : mActiveSounds) { From 8d358eeb7d34ccf5b2deaf1ce9e680db4d0e1d1b Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 17 Nov 2019 18:50:42 +0100 Subject: [PATCH 10/10] Avoid virtual call in ParticleSystem ctor --- components/nifosg/particle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/nifosg/particle.cpp b/components/nifosg/particle.cpp index eeb6777ce..16bef0a80 100644 --- a/components/nifosg/particle.cpp +++ b/components/nifosg/particle.cpp @@ -27,7 +27,7 @@ ParticleSystem::ParticleSystem(const ParticleSystem ©, const osg::CopyOp &co { // For some reason the osgParticle constructor doesn't copy the particles for (int i=0;i