Handle clang 10 warnings:
+ fix -Wtautological-bitwise-compare + fix -Wimplicit-int-float-conversion + fix -Wmisleading-indentation + fix -Wrange-loop-construct + suppress -Wdeprecated-copy of 3rd party libs
This commit is contained in:
@@ -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
|
||||
|
||||
15
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
15
src/3rdParty/salomesmesh/CMakeLists.txt
vendored
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<int>(intpart);
|
||||
l = i;
|
||||
return 1;
|
||||
}
|
||||
if(intpart >= LONG_MIN) {
|
||||
l = (long)intpart;
|
||||
if (intpart >= LONG_MIN) {
|
||||
l = static_cast<long>(intpart);
|
||||
return 2;
|
||||
}
|
||||
}else if(intpart <= INT_MAX) {
|
||||
i = (int)intpart;
|
||||
}
|
||||
else if (intpart <= INT_MAX) {
|
||||
i = static_cast<int>(intpart);
|
||||
l = i;
|
||||
return 1;
|
||||
}else if(intpart <= LONG_MAX) {
|
||||
l = (int)intpart;
|
||||
}
|
||||
else if (intpart <= static_cast<double>(LONG_MAX)) {
|
||||
l = static_cast<int>(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<long>(intpart);
|
||||
return true;
|
||||
}
|
||||
}else if(intpart <= LONG_MAX) {
|
||||
l = (long)intpart;
|
||||
}
|
||||
else if (intpart <= static_cast<double>(LONG_MAX)) {
|
||||
l = static_cast<long>(intpart);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,12 @@
|
||||
# include <QOpenGLTexture>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
#if __has_warning("-Wdeprecated-copy")
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include <OpenGL/glu.h>
|
||||
#include <Eigen/Dense>
|
||||
#include <vector>
|
||||
|
||||
@@ -117,9 +117,9 @@ PyObject* WorkbenchPy::getToolbarItems(PyObject *args)
|
||||
std::list<std::pair<std::string, std::list<std::string>>> 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);
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
# include <iterator>
|
||||
#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"
|
||||
|
||||
@@ -61,6 +61,12 @@
|
||||
# include <iterator>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
#if __has_warning("-Wdeprecated-copy")
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "CylinderFit.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Mod/Mesh/App/WildMagic4/Wm4ApprLineFit3.h>
|
||||
|
||||
@@ -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 <kdtree++/kdtree.hpp>
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
# include <iterator>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
#if __has_warning("-Wdeprecated-copy")
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-copy"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "SphereFit.h"
|
||||
#include <Base/Console.h>
|
||||
|
||||
|
||||
@@ -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 <sstream>
|
||||
# include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
|
||||
@@ -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 <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <gp_Circ.hxx>
|
||||
|
||||
@@ -151,7 +151,7 @@ static void findGeometry(int minFaces, double tolerance,
|
||||
|
||||
for (auto segmIt : segm) {
|
||||
const std::vector<MeshCore::MeshSegment>& data = segmIt->GetSegments();
|
||||
for (const auto dataIt : data) {
|
||||
for (const auto& dataIt : data) {
|
||||
vpm->addSelection(dataIt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 <iostream>
|
||||
#include <Eigen/QR>
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
Reference in New Issue
Block a user