From 2fb13c76f562f19e99c68c79c2055a171d91311e Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 24 Oct 2011 18:09:42 +0100 Subject: [PATCH] Address warnings found via Clang - especially related to destructor visibility with ref_ptrs of various kinds. --- simgear/scene/material/EffectBuilder.cxx | 10 ++++++++++ simgear/scene/material/EffectBuilder.hxx | 3 +++ simgear/scene/tgdb/obj.cxx | 4 ++-- simgear/scene/util/StateAttributeFactory.cxx | 6 ++++++ simgear/scene/util/StateAttributeFactory.hxx | 2 ++ simgear/sound/sample_openal.hxx | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/simgear/scene/material/EffectBuilder.cxx b/simgear/scene/material/EffectBuilder.cxx index 338fc9aa..79ebb248 100644 --- a/simgear/scene/material/EffectBuilder.cxx +++ b/simgear/scene/material/EffectBuilder.cxx @@ -102,4 +102,14 @@ namespace effect { const char* colorFields[] = {"red", "green", "blue", "alpha"}; } + +PassAttributeBuilder::~PassAttributeBuilder() +{ } + +} // of namespace simgear + + + + + diff --git a/simgear/scene/material/EffectBuilder.hxx b/simgear/scene/material/EffectBuilder.hxx index a30efa5e..3165ae18 100644 --- a/simgear/scene/material/EffectBuilder.hxx +++ b/simgear/scene/material/EffectBuilder.hxx @@ -350,8 +350,11 @@ protected: struct PassAttrMapSingleton : public simgear::Singleton { PassAttrMap passAttrMap; + }; public: + virtual ~PassAttributeBuilder(); // anchor into the compilation unit. + virtual void buildAttribute(Effect* effect, Pass* pass, const SGPropertyNode* prop, const SGReaderWriterXMLOptions* options) diff --git a/simgear/scene/tgdb/obj.cxx b/simgear/scene/tgdb/obj.cxx index 36011d72..6e16dc70 100644 --- a/simgear/scene/tgdb/obj.cxx +++ b/simgear/scene/tgdb/obj.cxx @@ -583,7 +583,7 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool { SGBinObject tile; if (!tile.read_bin(path)) - return false; + return NULL; SGVec3d center = tile.get_gbs_center(); SGGeod geodPos = SGGeod::fromCart(center); @@ -604,7 +604,7 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool SGTileGeometryBin tileGeometryBin; if (!tileGeometryBin.insertBinObj(tile, matlib)) - return false; + return NULL; SGVec3f up(0, 0, 1); GroundLightManager* lightManager = GroundLightManager::instance(); diff --git a/simgear/scene/util/StateAttributeFactory.cxx b/simgear/scene/util/StateAttributeFactory.cxx index 25a0a576..3e289ad5 100644 --- a/simgear/scene/util/StateAttributeFactory.cxx +++ b/simgear/scene/util/StateAttributeFactory.cxx @@ -86,4 +86,10 @@ StateAttributeFactory::StateAttributeFactory() _depthWritesDisabled->setDataVariance(Object::STATIC); } +// anchor the destructor into this file, to avoid ref_ptr warnings +StateAttributeFactory::~StateAttributeFactory() +{ + +} + } diff --git a/simgear/scene/util/StateAttributeFactory.hxx b/simgear/scene/util/StateAttributeFactory.hxx index 0076fa51..47603e7b 100644 --- a/simgear/scene/util/StateAttributeFactory.hxx +++ b/simgear/scene/util/StateAttributeFactory.hxx @@ -45,6 +45,8 @@ namespace simgear class StateAttributeFactory : public ReferencedSingleton { public: + ~StateAttributeFactory(); + // Alpha test > .01 osg::AlphaFunc* getStandardAlphaFunc() { return _standardAlphaFunc.get(); } // alpha source, 1 - alpha destination diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index b5267bb1..9e816c21 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -82,7 +82,7 @@ public: /** * Destructor */ - ~SGSoundSample (); + virtual ~SGSoundSample (); /** * Detect wheter this audio sample holds the information of a sound file.