From: Artem Zhidkov Date: Sun, 17 May 2020 19:09:12 +0000 (+0300) Subject: Get rid of compilation warnings. Part III. Eliminate rest of warnings. X-Git-Tag: V9_5_0b1~2^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=17e64d5bdbe04282322d524e99627a8aa5a70347;p=modules%2Fshaper.git Get rid of compilation warnings. Part III. Eliminate rest of warnings. --- diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index bbba6b2d7..5be23a997 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -20,11 +20,7 @@ #ifndef CONFIG_KEYWORDS_H_ #define CONFIG_KEYWORDS_H_ -#if defined __GNUC__ || defined __clang__ -#define MAYBE_UNUSED __attribute__((unused)) -#else -#define MAYBE_UNUSED -#endif +#include /* * Hardcoded xml entities of plugin-*.xml diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index a88a4024a..af3f1f55e 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -209,7 +209,7 @@ double Config_PropManager::stringToDouble(const std::string& theDouble) // change locale and convert "," to "." if exists std::string aCurLocale = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, "C"); - int dotpos = (int)aStr.find(','); + size_t dotpos = aStr.find(','); if (dotpos != std::string::npos) aStr.replace(dotpos, 1, "."); diff --git a/src/Config/Config_ValidatorMessage.h b/src/Config/Config_ValidatorMessage.h index 85c27726a..5a640c026 100644 --- a/src/Config/Config_ValidatorMessage.h +++ b/src/Config/Config_ValidatorMessage.h @@ -27,7 +27,7 @@ #include /// Event ID that Validator is loaded (comes with Config_ValidatorMessage) -static const char * EVENT_VALIDATOR_LOADED = "ValidatorLoaded"; +MAYBE_UNUSED static const char * EVENT_VALIDATOR_LOADED = "ValidatorLoaded"; /*! * \class Config_ValidatorMessage diff --git a/src/Config/Config_def.h b/src/Config/Config_def.h index 0bd02fccd..60105dbc9 100644 --- a/src/Config/Config_def.h +++ b/src/Config/Config_def.h @@ -34,4 +34,10 @@ #endif #endif +#if defined __GNUC__ || defined __clang__ +#define MAYBE_UNUSED __attribute__((unused)) +#else +#define MAYBE_UNUSED +#endif + #endif //CONFIG_H diff --git a/src/GeomAPI/GeomAPI_Solid.cpp b/src/GeomAPI/GeomAPI_Solid.cpp index 9fb6d44fd..ade9c845c 100644 --- a/src/GeomAPI/GeomAPI_Solid.cpp +++ b/src/GeomAPI/GeomAPI_Solid.cpp @@ -174,7 +174,6 @@ std::shared_ptr GeomAPI_Solid::getCone() const GeomPointPtr anApex; GeomDirPtr anAxis; double aSemiAngle = 0.0; - double aHeight = 0.0; GeomPlanePtr aCaps[2]; @@ -205,7 +204,6 @@ std::shared_ptr GeomAPI_Solid::getCone() const else anAxis = aCurCone->axis(); aSemiAngle = aCurCone->semiAngle(); - aHeight = aCurCone->height(); isCone = true; } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp index cb223a832..ad1850a08 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp @@ -115,8 +115,8 @@ void reorder(Handle(TColgp_HArray1OfPnt)& thePoints) } if (aNearest > 0 && aNearest != i + 1) { // Keep given order of points to use it in case of equidistant candidates - // .-<---<-. - // / \ + // .--<---<--. + // | | // o o o c o->o->o->o->n o o // | | | // i i+1 nearest diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index b83637655..2dd82dbc5 100644 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -109,8 +109,7 @@ void PartSet_OverconstraintListener::getCustomColor(const ObjectPtr& theObject, } } -void PartSet_OverconstraintListener::processEvent( - const std::shared_ptr& theMessage) +void PartSet_OverconstraintListener::processEvent(const std::shared_ptr& theMessage) { // #2271 open document: if sketch has confilcting elements, solver sends message with the // elements by opening the document. Sketch is not active, but an internal container should @@ -145,13 +144,12 @@ void PartSet_OverconstraintListener::processEvent( anEventID == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)) { std::shared_ptr anErrorMsg = std::dynamic_pointer_cast(theMessage); - bool anUpdated = false; if (anErrorMsg.get()) { const std::set& aConflictingObjects = anErrorMsg->objects(); if (anEventID == Events_Loop::eventByName(EVENT_SOLVER_FAILED)) - anUpdated = appendConflictingObjects(aConflictingObjects); + appendConflictingObjects(aConflictingObjects); else - anUpdated = repairConflictingObjects(aConflictingObjects); + repairConflictingObjects(aConflictingObjects); } } else if (anEventID == Events_Loop::eventByName(EVENT_SKETCH_UNDER_CONSTRAINED) || diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 372083418..1384483ae 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -83,6 +83,8 @@ public: PartSet_Fitter(PartSet_SketcherMgr* theSketchMgr): mySketchMgr(theSketchMgr) {} + virtual ~PartSet_Fitter() {} + /// A method which has top be reimplemented to provide alterantive implementation FitAll command /// \param theView - a view which has to be fit virtual void fitAll(Handle(V3d_View) theView); diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 4934187cd..fc615f4d1 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -733,7 +733,6 @@ void PartSet_Tools::sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite if (!theComposite.get()) return; - static Events_Loop* aLoop = Events_Loop::loop(); int aNumberOfSubs = theComposite->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aSubFeature = theComposite->subFeature(i); diff --git a/src/Selector/Selector_Algo.cpp b/src/Selector/Selector_Algo.cpp index a21be5fa5..ef53c7dcb 100644 --- a/src/Selector/Selector_Algo.cpp +++ b/src/Selector/Selector_Algo.cpp @@ -502,13 +502,15 @@ bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& TopoDS_Shape aNextModification = aBaseIter.Shape(); if (aNextModification.IsNull()) continue; - if (isInContext(theContext, aNextModification)) + if (isInContext(theContext, aNextModification)) { // don't add vertices generated from edges if (aNextModification.ShapeType() <= theResult.ShapeType()) aResultShapes.Add(aNextModification); - else if (findNewVersion(theContext, aNextModification)) + } + else if (findNewVersion(theContext, aNextModification)) { if (aNextModification.ShapeType() <= theResult.ShapeType()) aResultShapes.Add(aNextModification); + } } } if (aResultShapes.IsEmpty()) diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 156e12659..d535a6d7f 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -222,11 +222,12 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) bool aIsFree = true; for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result ObjectPtr aReferenced = aCurrent; - if (aKind == 1) + if (aKind == 1) { if (!aCurrent->results().empty()) aReferenced = aCurrent->firstResult(); else break; + } const std::set& aRefs = aReferenced->data()->refsToMe(); std::set::iterator aRIt = aRefs.begin(); for (; aRIt != aRefs.end(); ++aRIt) {