Commit 587ae9af authored by Martin Heistermann's avatar Martin Heistermann
Browse files

Enable more warnings on g++ and fix them

parent c373d3ef
...@@ -46,12 +46,7 @@ if (UNIX) ...@@ -46,12 +46,7 @@ if (UNIX)
# Warnings # Warnings
################################################################################ ################################################################################
IF( NOT CMAKE_SYSTEM MATCHES "SunOS*") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang.*")
list(APPEND ADDITIONAL_CXX_FLAGS "-W" "-Wall" "-Wno-unused" )
list(APPEND ADDITIONAL_C_FLAGS "-W" "-Wall" "-Wno-unused" )
ENDIF()
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything") list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat") list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded") list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
...@@ -63,6 +58,17 @@ if (UNIX) ...@@ -63,6 +58,17 @@ if (UNIX)
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated") list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables") list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wall")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wextra")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wpedantic")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wshadow")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wpointer-arith")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wcast-qual")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wconversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wtype-limits")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wsign-compare")
endif()
################################################################################ ################################################################################
# STL Vector checks # STL Vector checks
......
...@@ -238,7 +238,7 @@ inline void OpenVolumeMeshPropertyT<bool>::swap(size_t _i0, size_t _i1) ...@@ -238,7 +238,7 @@ inline void OpenVolumeMeshPropertyT<bool>::swap(size_t _i0, size_t _i1)
auto tmp = data_[_i0]; auto tmp = data_[_i0];
data_[_i0] = data_[_i1]; data_[_i0] = data_[_i1];
data_[_i1] = tmp;; data_[_i1] = tmp;
} }
template<> template<>
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
TopologyKernel& operator=(const TopologyKernel&) = default; TopologyKernel& operator=(const TopologyKernel&) = default;
void assign(const TopologyKernel *other) { void assign(const TopologyKernel *other) {
assert(other != nullptr);
*this = *other; *this = *other;
} }
......
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
static const unsigned char INVALID = 6; static const unsigned char INVALID = 6;
static inline unsigned char opposite_orientation(const unsigned char _d) { static inline unsigned char opposite_orientation(const unsigned char _d) {
return (_d % 2 == 0 ? _d + 1 : _d - 1); return static_cast<unsigned char>(_d % 2 == 0 ? _d + 1 : _d - 1);
} }
// Constructor // Constructor
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment