Commit f4bbe8b2 authored by gabime's avatar gabime

Fixed some extra warnings from clang

parent e52e258f
#-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
...@@ -107,4 +107,4 @@ inline std::shared_ptr<spdlog::logger> spdlog::async_logger::clone(std::string n ...@@ -107,4 +107,4 @@ inline std::shared_ptr<spdlog::logger> spdlog::async_logger::clone(std::string n
cloned->flush_on(this->flush_level()); cloned->flush_on(this->flush_level());
cloned->set_error_handler(this->error_handler()); cloned->set_error_handler(this->error_handler());
return std::move(cloned); return std::move(cloned);
} }
\ No newline at end of file
...@@ -198,6 +198,13 @@ private: ...@@ -198,6 +198,13 @@ private:
switch (incoming_async_msg.msg_type) 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: case async_msg_type::flush:
{ {
incoming_async_msg.worker_ptr->backend_flush_(); incoming_async_msg.worker_ptr->backend_flush_();
...@@ -208,16 +215,9 @@ private: ...@@ -208,16 +215,9 @@ private:
{ {
return false; return false;
} }
default:
{
log_msg msg;
incoming_async_msg.to_log_msg(msg);
incoming_async_msg.worker_ptr->backend_log_(msg);
return true;
}
} }
return true; // should not be reached assert(false && "Unexpected async_msg_type");
return true;
} }
}; };
......
...@@ -22,7 +22,9 @@ public: ...@@ -22,7 +22,9 @@ public:
explicit sink(std::unique_ptr<spdlog::pattern_formatter> formatter) explicit sink(std::unique_ptr<spdlog::pattern_formatter> formatter)
: level_(level::trace) : level_(level::trace)
, formatter_(std::move(formatter)){}; , formatter_(std::move(formatter))
{
}
virtual ~sink() = default; virtual ~sink() = default;
virtual void log(const details::log_msg &msg) = 0; virtual void log(const details::log_msg &msg) = 0;
......
...@@ -92,7 +92,6 @@ TEST_CASE("periodic flush", "[periodic_flush]") ...@@ -92,7 +92,6 @@ TEST_CASE("periodic flush", "[periodic_flush]")
spdlog::drop_all(); spdlog::drop_all();
} }
TEST_CASE("clone", "[clone]") TEST_CASE("clone", "[clone]")
{ {
using namespace spdlog; using namespace spdlog;
...@@ -133,6 +132,5 @@ TEST_CASE("clone async", "[clone]") ...@@ -133,6 +132,5 @@ TEST_CASE("clone async", "[clone]")
auto test_sink = std::static_pointer_cast<sinks::test_sink_mt>(cloned->sinks()[0]); auto test_sink = std::static_pointer_cast<sinks::test_sink_mt>(cloned->sinks()[0]);
REQUIRE(test_sink->msg_counter() == 2); REQUIRE(test_sink->msg_counter() == 2);
spdlog::drop_all(); spdlog::drop_all();
} }
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