Commit 1cb15aef authored by Samir Halilcevic's avatar Samir Halilcevic Committed by Dominik Charousset

Fix compiler warnings on Linux

parent 6dc89b27
...@@ -5,6 +5,4 @@ set(CAF_LOG_LEVEL TRACE CACHE STRING "") ...@@ -5,6 +5,4 @@ set(CAF_LOG_LEVEL TRACE CACHE STRING "")
if(NOT MSVC AND NOT CMAKE_SYSTEM MATCHES BSD) if(NOT MSVC AND NOT CMAKE_SYSTEM MATCHES BSD)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "") set(CMAKE_BUILD_TYPE Debug CACHE STRING "")
endif() endif()
if(CMAKE_SYSTEM MATCHES BSD) set(CMAKE_CXX_FLAGS "-Werror")
set(CMAKE_CXX_FLAGS "-Werror")
endif()
...@@ -41,7 +41,6 @@ time_t tm_to_time_t(tm& time_buf) noexcept { ...@@ -41,7 +41,6 @@ time_t tm_to_time_t(tm& time_buf) noexcept {
} // namespace } // namespace
#else #else
# define _GNU_SOURCE
# include <ctime> # include <ctime>
# include <ratio> # include <ratio>
......
...@@ -89,6 +89,9 @@ ...@@ -89,6 +89,9 @@
# define CAF_PUSH_DEPRECATED_WARNING \ # define CAF_PUSH_DEPRECATED_WARNING \
_Pragma("clang diagnostic push") \ _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
# define CAF_PUSH_UNUSED_RESULT_WARNING \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunused-result\"")
# define CAF_POP_WARNINGS \ # define CAF_POP_WARNINGS \
_Pragma("clang diagnostic pop") _Pragma("clang diagnostic pop")
# define CAF_ANNOTATE_FALLTHROUGH [[clang::fallthrough]] # define CAF_ANNOTATE_FALLTHROUGH [[clang::fallthrough]]
...@@ -118,6 +121,9 @@ ...@@ -118,6 +121,9 @@
# define CAF_PUSH_DEPRECATED_WARNING \ # define CAF_PUSH_DEPRECATED_WARNING \
_Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define CAF_PUSH_UNUSED_RESULT_WARNING \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-result\"")
# define CAF_POP_WARNINGS \ # define CAF_POP_WARNINGS \
_Pragma("GCC diagnostic pop") _Pragma("GCC diagnostic pop")
# if __GNUC__ >= 7 # if __GNUC__ >= 7
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#pragma once #pragma once
#include "caf/config.hpp"
#include "caf/detail/is_complete.hpp" #include "caf/detail/is_complete.hpp"
#include "caf/detail/is_one_of.hpp" #include "caf/detail/is_one_of.hpp"
#include "caf/detail/type_list.hpp" #include "caf/detail/type_list.hpp"
...@@ -1034,8 +1035,17 @@ constexpr bool is_64bit_integer_v = std::is_same_v<T, int64_t> ...@@ -1034,8 +1035,17 @@ constexpr bool is_64bit_integer_v = std::is_same_v<T, int64_t>
/// Checks whether `T` has a static member function called `init_host_system`. /// Checks whether `T` has a static member function called `init_host_system`.
template <class T> template <class T>
struct has_init_host_system { struct has_init_host_system {
// GNU g++ 8.5.0 (almalinux-8) has a known bug where [[nodiscard] values are
// reported as warnings, even in unevaluated context.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89070
#if !defined(__clang__) && defined(__GNUC__)
CAF_PUSH_UNUSED_RESULT_WARNING
#endif
template <class U> template <class U>
static auto sfinae(U*) -> decltype(U::init_host_system(), std::true_type()); static auto sfinae(U*) -> decltype(U::init_host_system(), std::true_type());
#if !defined(__clang__) && defined(__GNUC__)
CAF_POP_WARNINGS
#endif
template <class U> template <class U>
static auto sfinae(...) -> std::false_type; static auto sfinae(...) -> std::false_type;
......
...@@ -834,8 +834,8 @@ auto scheduled_actor::reactivate(mailbox_element& x) -> activation_result { ...@@ -834,8 +834,8 @@ auto scheduled_actor::reactivate(mailbox_element& x) -> activation_result {
handle_exception(std::current_exception()); handle_exception(std::current_exception());
} }
finalize(); finalize();
return activation_result::terminated;
#endif // CAF_ENABLE_EXCEPTIONS #endif // CAF_ENABLE_EXCEPTIONS
return activation_result::terminated;
} }
// -- behavior management ---------------------------------------------------- // -- behavior management ----------------------------------------------------
......
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