Commit ad624432 authored by Daniel Chabrowski's avatar Daniel Chabrowski

google-explicit-constructor

parent 1e1ca231
......@@ -106,7 +106,6 @@ using level_hasher = std::hash<int>;
} //level
//
// Async overflow policy - block by default.
//
......@@ -139,12 +138,14 @@ std::string errno_str(int err_num);
class spdlog_ex : public std::exception
{
public:
spdlog_ex(const std::string& msg):_msg(msg)
explicit spdlog_ex(std::string msg) : _msg(std::move(msg))
{}
spdlog_ex(const std::string& msg, int last_errno)
{
_msg = msg + ": " + details::os::errno_str(last_errno);
}
const char* what() const SPDLOG_NOEXCEPT override
{
return _msg.c_str();
......@@ -163,5 +164,4 @@ using filename_t = std::wstring;
using filename_t = std::string;
#endif
} //spdlog
......@@ -67,7 +67,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
msg_id(other.msg_id)
{}
async_msg(async_msg_type m_type):
explicit async_msg(async_msg_type m_type):
level(level::info),
thread_id(0),
msg_type(m_type),
......@@ -91,7 +91,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
async_msg& operator=(const async_msg& other) = delete;
// construct from log_msg
async_msg(const details::log_msg& m):
explicit async_msg(const details::log_msg& m):
level(m.level),
time(m.time),
thread_id(m.thread_id),
......
......@@ -53,13 +53,13 @@ namespace spdlog
namespace details
{
template<typename T>
template <typename T>
class mpmc_bounded_queue
{
public:
using item_type = T;
mpmc_bounded_queue(size_t buffer_size)
explicit mpmc_bounded_queue(size_t buffer_size)
:max_size_(buffer_size),
buffer_(new cell_t[buffer_size]),
buffer_mask_(buffer_size - 1)
......@@ -79,6 +79,8 @@ public:
delete[] buffer_;
}
mpmc_bounded_queue(mpmc_bounded_queue const&) = delete;
void operator=(mpmc_bounded_queue const&) = delete;
bool enqueue(T&& data)
{
......@@ -167,9 +169,6 @@ private:
cacheline_pad_t pad2_;
std::atomic<size_t> dequeue_pos_;
cacheline_pad_t pad3_;
mpmc_bounded_queue(mpmc_bounded_queue const&) = delete;
void operator= (mpmc_bounded_queue const&) = delete;
};
} // ns details
......
......@@ -27,7 +27,7 @@ struct null_atomic_int
int value;
null_atomic_int() = default;
null_atomic_int(int val):value(val)
explicit null_atomic_int(int val) : value(val)
{}
int load(std::memory_order) const
......
......@@ -26,9 +26,12 @@ namespace spdlog
{
namespace details
{
template <class Mutex> class registry_t
template <class Mutex>
class registry_t
{
public:
registry_t<Mutex>(const registry_t<Mutex>&) = delete;
registry_t<Mutex>& operator=(const registry_t<Mutex>&) = delete;
void register_logger(std::shared_ptr<logger> logger)
{
......@@ -38,7 +41,6 @@ public:
_loggers[logger_name] = logger;
}
std::shared_ptr<logger> get(const std::string& logger_name)
{
std::lock_guard<Mutex> lock(_mutex);
......@@ -111,6 +113,7 @@ public:
std::lock_guard<Mutex> lock(_mutex);
_loggers.clear();
}
std::shared_ptr<logger> create(const std::string& logger_name, sinks_init_list sinks)
{
return create(logger_name, sinks.begin(), sinks.end());
......@@ -195,8 +198,6 @@ public:
private:
registry_t<Mutex>() = default;
registry_t<Mutex>(const registry_t<Mutex>&) = delete;
registry_t<Mutex>& operator=(const registry_t<Mutex>&) = delete;
void throw_if_exists(const std::string &logger_name)
{
......
......@@ -25,7 +25,7 @@ namespace spdlog
class logger
{
public:
logger(const std::string& logger_name, sink_ptr single_sink);
logger(const std::string& name, sink_ptr single_sink);
logger(const std::string& name, sinks_init_list);
template<class It>
logger(const std::string& name, const It& begin, const It& end);
......
......@@ -26,7 +26,7 @@ template <class Mutex>
class ansicolor_sink : public base_sink<Mutex>
{
public:
ansicolor_sink(FILE* file): target_file_(file)
explicit ansicolor_sink(FILE* file) : target_file_(file)
{
should_do_colors_ = details::os::in_terminal(file) && details::os::is_color_terminal();
colors_[level::trace] = cyan;
......
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