Fixed some extra warnings from clang

This commit is contained in:
gabime 2018-08-31 14:17:11 +03:00
parent e52e258f15
commit f4bbe8b2b3
5 changed files with 35 additions and 13 deletions

22
example/Makefile-all-warn Normal file
View File

@ -0,0 +1,22 @@
#-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded
CXX ?= g++
CXX_FLAGS = -Wall -Wextra -pedantic -std=c++11 -pthread -I../include -fmax-errors=1 -Wconversion -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-weak-vtables -Wno-global-constructors
CXX_RELEASE_FLAGS = -O3 -march=native
CXX_DEBUG_FLAGS= -g
all: example
debug: example-debug
example: example.cpp
$(CXX) example.cpp -o example $(CXX_FLAGS) $(CXX_RELEASE_FLAGS) $(CXXFLAGS)
example-debug: example.cpp
$(CXX) example.cpp -o example-debug $(CXX_FLAGS) $(CXX_DEBUG_FLAGS) $(CXXFLAGS)
clean:
rm -f *.o logs/*.txt example example-debug
rebuild: clean all
rebuild-debug: clean debug

View File

@ -198,6 +198,13 @@ private:
switch (incoming_async_msg.msg_type)
{
case async_msg_type::log:
{
log_msg msg;
incoming_async_msg.to_log_msg(msg);
incoming_async_msg.worker_ptr->backend_log_(msg);
return true;
}
case async_msg_type::flush:
{
incoming_async_msg.worker_ptr->backend_flush_();
@ -208,17 +215,10 @@ private:
{
return false;
}
default:
{
log_msg msg;
incoming_async_msg.to_log_msg(msg);
incoming_async_msg.worker_ptr->backend_log_(msg);
}
assert(false && "Unexpected async_msg_type");
return true;
}
}
return true; // should not be reached
}
};
} // namespace details

View File

@ -22,7 +22,9 @@ public:
explicit sink(std::unique_ptr<spdlog::pattern_formatter> formatter)
: level_(level::trace)
, formatter_(std::move(formatter)){};
, formatter_(std::move(formatter))
{
}
virtual ~sink() = default;
virtual void log(const details::log_msg &msg) = 0;

View File

@ -92,7 +92,6 @@ TEST_CASE("periodic flush", "[periodic_flush]")
spdlog::drop_all();
}
TEST_CASE("clone", "[clone]")
{
using namespace spdlog;
@ -133,6 +132,5 @@ TEST_CASE("clone async", "[clone]")
auto test_sink = std::static_pointer_cast<sinks::test_sink_mt>(cloned->sinks()[0]);
REQUIRE(test_sink->msg_counter() == 2);
spdlog::drop_all();
}