From 91a5d70a627aec290860971c338d638e60ce595e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 23 Jul 2019 11:22:54 +0200 Subject: [PATCH] Fixed a few warnings in headers (meaning they were reported once for each include) Fixed an identification of CXX compiler in cmake so that 'AppleClang' is recognized --- CMakeLists.txt | 4 ++-- src/libslic3r/Utils.hpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoBase.cpp | 4 ++-- src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp | 6 +++--- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 2 +- src/slic3r/GUI/wxExtensions.hpp | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f60c8bde6..6f2332ce0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX) endif () endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") add_compile_options(-Wall) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" ) @@ -170,7 +170,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE add_compile_options(-Werror=return-type) #removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1) - #if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1) + #if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.1) # add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM #endif() diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index 09e24a475..8a4f1424b 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -172,7 +172,7 @@ extern std::string xml_escape(std::string text); #if defined __GNUC__ && __GNUC__ < 5 && !defined __clang__ // Older GCCs don't have std::is_trivially_copyable // cf. https://gcc.gnu.org/onlinedocs/gcc-4.9.4/libstdc++/manual/manual/status.html#status.iso.2011 -#warning "GCC version < 5, faking std::is_trivially_copyable" +// #warning "GCC version < 5, faking std::is_trivially_copyable" template struct IsTriviallyCopyable { static constexpr bool value = true; }; #else template struct IsTriviallyCopyable : public std::is_trivially_copyable {}; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp index 4b975e87e..a65074646 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp @@ -166,7 +166,7 @@ void GLGizmoBase::set_highlight_color(const float* color) void GLGizmoBase::enable_grabber(unsigned int id) { - if ((0 <= id) && (id < (unsigned int)m_grabbers.size())) + if (id < m_grabbers.size()) m_grabbers[id].enabled = true; on_enable_grabber(id); @@ -174,7 +174,7 @@ void GLGizmoBase::enable_grabber(unsigned int id) void GLGizmoBase::disable_grabber(unsigned int id) { - if ((0 <= id) && (id < (unsigned int)m_grabbers.size())) + if (id < m_grabbers.size()) m_grabbers[id].enabled = false; on_disable_grabber(id); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp index 7846edb22..8733c9a11 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp @@ -93,19 +93,19 @@ protected: } virtual void on_set_hover_id() { - for (unsigned int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { m_gizmos[i].set_hover_id((m_hover_id == i) ? 0 : -1); } } virtual void on_enable_grabber(unsigned int id) { - if ((0 <= id) && (id < 3)) + if (id < 3) m_gizmos[id].enable_grabber(0); } virtual void on_disable_grabber(unsigned int id) { - if ((0 <= id) && (id < 3)) + if (id < 3) m_gizmos[id].disable_grabber(0); } virtual void on_start_dragging(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 2aaf55424..d96b806e5 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -223,7 +223,7 @@ void GLGizmosManager::update_data() enable_grabber(Rotate, 1, !is_wipe_tower); bool enable_scale_xyz = selection.is_single_full_instance() || selection.is_single_volume() || selection.is_single_modifier(); - for (int i = 0; i < 6; ++i) + for (unsigned int i = 0; i < 6; ++i) { enable_grabber(Scale, i, enable_scale_xyz); } diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 9a6460dcb..a704f79d7 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -323,9 +323,9 @@ public: } bool SwapChildrens(int frst_id, int scnd_id) { - if (GetChildCount() < 2 || - frst_id < 0 || frst_id >= GetChildCount() || - scnd_id < 0 || scnd_id >= GetChildCount()) + if (GetChildCount() < 2 || + frst_id < 0 || (size_t)frst_id >= GetChildCount() || + scnd_id < 0 || (size_t)scnd_id >= GetChildCount()) return false; ObjectDataViewModelNode new_scnd = *GetNthChild(frst_id);