mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
Fixed some extra warnings from clang
This commit is contained in:
parent
e52e258f15
commit
f4bbe8b2b3
22
example/Makefile-all-warn
Normal file
22
example/Makefile-all-warn
Normal 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
|
@ -107,4 +107,4 @@ inline std::shared_ptr<spdlog::logger> spdlog::async_logger::clone(std::string n
|
||||
cloned->flush_on(this->flush_level());
|
||||
cloned->set_error_handler(this->error_handler());
|
||||
return std::move(cloned);
|
||||
}
|
||||
}
|
||||
|
@ -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,16 +215,9 @@ private:
|
||||
{
|
||||
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:
|
||||
|
||||
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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user