diff --git a/CMakeLists.txt b/CMakeLists.txt index fec9660856..f4dabf7657 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}") # include local modules +include(CheckCXXCompilerFlag) include(AddFileDependencies) include(cMake/FreeCadMacros.cmake) # include helper functions/macros diff --git a/src/3rdParty/salomesmesh/CMakeLists.txt b/src/3rdParty/salomesmesh/CMakeLists.txt index d58d078e4f..f0532e8852 100644 --- a/src/3rdParty/salomesmesh/CMakeLists.txt +++ b/src/3rdParty/salomesmesh/CMakeLists.txt @@ -9,11 +9,22 @@ SET(SMESH_VERSION_TWEAK 0) if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-switch -Wno-unused-variable -Wno-unused-but-set-variable -Wno-comment -Wno-unused-parameter -Wno-empty-body -Wno-pedantic") elseif(CMAKE_COMPILER_IS_CLANGXX) - set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-switch -Wno-unused-variable -Wno-unused-private-field -Wno-unused-function -Wno-sometimes-uninitialized -Wno-overloaded-virtual -Wno-dynamic-class-memaccess -Wno-comment -Wno-unused-parameter -Wno-extra-semi") + set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-self-assign -Wno-sign-compare -Wno-logical-op-parentheses -Wno-reorder -Wno-switch -Wno-switch-enum -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-private-field") + set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-unused-function -Wno-sometimes-uninitialized -Wno-overloaded-virtual -Wno-dynamic-class-memaccess -Wno-comment -Wno-unused-parameter -Wno-extra-semi") endif() if(CMAKE_COMPILER_IS_CLANGXX) - set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-self-assign -Wno-reorder -Wno-switch-enum -Wno-unknown-pragmas -Wno-logical-op-parentheses -Wno-unused-variable -Wno-unused-function -Wno-overloaded-virtual") + unset(_flag_found CACHE) + check_cxx_compiler_flag("-Wno-deprecated-copy" _flag_found) + if (_flag_found) + set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-deprecated-copy") + endif () + + unset(_flag_found CACHE) + check_cxx_compiler_flag("-Wno-missing-field-initializers" _flag_found) + if (_flag_found) + set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers") + endif () endif() if (VTK_OPTIONS) diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp index 4386473fcb..fcd044b00f 100644 --- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp +++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp @@ -4168,7 +4168,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems, // if ( posType != SMDS_TOP_3DSPACE ) // dist2 = pNode.SquareDistance( surface->Value( newUV.X(), newUV.Y() )); // if ( dist2 < dist1 ) - uv = newUV; + uv = newUV; } } // store UV in the map diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index 038562f497..fc4503b977 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -350,23 +350,25 @@ static inline bool definitelyLessThan(T a, T b) static inline int essentiallyInteger(double a, long &l, int &i) { double intpart; - if(std::modf(a,&intpart) == 0.0) { - if(intpart<0.0) { - if(intpart >= INT_MIN) { - i = (int)intpart; + if (std::modf(a,&intpart) == 0.0) { + if (intpart<0.0) { + if (intpart >= INT_MIN) { + i = static_cast(intpart); l = i; return 1; } - if(intpart >= LONG_MIN) { - l = (long)intpart; + if (intpart >= LONG_MIN) { + l = static_cast(intpart); return 2; } - }else if(intpart <= INT_MAX) { - i = (int)intpart; + } + else if (intpart <= INT_MAX) { + i = static_cast(intpart); l = i; return 1; - }else if(intpart <= LONG_MAX) { - l = (int)intpart; + } + else if (intpart <= static_cast(LONG_MAX)) { + l = static_cast(intpart); return 2; } } @@ -375,14 +377,15 @@ static inline int essentiallyInteger(double a, long &l, int &i) { static inline bool essentiallyInteger(double a, long &l) { double intpart; - if(std::modf(a,&intpart) == 0.0) { - if(intpart<0.0) { - if(intpart >= LONG_MIN) { - l = (long)intpart; + if (std::modf(a,&intpart) == 0.0) { + if (intpart<0.0) { + if (intpart >= LONG_MIN) { + l = static_cast(intpart); return true; } - }else if(intpart <= LONG_MAX) { - l = (long)intpart; + } + else if (intpart <= static_cast(LONG_MAX)) { + l = static_cast(intpart); return true; } } diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 2690031d42..1b5d56243b 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -114,6 +114,12 @@ # include #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + //#include #include #include diff --git a/src/Gui/WorkbenchPyImp.cpp b/src/Gui/WorkbenchPyImp.cpp index bae0d5ea0e..2cd3001363 100644 --- a/src/Gui/WorkbenchPyImp.cpp +++ b/src/Gui/WorkbenchPyImp.cpp @@ -117,9 +117,9 @@ PyObject* WorkbenchPy::getToolbarItems(PyObject *args) std::list>> bars = getWorkbenchPtr()->getToolbarItems(); Py::Dict dict; - for (const auto it : bars) { + for (const auto& it : bars) { Py::List list; - for (const auto jt : it.second) { + for (const auto& jt : it.second) { list.append(Py::String(jt)); } dict.setItem(it.first, list); diff --git a/src/Mod/Mesh/App/Core/Approximation.cpp b/src/Mod/Mesh/App/Core/Approximation.cpp index a115792c2d..42494427ef 100644 --- a/src/Mod/Mesh/App/Core/Approximation.cpp +++ b/src/Mod/Mesh/App/Core/Approximation.cpp @@ -29,6 +29,12 @@ # include #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #include "Approximation.h" #include "Elements.h" #include "Utilities.h" diff --git a/src/Mod/Mesh/App/Core/CylinderFit.cpp b/src/Mod/Mesh/App/Core/CylinderFit.cpp index d5bfb3480f..6b46b6baec 100644 --- a/src/Mod/Mesh/App/Core/CylinderFit.cpp +++ b/src/Mod/Mesh/App/Core/CylinderFit.cpp @@ -61,6 +61,12 @@ # include #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #include "CylinderFit.h" #include #include diff --git a/src/Mod/Mesh/App/Core/KDTree.cpp b/src/Mod/Mesh/App/Core/KDTree.cpp index c7a7f72377..5c8d126cf9 100644 --- a/src/Mod/Mesh/App/Core/KDTree.cpp +++ b/src/Mod/Mesh/App/Core/KDTree.cpp @@ -28,6 +28,12 @@ #ifndef _PreComp_ #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #include "KDTree.h" #include diff --git a/src/Mod/Mesh/App/Core/SphereFit.cpp b/src/Mod/Mesh/App/Core/SphereFit.cpp index dfc1166858..fcf0cdcc53 100644 --- a/src/Mod/Mesh/App/Core/SphereFit.cpp +++ b/src/Mod/Mesh/App/Core/SphereFit.cpp @@ -28,6 +28,12 @@ # include #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #include "SphereFit.h" #include diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp index b2cd23f61d..16b424eebc 100644 --- a/src/Mod/Part/App/GeometryCurvePyImp.cpp +++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp @@ -22,6 +22,13 @@ #include "PreCompiled.h" + +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #ifndef _PreComp_ # include # include diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index a75a0a961d..c4bb984e77 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -22,6 +22,13 @@ #include "PreCompiled.h" + +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #ifndef _PreComp_ # include # include diff --git a/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp b/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp index d7ff195dac..510aef8744 100644 --- a/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp +++ b/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp @@ -151,7 +151,7 @@ static void findGeometry(int minFaces, double tolerance, for (auto segmIt : segm) { const std::vector& data = segmIt->GetSegments(); - for (const auto dataIt : data) { + for (const auto& dataIt : data) { vpm->addSelection(dataIt); } } diff --git a/src/Mod/Robot/App/CMakeLists.txt b/src/Mod/Robot/App/CMakeLists.txt index f794c28112..383386c01b 100644 --- a/src/Mod/Robot/App/CMakeLists.txt +++ b/src/Mod/Robot/App/CMakeLists.txt @@ -125,6 +125,12 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS}) add_library(Robot SHARED ${Robot_SRCS}) target_link_libraries(Robot ${Robot_LIBS}) +unset(_flag_found CACHE) +check_cxx_compiler_flag("-Wno-deprecated-copy" _flag_found) +if (_flag_found) + target_compile_options(Robot PRIVATE -Wno-deprecated-copy) +endif() + SET_BIN_DIR(Robot Robot /Mod/Robot) SET_PYTHON_PREFIX_SUFFIX(Robot) diff --git a/src/Mod/Robot/Gui/CMakeLists.txt b/src/Mod/Robot/Gui/CMakeLists.txt index 7aea7b2639..e460a69d9c 100644 --- a/src/Mod/Robot/Gui/CMakeLists.txt +++ b/src/Mod/Robot/Gui/CMakeLists.txt @@ -156,6 +156,12 @@ SET(RobotGuiIcon_SVG add_library(RobotGui SHARED ${RobotGui_SRCS} ${RobotGuiIcon_SVG}) target_link_libraries(RobotGui ${RobotGui_LIBS}) +unset(_flag_found CACHE) +check_cxx_compiler_flag("-Wno-deprecated-copy" _flag_found) +if (_flag_found) + target_compile_options(RobotGui PRIVATE -Wno-deprecated-copy) +endif () + SET_BIN_DIR(RobotGui RobotGui /Mod/Robot) SET_PYTHON_PREFIX_SUFFIX(RobotGui) diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 76ecb4fef5..a65dc65825 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -25,6 +25,12 @@ #pragma warning(disable : 4996) #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + //#define _GCS_DEBUG //#define _GCS_DEBUG_SOLVER_JACOBIAN_QR_DECOMPOSITION_TRIANGULAR_MATRIX //#define _DEBUG_TO_FILE // Many matrices surpass the report view string size. diff --git a/src/Mod/Sketcher/App/planegcs/qp_eq.cpp b/src/Mod/Sketcher/App/planegcs/qp_eq.cpp index 7eeb58fafc..3133937b7e 100644 --- a/src/Mod/Sketcher/App/planegcs/qp_eq.cpp +++ b/src/Mod/Sketcher/App/planegcs/qp_eq.cpp @@ -24,6 +24,12 @@ #pragma warning(disable : 4244) #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wdeprecated-copy") +# pragma clang diagnostic ignored "-Wdeprecated-copy" +#endif +#endif + #include #include diff --git a/src/zipios++/ziphead.cpp b/src/zipios++/ziphead.cpp index dc6f323c6d..749661d294 100644 --- a/src/zipios++/ziphead.cpp +++ b/src/zipios++/ziphead.cpp @@ -198,7 +198,7 @@ bool ZipLocalEntry::trailingDataDescriptor() const { // gp_bitfield bit 3 is one, if this entry uses a trailing data // descriptor to keep size, compressed size and crc-32 // fields. - if ( ( gp_bitfield & 4 ) == 1 ) + if ( ( gp_bitfield & 4 ) == 4 ) return true ; else return false ;