From 83d192b1f1a6a92dea158f0ff8cbacff94926b17 Mon Sep 17 00:00:00 2001 From: Chen Hayat Date: Sun, 30 Oct 2016 17:07:51 +0200 Subject: [PATCH 1/3] Fix compilation error C2664 on VS2013 No converting constructor --- include/spdlog/sinks/sink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index d27fdbe0..9cb7d417 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -15,7 +15,7 @@ namespace sinks class sink { public: - sink(): _level( level::trace ) {} + sink() { _level = (int)level::trace; } virtual ~sink() {} virtual void log(const details::log_msg& msg) = 0; From 0c16b9ae1e2dbb181c195f602b515ca0ef138fa1 Mon Sep 17 00:00:00 2001 From: Chen Hayat Date: Tue, 1 Nov 2016 17:16:07 +0200 Subject: [PATCH 2/3] Remove casting from previous commit and fix the following Klockwork issues: 1. Removing "return" from void functions. 2. Using "const" for operator= argument. --- include/spdlog/details/async_log_helper.h | 2 +- include/spdlog/fmt/bundled/format.h | 4 ++-- include/spdlog/sinks/sink.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index 14539e75..fdb1dc5c 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -82,7 +82,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT: // never copy or assign. should only be moved.. async_msg(const async_msg&) = delete; - async_msg& operator=(async_msg& other) = delete; + async_msg& operator=(const async_msg& other) = delete; // construct from log_msg async_msg(const details::log_msg& m) : diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index ad832009..6290cee7 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -1098,7 +1098,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, template inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) { - return format_decimal(buffer, value, num_digits, NoThousandsSep()); + format_decimal(buffer, value, num_digits, NoThousandsSep()); } #ifndef _WIN32 @@ -2256,7 +2256,7 @@ public: void visit_bool(bool value) { if (spec_.type_) - return visit_any_int(value); + visit_any_int(value); write(value); } diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 9cb7d417..fd7adfed 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -15,7 +15,10 @@ namespace sinks class sink { public: - sink() { _level = (int)level::trace; } + sink() + { + _level = level::trace; + } virtual ~sink() {} virtual void log(const details::log_msg& msg) = 0; From b4cb1febf2329c07f4668ad18388d8b36e3a6b95 Mon Sep 17 00:00:00 2001 From: Chen Hayat Date: Wed, 2 Nov 2016 15:43:30 +0200 Subject: [PATCH 3/3] removed external library changes --- include/spdlog/details/async_log_helper.h | 2 +- include/spdlog/fmt/bundled/format.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index fdb1dc5c..14539e75 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -82,7 +82,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT: // never copy or assign. should only be moved.. async_msg(const async_msg&) = delete; - async_msg& operator=(const async_msg& other) = delete; + async_msg& operator=(async_msg& other) = delete; // construct from log_msg async_msg(const details::log_msg& m) : diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index 6290cee7..ad832009 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -1098,7 +1098,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, template inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) { - format_decimal(buffer, value, num_digits, NoThousandsSep()); + return format_decimal(buffer, value, num_digits, NoThousandsSep()); } #ifndef _WIN32 @@ -2256,7 +2256,7 @@ public: void visit_bool(bool value) { if (spec_.type_) - visit_any_int(value); + return visit_any_int(value); write(value); }