From a171b2b9b0cc8710c05f75fe6da0d33affae2d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20K=C3=A4m=C3=A4r=C3=A4inen?= Date: Sun, 9 Oct 2016 13:39:47 +0300 Subject: [PATCH] Couple warning fixes (#139) * Use -Wno-tautological-constant-out-of-range-compare for Clang (these warnings come from the sanity checks in generated IfcXXX files). * Remove unused variable and typedefs + suppress uint->bool conversion warnings (MSVC) + add note about Clang in README * MSVC uint->bool convesion warning fixes when IFC4 is defined --- README.md | 4 ++-- cmake/CMakeLists.txt | 3 +++ src/examples/IfcAdvancedHouse.cpp | 6 ------ src/ifcgeom/IfcGeomFunctions.cpp | 2 +- src/ifcgeom/IfcGeomSerialisation.cpp | 12 ++++++------ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 64088e6e93..5621374c64 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,8 @@ Start the MSYS2 Shell and then: #### Using Bash on Ubuntu on Windows -Start Bash on Ubuntu on Windows and follow the instructions below. Ubuntu 14.04.4 LTS with GCC 4.8.4 has been -confirmed to work. +Start Bash on Ubuntu on Windows and follow the instructions below. Compiling on Ubuntu 14.04.4 LTS using GCC 4.8.4 +or Clang 3.5 has been confirmed to work. ### Compiling on *nix diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index dcab4adbf6..d5c3d5f6f5 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -369,6 +369,9 @@ IF(MSVC) ENDFOREACH() ElSE() add_definitions(-Wall -Wextra) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_definitions(-Wno-tautological-constant-out-of-range-compare) + endif() # -fPIC is not relevant on Windows and creates pointless warnings if (UNIX) add_definitions(-fPIC) diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index 94a3bfa431..76cda1d4d6 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -52,12 +52,6 @@ #include #endif -// Some convenience typedefs and definitions. -typedef std::string S; -typedef IfcParse::IfcGlobalId guid; -typedef std::pair XY; -boost::none_t const null = boost::none; - // The creation of Nurbs-surface for the IfcSite mesh, to be implemented lateron void createGroundShape(TopoDS_Shape& shape); diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 6d15b7dba6..bba83010ce 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -2116,7 +2116,7 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo for (int i = 0; i < 2; ++i) { TopoDS_Shape& shape = i == 0 ? front : back; - const bool result_is_null = is_null[i] = shape.IsNull(); + const bool result_is_null = is_null[i] = shape.IsNull() != 0; if (result_is_null) { continue; } diff --git a/src/ifcgeom/IfcGeomSerialisation.cpp b/src/ifcgeom/IfcGeomSerialisation.cpp index fe17d7abf3..1cbdcd097c 100644 --- a/src/ifcgeom/IfcGeomSerialisation.cpp +++ b/src/ifcgeom/IfcGeomSerialisation.cpp @@ -168,7 +168,7 @@ int convert_to_ifc(const Handle_Geom_Curve& c, IfcSchema::IfcCurve*& curve, bool bspline->Degree(), points, IfcSchema::IfcBSplineCurveForm::IfcBSplineCurveForm_UNSPECIFIED, - bspline->IsClosed(), + bspline->IsClosed() != 0, false, mults, knots, @@ -180,7 +180,7 @@ int convert_to_ifc(const Handle_Geom_Curve& c, IfcSchema::IfcCurve*& curve, bool bspline->Degree(), points, IfcSchema::IfcBSplineCurveForm::IfcBSplineCurveForm_UNSPECIFIED, - bspline->IsClosed(), + bspline->IsClosed() != 0, false, mults, knots, @@ -284,8 +284,8 @@ int convert_to_ifc(const Handle_Geom_Surface& s, IfcSchema::IfcSurface*& surface bspline->VDegree(), points, IfcSchema::IfcBSplineSurfaceForm::IfcBSplineSurfaceForm_UNSPECIFIED, - bspline->IsUClosed(), - bspline->IsVClosed(), + bspline->IsUClosed() != 0, + bspline->IsVClosed() != 0, false, umults, vmults, @@ -300,8 +300,8 @@ int convert_to_ifc(const Handle_Geom_Surface& s, IfcSchema::IfcSurface*& surface bspline->VDegree(), points, IfcSchema::IfcBSplineSurfaceForm::IfcBSplineSurfaceForm_UNSPECIFIED, - bspline->IsUClosed(), - bspline->IsVClosed(), + bspline->IsUClosed() != 0, + bspline->IsVClosed() != 0, false, umults, vmults,