From 378de3c8a1ade89c45f6c25002b5c2d6471207e9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 18 Sep 2019 14:36:23 +0200 Subject: [PATCH] fix -Wcatch-value=, fix -Wpedantic --- src/Base/BaseClass.h | 2 +- src/Gui/GestureNavigationStyle.cpp | 2 +- src/Mod/Part/App/Attacher.cpp | 2 +- src/Mod/Part/App/GeometryPyImp.cpp | 18 +++++++++--------- src/Mod/TechDraw/App/GeometryObject.cpp | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Base/BaseClass.h b/src/Base/BaseClass.h index 876e3faa9bac..46899a2b856b 100644 --- a/src/Base/BaseClass.h +++ b/src/Base/BaseClass.h @@ -87,7 +87,7 @@ void _class_::init(void){\ /// define to implement a subclass of Base::BaseClass #define TYPESYSTEM_SOURCE_TEMPLATE_T(_class_, _parentclass_) \ -TYPESYSTEM_SOURCE_TEMPLATE_P(_class_);\ +TYPESYSTEM_SOURCE_TEMPLATE_P(_class_)\ template<> void _class_::init(void){\ initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \ } diff --git a/src/Gui/GestureNavigationStyle.cpp b/src/Gui/GestureNavigationStyle.cpp index 21aa7faec29e..9f4b1143eb47 100644 --- a/src/Gui/GestureNavigationStyle.cpp +++ b/src/Gui/GestureNavigationStyle.cpp @@ -1008,7 +1008,7 @@ void GestureNavigationStyle::onRollGesture(int direction) code << "Gui.runCommand(\"" << cmd << "\")"; try { Base::Interpreter().runString(code.str().c_str()); - } catch (Base::PyException exc) { + } catch (Base::PyException& exc) { exc.ReportException(); } catch (...) { Base::Console().Error("GestureNavigationStyle::onRollGesture: unknown C++ exception when invoking command %s\n", cmd.c_str()); diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index 971761d8b52d..5e732ea759c7 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -2126,7 +2126,7 @@ gp_Pnt AttachEnginePoint::getProximityPoint(eMapMode mmode, const TopoDS_Shape& return points.front(); } } - catch (Standard_Failure) { + catch (const Standard_Failure&) { // ignore } diff --git a/src/Mod/Part/App/GeometryPyImp.cpp b/src/Mod/Part/App/GeometryPyImp.cpp index 55a5bac8c984..65b7f449e217 100644 --- a/src/Mod/Part/App/GeometryPyImp.cpp +++ b/src/Mod/Part/App/GeometryPyImp.cpp @@ -274,11 +274,11 @@ PyObject* GeometryPy::getExtensionOfType(PyObject *args) return cpy; } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } - catch(std::bad_weak_ptr e) { + catch(const std::bad_weak_ptr& e) { PyErr_SetString(PartExceptionOCCError, "Geometry extension does not exist anymore."); return 0; } @@ -308,11 +308,11 @@ PyObject* GeometryPy::getExtensionOfName(PyObject *args) return cpy; } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } - catch(std::bad_weak_ptr e) { + catch(const std::bad_weak_ptr& e) { PyErr_SetString(PartExceptionOCCError, "Geometry extension does not exist anymore."); return 0; } @@ -334,7 +334,7 @@ PyObject* GeometryPy::hasExtensionOfType(PyObject *args) try { return Py::new_reference_to(Py::Boolean(this->getGeometryPtr()->hasExtension(type))); } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } @@ -359,7 +359,7 @@ PyObject* GeometryPy::hasExtensionOfName(PyObject *args) try { return Py::new_reference_to(Py::Boolean(this->getGeometryPtr()->hasExtension(std::string(o)))); } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } @@ -382,7 +382,7 @@ PyObject* GeometryPy::deleteExtensionOfType(PyObject *args) this->getGeometryPtr()->deleteExtension(type); Py_Return; } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } @@ -408,7 +408,7 @@ PyObject* GeometryPy::deleteExtensionOfName(PyObject *args) this->getGeometryPtr()->deleteExtension(std::string(o)); Py_Return; } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } @@ -447,7 +447,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args) return list; } - catch(Base::ValueError e) { + catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); return 0; } diff --git a/src/Mod/TechDraw/App/GeometryObject.cpp b/src/Mod/TechDraw/App/GeometryObject.cpp index 86dd2b40bf18..89ba5f79d92d 100644 --- a/src/Mod/TechDraw/App/GeometryObject.cpp +++ b/src/Mod/TechDraw/App/GeometryObject.cpp @@ -185,7 +185,7 @@ void GeometryObject::projectShape(const TopoDS_Shape& input, brep_hlr->Hide(); } - catch (Standard_Failure e) { + catch (const Standard_Failure& e) { Base::Console().Error("GO::projectShape - OCC error - %s - while projecting shape\n", e.GetMessageString()); } @@ -226,7 +226,7 @@ void GeometryObject::projectShape(const TopoDS_Shape& input, BRepLib::BuildCurves3d(hidOutline); BRepLib::BuildCurves3d(hidIso); } - catch (Standard_Failure e) { + catch (const Standard_Failure& e) { Base::Console().Error("GO::projectShape - OCC error - %s - while extracting edges\n", e.GetMessageString()); } @@ -286,7 +286,7 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input, } brep_hlrPoly->Update(); } - catch (Standard_Failure e) { + catch (const Standard_Failure& e) { Base::Console().Error("GO::projectShapeWithPolygonAlgo - OCC error - %s - while projecting shape\n", e.GetMessageString()); } @@ -318,7 +318,7 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input, BRepLib::BuildCurves3d(hidSeam); BRepLib::BuildCurves3d(hidOutline); } - catch (Standard_Failure e) { + catch (const Standard_Failure& e) { Base::Console().Error("GO::projectShapeWithPolygonAlgo - OCC error - %s - while extracting edges\n", e.GetMessageString()); }