From 83d192b1f1a6a92dea158f0ff8cbacff94926b17 Mon Sep 17 00:00:00 2001 From: Chen Hayat Date: Sun, 30 Oct 2016 17:07:51 +0200 Subject: [PATCH 1/7] 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/7] 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/7] 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); } From 5259b3dbf469c46cffe9a5c206d0b17f32880dfc Mon Sep 17 00:00:00 2001 From: Chen Hayat Date: Thu, 3 Nov 2016 14:19:02 +0200 Subject: [PATCH 4/7] Fix Klockwork compilation warning --- include/spdlog/details/async_log_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) : From e9fc4ac0955744eaa49ef8c474d8c17e4edd5e4c Mon Sep 17 00:00:00 2001 From: osx2000 Date: Fri, 11 Nov 2016 14:27:07 +0100 Subject: [PATCH 5/7] Fully qualified std::this_thread::yield() --- include/spdlog/details/async_log_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index fdb1dc5c..7b537361 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -359,7 +359,7 @@ inline void spdlog::details::async_log_helper::sleep_or_yield(const spdlog::log_ // yield upto 150 micros if (time_since_op <= microseconds(100)) - return yield(); + return std::this_thread::yield(); // sleep for 20 ms upto 200 ms From 3cd497ee95771502f1ff045c65a57d18df3c6b1b Mon Sep 17 00:00:00 2001 From: osx2000 Date: Fri, 11 Nov 2016 14:28:45 +0100 Subject: [PATCH 6/7] extended conditional compilation to __SUNPRO_CC --- include/spdlog/details/os.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 86efa0dc..d468ff45 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -343,7 +343,7 @@ inline std::string errno_str(int err_num) else return "Unkown error"; -#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(ANDROID) || \ +#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(ANDROID) || defined(__SUNPRO_CC) || \ ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) // posix version if (strerror_r(err_num, buf, buf_size) == 0) From 9eee823041f3e48904c2a0fbc26d97bb88ff3d62 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Mon, 14 Nov 2016 14:58:10 +0200 Subject: [PATCH 7/7] Fix issue #315 --- include/spdlog/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 1a7ce761..a0a227ef 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -30,11 +30,11 @@ #endif #if defined(__GNUC__) || defined(__clang__) -#define DEPRECATED __attribute__((deprecated)) +#define SPDLOG_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) -#define DEPRECATED __declspec(deprecated) +#define SPDLOG_DEPRECATED __declspec(deprecated) #else -#define DEPRECATED +#define SPDLOG_DEPRECATED #endif