From 55e67f3a552ec79ab6d094d7da43f0caaaa2bde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20G=C3=BCndling?= Date: Mon, 30 Jan 2023 09:51:34 +0100 Subject: [PATCH] enable -Wall -Wextra for GCC, fix warnings, closes #173 --- CMakeLists.txt | 2 ++ include/cista/containers/mutable_fws_multimap.h | 4 ++++ include/cista/containers/string.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee834e7b..f0d5cd88 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR -Wno-unused-member-function -Werror ) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(cista-compile-flags -Wall -Wextra) endif() option(CISTA_ZERO_OUT "zero out fresh memory for valgrind" OFF) diff --git a/include/cista/containers/mutable_fws_multimap.h b/include/cista/containers/mutable_fws_multimap.h index 6251df54..fccd24b2 100644 --- a/include/cista/containers/mutable_fws_multimap.h +++ b/include/cista/containers/mutable_fws_multimap.h @@ -51,13 +51,17 @@ struct dynamic_fws_multimap_base { size_type capacity() const noexcept { return get_index().capacity_; } bool empty() const noexcept { return size() == 0; } +#ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wclass-conversion" +#endif template > operator bucket() { return bucket{multimap_, index_}; } +#ifdef __clang__ #pragma clang diagnostic pop +#endif iterator begin() { return mutable_mm().data_.begin() + get_index().begin_; } diff --git a/include/cista/containers/string.h b/include/cista/containers/string.h index caeb1dd3..d880b612 100644 --- a/include/cista/containers/string.h +++ b/include/cista/containers/string.h @@ -339,7 +339,7 @@ struct basic_string : public generic_string { basic_string(char const* s, typename base::msize_t const len) : base{s, len, base::owning} {} - basic_string(basic_string const& o) { base::set_owning(o.data(), o.size()); } + basic_string(basic_string const& o) : base{o.view(), base::owning} {} basic_string(basic_string&& o) { base::move_from(std::move(o)); } basic_string& operator=(basic_string const& o) {