diff --git a/.clang-format b/.clang-format index c8c345f6..f02bf093 100644 --- a/.clang-format +++ b/.clang-format @@ -13,7 +13,6 @@ AlignEscapedNewlines: Left AlwaysBreakTemplateDeclarations: Yes PackConstructorInitializers: Never BreakConstructorInitializersBeforeComma: false -IndentPPDirectives: BeforeHash +IndentPPDirectives: None SortIncludes: Never ... - diff --git a/bench/async_bench.cpp b/bench/async_bench.cpp index dcd24b29..13f4c515 100644 --- a/bench/async_bench.cpp +++ b/bench/async_bench.cpp @@ -11,11 +11,11 @@ #include "spdlog/sinks/basic_file_sink.h" #if defined(SPDLOG_USE_STD_FORMAT) - #include +#include #elif defined(SPDLOG_FMT_EXTERNAL) - #include +#include #else - #include "spdlog/fmt/bundled/format.h" +#include "spdlog/fmt/bundled/format.h" #endif #include "utils.h" @@ -34,9 +34,9 @@ using namespace utils; void bench_mt(int howmany, std::shared_ptr log, int thread_count); #ifdef _MSC_VER - #pragma warning(push) - #pragma warning(disable : 4996) // disable fopen warning under msvc -#endif // _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) // disable fopen warning under msvc +#endif // _MSC_VER int count_lines(const char *filename) { int counter = 0; @@ -62,7 +62,7 @@ void verify_file(const char *filename, int expected_count) { } #ifdef _MSC_VER - #pragma warning(pop) +#pragma warning(pop) #endif int main(int argc, char *argv[]) { diff --git a/bench/bench.cpp b/bench/bench.cpp index ceb0edf2..8f859d64 100644 --- a/bench/bench.cpp +++ b/bench/bench.cpp @@ -13,11 +13,11 @@ #include "spdlog/sinks/rotating_file_sink.h" #if defined(SPDLOG_USE_STD_FORMAT) - #include +#include #elif defined(SPDLOG_FMT_EXTERNAL) - #include +#include #else - #include "spdlog/fmt/bundled/format.h" +#include "spdlog/fmt/bundled/format.h" #endif #include "utils.h" diff --git a/example/example.cpp b/example/example.cpp index 16575d19..c82af3f6 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -183,7 +183,7 @@ void async_example() { // {:n} - don't split the output to lines. #if !defined SPDLOG_USE_STD_FORMAT || defined(_MSC_VER) - #include "spdlog/fmt/bin_to_hex.h" +#include "spdlog/fmt/bin_to_hex.h" void binary_example() { std::vector buf; for (int i = 0; i < 80; i++) { @@ -207,7 +207,7 @@ void binary_example() { // Log a vector of numbers #ifndef SPDLOG_USE_STD_FORMAT - #include "spdlog/fmt/ranges.h" +#include "spdlog/fmt/ranges.h" void vector_example() { std::vector vec = {1, 2, 3}; spdlog::info("Vector example: {}", vec); @@ -301,7 +301,7 @@ void err_handler_example() { // syslog example (linux/osx/freebsd) #ifndef _WIN32 - #include "spdlog/sinks/syslog_sink.h" +#include "spdlog/sinks/syslog_sink.h" void syslog_example() { std::string ident = "spdlog-example"; auto syslog_logger = spdlog::syslog_logger_mt("syslog", ident, LOG_PID); @@ -311,7 +311,7 @@ void syslog_example() { // Android example. #if defined(__ANDROID__) - #include "spdlog/sinks/android_sink.h" +#include "spdlog/sinks/android_sink.h" void android_example() { std::string tag = "spdlog-android"; auto android_logger = spdlog::android_logger_mt("android", tag); @@ -386,7 +386,7 @@ void replace_default_logger_example() { // thread-local storage. #ifndef SPDLOG_NO_TLS - #include "spdlog/mdc.h" +#include "spdlog/mdc.h" void mdc_example() { spdlog::mdc::put("key1", "value1"); spdlog::mdc::put("key2", "value2"); diff --git a/include/spdlog/async_logger-inl.h b/include/spdlog/async_logger-inl.h index a681d97c..cde73f90 100644 --- a/include/spdlog/async_logger-inl.h +++ b/include/spdlog/async_logger-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/async_logger.h b/include/spdlog/async_logger.h index 846c4c6f..be361538 100644 --- a/include/spdlog/async_logger.h +++ b/include/spdlog/async_logger.h @@ -70,5 +70,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "async_logger-inl.h" +#include "async_logger-inl.h" #endif diff --git a/include/spdlog/cfg/helpers-inl.h b/include/spdlog/cfg/helpers-inl.h index 61b9b9f6..6ed86955 100644 --- a/include/spdlog/cfg/helpers-inl.h +++ b/include/spdlog/cfg/helpers-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/cfg/helpers.h b/include/spdlog/cfg/helpers.h index c0238189..d09a1e97 100644 --- a/include/spdlog/cfg/helpers.h +++ b/include/spdlog/cfg/helpers.h @@ -25,5 +25,5 @@ SPDLOG_API void load_levels(const std::string &txt); } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "helpers-inl.h" +#include "helpers-inl.h" #endif // SPDLOG_HEADER_ONLY diff --git a/include/spdlog/common-inl.h b/include/spdlog/common-inl.h index a8a0453c..f35901c5 100644 --- a/include/spdlog/common-inl.h +++ b/include/spdlog/common-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/common.h b/include/spdlog/common.h index ba9a2e75..20dbca45 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -17,57 +17,57 @@ #include #ifdef SPDLOG_USE_STD_FORMAT - #include - #if __cpp_lib_format >= 202207L - #include - #else - #include - #endif +#include +#if __cpp_lib_format >= 202207L +#include +#else +#include +#endif #endif #ifdef SPDLOG_COMPILED_LIB - #undef SPDLOG_HEADER_ONLY - #if defined(SPDLOG_SHARED_LIB) - #if defined(_WIN32) - #ifdef spdlog_EXPORTS - #define SPDLOG_API __declspec(dllexport) - #else // !spdlog_EXPORTS - #define SPDLOG_API __declspec(dllimport) - #endif - #else // !defined(_WIN32) - #define SPDLOG_API __attribute__((visibility("default"))) - #endif - #else // !defined(SPDLOG_SHARED_LIB) - #define SPDLOG_API - #endif - #define SPDLOG_INLINE +#undef SPDLOG_HEADER_ONLY +#if defined(SPDLOG_SHARED_LIB) +#if defined(_WIN32) +#ifdef spdlog_EXPORTS +#define SPDLOG_API __declspec(dllexport) +#else // !spdlog_EXPORTS +#define SPDLOG_API __declspec(dllimport) +#endif +#else // !defined(_WIN32) +#define SPDLOG_API __attribute__((visibility("default"))) +#endif +#else // !defined(SPDLOG_SHARED_LIB) +#define SPDLOG_API +#endif +#define SPDLOG_INLINE #else // !defined(SPDLOG_COMPILED_LIB) - #define SPDLOG_API - #define SPDLOG_HEADER_ONLY - #define SPDLOG_INLINE inline +#define SPDLOG_API +#define SPDLOG_HEADER_ONLY +#define SPDLOG_INLINE inline #endif // #ifdef SPDLOG_COMPILED_LIB #include #if !defined(SPDLOG_USE_STD_FORMAT) && \ FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8 - #define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string) - #define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string) - #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) - #include - #endif +#define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string) +#define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string) +#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +#include +#endif #else - #define SPDLOG_FMT_RUNTIME(format_string) format_string - #define SPDLOG_FMT_STRING(format_string) format_string +#define SPDLOG_FMT_RUNTIME(format_string) format_string +#define SPDLOG_FMT_STRING(format_string) format_string #endif // visual studio up to 2013 does not support noexcept nor constexpr #if defined(_MSC_VER) && (_MSC_VER < 1900) - #define SPDLOG_NOEXCEPT _NOEXCEPT - #define SPDLOG_CONSTEXPR +#define SPDLOG_NOEXCEPT _NOEXCEPT +#define SPDLOG_CONSTEXPR #else - #define SPDLOG_NOEXCEPT noexcept - #define SPDLOG_CONSTEXPR constexpr +#define SPDLOG_NOEXCEPT noexcept +#define SPDLOG_CONSTEXPR constexpr #endif // If building with std::format, can just use constexpr, otherwise if building with fmt @@ -76,48 +76,48 @@ // depending on the compiler // If fmt determines it can't use constexpr, we should inline the function instead #ifdef SPDLOG_USE_STD_FORMAT - #define SPDLOG_CONSTEXPR_FUNC constexpr +#define SPDLOG_CONSTEXPR_FUNC constexpr #else // Being built with fmt - #if FMT_USE_CONSTEXPR - #define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR - #else - #define SPDLOG_CONSTEXPR_FUNC inline - #endif +#if FMT_USE_CONSTEXPR +#define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR +#else +#define SPDLOG_CONSTEXPR_FUNC inline +#endif #endif #if defined(__GNUC__) || defined(__clang__) - #define SPDLOG_DEPRECATED __attribute__((deprecated)) +#define SPDLOG_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) - #define SPDLOG_DEPRECATED __declspec(deprecated) +#define SPDLOG_DEPRECATED __declspec(deprecated) #else - #define SPDLOG_DEPRECATED +#define SPDLOG_DEPRECATED #endif // disable thread local on msvc 2013 #ifndef SPDLOG_NO_TLS - #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) - #define SPDLOG_NO_TLS 1 - #endif +#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) +#define SPDLOG_NO_TLS 1 +#endif #endif #ifndef SPDLOG_FUNCTION - #define SPDLOG_FUNCTION static_cast(__FUNCTION__) +#define SPDLOG_FUNCTION static_cast(__FUNCTION__) #endif #ifdef SPDLOG_NO_EXCEPTIONS - #define SPDLOG_TRY - #define SPDLOG_THROW(ex) \ - do { \ - printf("spdlog fatal error: %s\n", ex.what()); \ - std::abort(); \ - } while (0) - #define SPDLOG_CATCH_STD +#define SPDLOG_TRY +#define SPDLOG_THROW(ex) \ + do { \ + printf("spdlog fatal error: %s\n", ex.what()); \ + std::abort(); \ + } while (0) +#define SPDLOG_CATCH_STD #else - #define SPDLOG_TRY try - #define SPDLOG_THROW(ex) throw(ex) - #define SPDLOG_CATCH_STD \ - catch (const std::exception &) { \ - } +#define SPDLOG_TRY try +#define SPDLOG_THROW(ex) throw(ex) +#define SPDLOG_CATCH_STD \ + catch (const std::exception &) { \ + } #endif namespace spdlog { @@ -130,12 +130,12 @@ class sink; #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) using filename_t = std::wstring; - // allow macro expansion to occur in SPDLOG_FILENAME_T - #define SPDLOG_FILENAME_T_INNER(s) L##s - #define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s) +// allow macro expansion to occur in SPDLOG_FILENAME_T +#define SPDLOG_FILENAME_T_INNER(s) L##s +#define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s) #else using filename_t = std::string; - #define SPDLOG_FILENAME_T(s) s +#define SPDLOG_FILENAME_T(s) s #endif using log_clock = std::chrono::system_clock; @@ -149,28 +149,28 @@ using string_view_t = std::string_view; using memory_buf_t = std::string; template - #if __cpp_lib_format >= 202207L +#if __cpp_lib_format >= 202207L using format_string_t = std::format_string; - #else +#else using format_string_t = std::string_view; - #endif +#endif template struct is_convertible_to_basic_format_string : std::integral_constant>::value> {}; - #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) using wstring_view_t = std::wstring_view; using wmemory_buf_t = std::wstring; template - #if __cpp_lib_format >= 202207L +#if __cpp_lib_format >= 202207L using wformat_string_t = std::wformat_string; - #else +#else using wformat_string_t = std::wstring_view; - #endif - #endif - #define SPDLOG_BUF_TO_STRING(x) x +#endif +#endif +#define SPDLOG_BUF_TO_STRING(x) x #else // use fmt lib instead of std::format namespace fmt_lib = fmt; @@ -184,11 +184,11 @@ template using remove_cvref_t = typename std::remove_cv::type>::type; template - #if FMT_VERSION >= 90101 +#if FMT_VERSION >= 90101 using fmt_runtime_string = fmt::runtime_format_string; - #else +#else using fmt_runtime_string = fmt::basic_runtime; - #endif +#endif // clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the // condition from basic_format_string here, in addition, fmt::basic_runtime is only @@ -200,21 +200,21 @@ struct is_convertible_to_basic_format_string std::is_same, fmt_runtime_string>::value> { }; - #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) using wstring_view_t = fmt::basic_string_view; using wmemory_buf_t = fmt::basic_memory_buffer; template using wformat_string_t = fmt::wformat_string; - #endif - #define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x) +#endif +#define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x) #endif #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT - #ifndef _WIN32 - #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows - #endif // _WIN32 -#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT +#ifndef _WIN32 +#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows +#endif // _WIN32 +#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT template struct is_convertible_to_any_format_string @@ -237,7 +237,7 @@ using level_t = std::atomic; #define SPDLOG_LEVEL_OFF 6 #if !defined(SPDLOG_ACTIVE_LEVEL) - #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO #endif // Log level enum @@ -262,18 +262,18 @@ enum level_enum : int { #define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3) #if !defined(SPDLOG_LEVEL_NAMES) - #define SPDLOG_LEVEL_NAMES \ - { \ - SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, \ - SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \ - SPDLOG_LEVEL_NAME_OFF \ - } +#define SPDLOG_LEVEL_NAMES \ + { \ + SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, \ + SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \ + SPDLOG_LEVEL_NAME_OFF \ + } #endif #if !defined(SPDLOG_SHORT_LEVEL_NAMES) - #define SPDLOG_SHORT_LEVEL_NAMES \ - { "T", "D", "I", "W", "E", "C", "O" } +#define SPDLOG_SHORT_LEVEL_NAMES \ + { "T", "D", "I", "W", "E", "C", "O" } #endif SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; @@ -402,5 +402,5 @@ constexpr T conditional_static_cast(U value) { } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "common-inl.h" +#include "common-inl.h" #endif diff --git a/include/spdlog/details/backtracer-inl.h b/include/spdlog/details/backtracer-inl.h index 43d10024..baa06b6a 100644 --- a/include/spdlog/details/backtracer-inl.h +++ b/include/spdlog/details/backtracer-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif namespace spdlog { namespace details { diff --git a/include/spdlog/details/backtracer.h b/include/spdlog/details/backtracer.h index 541339cd..f9eb4b43 100644 --- a/include/spdlog/details/backtracer.h +++ b/include/spdlog/details/backtracer.h @@ -41,5 +41,5 @@ public: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "backtracer-inl.h" +#include "backtracer-inl.h" #endif diff --git a/include/spdlog/details/file_helper-inl.h b/include/spdlog/details/file_helper-inl.h index 0c514ef2..c7260ec3 100644 --- a/include/spdlog/details/file_helper-inl.h +++ b/include/spdlog/details/file_helper-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index f0e5d180..aba0be47 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -57,5 +57,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "file_helper-inl.h" +#include "file_helper-inl.h" #endif diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 61306003..b629b894 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -9,8 +9,8 @@ #include #ifdef SPDLOG_USE_STD_FORMAT - #include - #include +#include +#include #endif // Some fmt helpers to efficiently format and pad ints and strings @@ -70,13 +70,13 @@ inline unsigned int count_digits(T n) { return count_digits_fallback(static_cast(n)); #else return static_cast(fmt:: - // fmt 7.0.0 renamed the internal namespace to detail. - // See: https://github.com/fmtlib/fmt/issues/1538 - #if FMT_VERSION < 70000 +// fmt 7.0.0 renamed the internal namespace to detail. +// See: https://github.com/fmtlib/fmt/issues/1538 +#if FMT_VERSION < 70000 internal - #else +#else detail - #endif +#endif ::count_digits(static_cast(n))); #endif } diff --git a/include/spdlog/details/log_msg-inl.h b/include/spdlog/details/log_msg-inl.h index aa3a9576..3a23dcf1 100644 --- a/include/spdlog/details/log_msg-inl.h +++ b/include/spdlog/details/log_msg-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index 87df1e83..64b4bf6f 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -36,5 +36,5 @@ struct SPDLOG_API log_msg { } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "log_msg-inl.h" +#include "log_msg-inl.h" #endif diff --git a/include/spdlog/details/log_msg_buffer-inl.h b/include/spdlog/details/log_msg_buffer-inl.h index 2eb24285..45c33835 100644 --- a/include/spdlog/details/log_msg_buffer-inl.h +++ b/include/spdlog/details/log_msg_buffer-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif namespace spdlog { diff --git a/include/spdlog/details/log_msg_buffer.h b/include/spdlog/details/log_msg_buffer.h index 1143b3ba..c926cfaa 100644 --- a/include/spdlog/details/log_msg_buffer.h +++ b/include/spdlog/details/log_msg_buffer.h @@ -28,5 +28,5 @@ public: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "log_msg_buffer-inl.h" +#include "log_msg_buffer-inl.h" #endif diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index f0ddd192..2acded09 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include @@ -22,50 +22,50 @@ #include #ifdef _WIN32 - #include - #include // for _get_osfhandle, _isatty, _fileno - #include // for _get_pid +#include +#include // for _get_osfhandle, _isatty, _fileno +#include // for _get_pid - #ifdef __MINGW32__ - #include - #endif +#ifdef __MINGW32__ +#include +#endif - #if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES) - #include - #include - #endif +#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES) +#include +#include +#endif - #include // for _mkdir/_wmkdir +#include // for _mkdir/_wmkdir #else // unix - #include - #include +#include +#include - #ifdef __linux__ - #include //Use gettid() syscall under linux to get thread id +#ifdef __linux__ +#include //Use gettid() syscall under linux to get thread id - #elif defined(_AIX) - #include // for pthread_getthrds_np +#elif defined(_AIX) +#include // for pthread_getthrds_np - #elif defined(__DragonFly__) || defined(__FreeBSD__) - #include // for pthread_getthreadid_np +#elif defined(__DragonFly__) || defined(__FreeBSD__) +#include // for pthread_getthreadid_np - #elif defined(__NetBSD__) - #include // for _lwp_self +#elif defined(__NetBSD__) +#include // for _lwp_self - #elif defined(__sun) - #include // for thr_self - #endif +#elif defined(__sun) +#include // for thr_self +#endif #endif // unix #if defined __APPLE__ - #include +#include #endif -#ifndef __has_feature // Clang - feature checking macros. - #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#ifndef __has_feature // Clang - feature checking macros. +#define __has_feature(x) 0 // Compatibility with non-clang compilers. #endif namespace spdlog { @@ -119,12 +119,12 @@ SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT { // fopen_s on non windows for writing SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode) { #ifdef _WIN32 - #ifdef SPDLOG_WCHAR_FILENAMES +#ifdef SPDLOG_WCHAR_FILENAMES *fp = ::_wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO); - #else +#else *fp = ::_fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO); - #endif - #if defined(SPDLOG_PREVENT_CHILD_FD) +#endif +#if defined(SPDLOG_PREVENT_CHILD_FD) if (*fp != nullptr) { auto file_handle = reinterpret_cast(_get_osfhandle(::_fileno(*fp))); if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) { @@ -132,9 +132,9 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename *fp = nullptr; } } - #endif +#endif #else // unix - #if defined(SPDLOG_PREVENT_CHILD_FD) +#if defined(SPDLOG_PREVENT_CHILD_FD) const int mode_flag = mode == SPDLOG_FILENAME_T("ab") ? O_APPEND : O_TRUNC; const int fd = ::open((filename.c_str()), O_CREAT | O_WRONLY | O_CLOEXEC | mode_flag, mode_t(0644)); @@ -145,9 +145,9 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename if (*fp == nullptr) { ::close(fd); } - #else +#else *fp = ::fopen((filename.c_str()), mode.c_str()); - #endif +#endif #endif return *fp == nullptr; @@ -177,11 +177,11 @@ SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT { #ifdef _WIN32 struct _stat buffer; - #ifdef SPDLOG_WCHAR_FILENAMES +#ifdef SPDLOG_WCHAR_FILENAMES return (::_wstat(filename.c_str(), &buffer) == 0); - #else +#else return (::_stat(filename.c_str(), &buffer) == 0); - #endif +#endif #else // common linux/unix all have the stat system call struct stat buffer; return (::stat(filename.c_str(), &buffer) == 0); @@ -189,9 +189,9 @@ SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT { } #ifdef _MSC_VER - // avoid warning about unreachable statement at the end of filesize() - #pragma warning(push) - #pragma warning(disable : 4702) +// avoid warning about unreachable statement at the end of filesize() +#pragma warning(push) +#pragma warning(disable : 4702) #endif // Return file size according to open FILE* object @@ -201,59 +201,59 @@ SPDLOG_INLINE size_t filesize(FILE *f) { } #if defined(_WIN32) && !defined(__CYGWIN__) int fd = ::_fileno(f); - #if defined(_WIN64) // 64 bits +#if defined(_WIN64) // 64 bits __int64 ret = ::_filelengthi64(fd); if (ret >= 0) { return static_cast(ret); } - #else // windows 32 bits +#else // windows 32 bits long ret = ::_filelength(fd); if (ret >= 0) { return static_cast(ret); } - #endif +#endif #else // unix - // OpenBSD and AIX doesn't compile with :: before the fileno(..) - #if defined(__OpenBSD__) || defined(_AIX) +// OpenBSD and AIX doesn't compile with :: before the fileno(..) +#if defined(__OpenBSD__) || defined(_AIX) int fd = fileno(f); - #else +#else int fd = ::fileno(f); - #endif - // 64 bits(but not in osx, linux/musl or cygwin, where fstat64 is deprecated) - #if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && \ - (defined(__LP64__) || defined(_LP64)) +#endif +// 64 bits(but not in osx, linux/musl or cygwin, where fstat64 is deprecated) +#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && \ + (defined(__LP64__) || defined(_LP64)) struct stat64 st; if (::fstat64(fd, &st) == 0) { return static_cast(st.st_size); } - #else // other unix or linux 32 bits or cygwin +#else // other unix or linux 32 bits or cygwin struct stat st; if (::fstat(fd, &st) == 0) { return static_cast(st.st_size); } - #endif +#endif #endif throw_spdlog_ex("Failed getting file size from fd", errno); return 0; // will not be reached. } #ifdef _MSC_VER - #pragma warning(pop) +#pragma warning(pop) #endif // Return utc offset in minutes or throw spdlog_ex on failure #if !defined(SPDLOG_NO_TZ_OFFSET) SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) { - #ifdef _WIN32 - #if _WIN32_WINNT < _WIN32_WINNT_WS08 +#ifdef _WIN32 +#if _WIN32_WINNT < _WIN32_WINNT_WS08 TIME_ZONE_INFORMATION tzinfo; auto rv = ::GetTimeZoneInformation(&tzinfo); - #else +#else DYNAMIC_TIME_ZONE_INFORMATION tzinfo; auto rv = ::GetDynamicTimeZoneInformation(&tzinfo); - #endif +#endif if (rv == TIME_ZONE_ID_INVALID) throw_spdlog_ex("Failed getting timezone info. ", errno); int offset = -tzinfo.Bias; @@ -263,10 +263,10 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) { offset -= tzinfo.StandardBias; } return offset; - #else +#else auto offset_seconds = tm.tm_gmtoff; return static_cast(offset_seconds / 60); - #endif +#endif } #endif // SPDLOG_NO_TZ_OFFSET @@ -277,9 +277,9 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT { #ifdef _WIN32 return static_cast(::GetCurrentThreadId()); #elif defined(__linux__) - #if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) - #define SYS_gettid __NR_gettid - #endif +#if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) +#define SYS_gettid __NR_gettid +#endif return static_cast(::syscall(SYS_gettid)); #elif defined(_AIX) struct __pthrdsinfo buf; @@ -298,25 +298,25 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT { return static_cast(::thr_self()); #elif __APPLE__ uint64_t tid; - // There is no pthread_threadid_np prior to Mac OS X 10.6, and it is not supported on any PPC, - // including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64. - #ifdef MAC_OS_X_VERSION_MAX_ALLOWED +// There is no pthread_threadid_np prior to Mac OS X 10.6, and it is not supported on any PPC, +// including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64. +#ifdef MAC_OS_X_VERSION_MAX_ALLOWED { - #if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__) +#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__) tid = pthread_mach_thread_np(pthread_self()); - #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 if (&pthread_threadid_np) { pthread_threadid_np(nullptr, &tid); } else { tid = pthread_mach_thread_np(pthread_self()); } - #else +#else pthread_threadid_np(nullptr, &tid); - #endif +#endif } - #else +#else pthread_threadid_np(nullptr, &tid); - #endif +#endif return static_cast(tid); #else // Default to standard C++11 (other Unix) return static_cast(std::hash()(std::this_thread::get_id())); @@ -469,11 +469,11 @@ SPDLOG_INLINE void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target) { // return true on success static SPDLOG_INLINE bool mkdir_(const filename_t &path) { #ifdef _WIN32 - #ifdef SPDLOG_WCHAR_FILENAMES +#ifdef SPDLOG_WCHAR_FILENAMES return ::_wmkdir(path.c_str()) == 0; - #else +#else return ::_mkdir(path.c_str()) == 0; - #endif +#endif #else return ::mkdir(path.c_str(), mode_t(0755)) == 0; #endif @@ -529,8 +529,8 @@ SPDLOG_INLINE filename_t dir_name(const filename_t &path) { } #ifdef _MSC_VER - #pragma warning(push) - #pragma warning(disable : 4996) +#pragma warning(push) +#pragma warning(disable : 4996) #endif // _MSC_VER std::string SPDLOG_INLINE getenv(const char *field) { #if defined(_MSC_VER) && defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_DESKTOP_APP) && \ @@ -542,7 +542,7 @@ std::string SPDLOG_INLINE getenv(const char *field) { #endif } #ifdef _MSC_VER - #pragma warning(pop) +#pragma warning(pop) #endif // _MSC_VER // Do fsync by FILE handlerpointer diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 5fd12bac..8bb8d14a 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -22,22 +22,22 @@ SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT; // eol definition #if !defined(SPDLOG_EOL) - #ifdef _WIN32 - #define SPDLOG_EOL "\r\n" - #else - #define SPDLOG_EOL "\n" - #endif +#ifdef _WIN32 +#define SPDLOG_EOL "\r\n" +#else +#define SPDLOG_EOL "\n" +#endif #endif SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL; // folder separator #if !defined(SPDLOG_FOLDER_SEPS) - #ifdef _WIN32 - #define SPDLOG_FOLDER_SEPS "\\/" - #else - #define SPDLOG_FOLDER_SEPS "/" - #endif +#ifdef _WIN32 +#define SPDLOG_FOLDER_SEPS "\\/" +#else +#define SPDLOG_FOLDER_SEPS "/" +#endif #endif SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS; @@ -123,5 +123,5 @@ SPDLOG_API bool fwrite_bytes(const void *ptr, const size_t n_bytes, FILE *fp); } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "os-inl.h" +#include "os-inl.h" #endif diff --git a/include/spdlog/details/periodic_worker-inl.h b/include/spdlog/details/periodic_worker-inl.h index 18f11fbe..c12e9e12 100644 --- a/include/spdlog/details/periodic_worker-inl.h +++ b/include/spdlog/details/periodic_worker-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif namespace spdlog { diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h index d647b66e..2f59bb33 100644 --- a/include/spdlog/details/periodic_worker.h +++ b/include/spdlog/details/periodic_worker.h @@ -54,5 +54,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "periodic_worker-inl.h" +#include "periodic_worker-inl.h" #endif diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index 272bebbd..576eebe0 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include @@ -13,12 +13,12 @@ #include #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER - // support for the default stdout color logger - #ifdef _WIN32 - #include - #else - #include - #endif +// support for the default stdout color logger +#ifdef _WIN32 +#include +#else +#include +#endif #endif // SPDLOG_DISABLE_DEFAULT_LOGGER #include @@ -33,12 +33,12 @@ namespace details { SPDLOG_INLINE registry::registry() : formatter_(new pattern_formatter()) { #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER - // create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows). - #ifdef _WIN32 +// create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows). +#ifdef _WIN32 auto color_sink = std::make_shared(); - #else +#else auto color_sink = std::make_shared(); - #endif +#endif const char *default_logger_name = ""; default_logger_ = std::make_shared(default_logger_name, std::move(color_sink)); diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 72c70b82..576803ee 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -127,5 +127,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "registry-inl.h" +#include "registry-inl.h" #endif diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb9..dcb1047e 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -4,7 +4,7 @@ #pragma once #ifdef _WIN32 - #error include tcp_client-windows.h instead +#error include tcp_client-windows.h instead #endif // tcp client helper @@ -169,7 +169,7 @@ public: #endif #if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) - #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" +#error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" #endif } diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b280..3fefc676 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h index f22b0782..b9303cf8 100644 --- a/include/spdlog/details/thread_pool.h +++ b/include/spdlog/details/thread_pool.h @@ -113,5 +113,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "thread_pool-inl.h" +#include "thread_pool-inl.h" #endif diff --git a/include/spdlog/details/udp_client-windows.h b/include/spdlog/details/udp_client-windows.h index 8b7c2232..fd60f280 100644 --- a/include/spdlog/details/udp_client-windows.h +++ b/include/spdlog/details/udp_client-windows.h @@ -16,9 +16,9 @@ #include #if defined(_MSC_VER) - #pragma comment(lib, "Ws2_32.lib") - #pragma comment(lib, "Mswsock.lib") - #pragma comment(lib, "AdvApi32.lib") +#pragma comment(lib, "Ws2_32.lib") +#pragma comment(lib, "Mswsock.lib") +#pragma comment(lib, "AdvApi32.lib") #endif namespace spdlog { diff --git a/include/spdlog/details/udp_client.h b/include/spdlog/details/udp_client.h index 95826f5d..8d9c71fa 100644 --- a/include/spdlog/details/udp_client.h +++ b/include/spdlog/details/udp_client.h @@ -7,7 +7,7 @@ // Will throw on construction if the socket creation failed. #ifdef _WIN32 - #error "include udp_client-windows.h instead" +#error "include udp_client-windows.h instead" #endif #include diff --git a/include/spdlog/details/windows_include.h b/include/spdlog/details/windows_include.h index bbab59b1..10e04fc4 100644 --- a/include/spdlog/details/windows_include.h +++ b/include/spdlog/details/windows_include.h @@ -1,11 +1,11 @@ #pragma once #ifndef NOMINMAX - #define NOMINMAX // prevent windows redefining min/max +#define NOMINMAX // prevent windows redefining min/max #endif #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #endif #include diff --git a/include/spdlog/fmt/bin_to_hex.h b/include/spdlog/fmt/bin_to_hex.h index 6ed68e42..57ef3020 100644 --- a/include/spdlog/fmt/bin_to_hex.h +++ b/include/spdlog/fmt/bin_to_hex.h @@ -9,13 +9,13 @@ #include #if defined(__has_include) - #if __has_include() - #include - #endif +#if __has_include() +#include +#endif #endif #if __cpp_lib_span >= 202002L - #include +#include #endif // diff --git a/include/spdlog/fmt/chrono.h b/include/spdlog/fmt/chrono.h index a72a5bd6..4da092b8 100644 --- a/include/spdlog/fmt/chrono.h +++ b/include/spdlog/fmt/chrono.h @@ -10,14 +10,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/fmt/compile.h b/include/spdlog/fmt/compile.h index 3c9c25d8..795e6a3d 100644 --- a/include/spdlog/fmt/compile.h +++ b/include/spdlog/fmt/compile.h @@ -10,14 +10,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/fmt/fmt.h b/include/spdlog/fmt/fmt.h index ba94a0c5..6b1936d3 100644 --- a/include/spdlog/fmt/fmt.h +++ b/include/spdlog/fmt/fmt.h @@ -12,15 +12,15 @@ #include #if defined(SPDLOG_USE_STD_FORMAT) // SPDLOG_USE_STD_FORMAT is defined - use std::format - #include +#include #elif !defined(SPDLOG_FMT_EXTERNAL) - #if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY) - #define FMT_HEADER_ONLY - #endif - #ifndef FMT_USE_WINDOWS_H - #define FMT_USE_WINDOWS_H 0 - #endif - #include +#if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY) +#define FMT_HEADER_ONLY +#endif +#ifndef FMT_USE_WINDOWS_H +#define FMT_USE_WINDOWS_H 0 +#endif +#include #else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib - #include +#include #endif diff --git a/include/spdlog/fmt/ostr.h b/include/spdlog/fmt/ostr.h index 2b901055..a9e50e1f 100644 --- a/include/spdlog/fmt/ostr.h +++ b/include/spdlog/fmt/ostr.h @@ -10,14 +10,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/fmt/ranges.h b/include/spdlog/fmt/ranges.h index 5bb91e9a..117a9e46 100644 --- a/include/spdlog/fmt/ranges.h +++ b/include/spdlog/fmt/ranges.h @@ -10,14 +10,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/fmt/std.h b/include/spdlog/fmt/std.h index dabe6f69..4a3b828c 100644 --- a/include/spdlog/fmt/std.h +++ b/include/spdlog/fmt/std.h @@ -11,14 +11,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/fmt/xchar.h b/include/spdlog/fmt/xchar.h index 2525f058..8ce17988 100644 --- a/include/spdlog/fmt/xchar.h +++ b/include/spdlog/fmt/xchar.h @@ -10,14 +10,14 @@ #include #if !defined(SPDLOG_USE_STD_FORMAT) - #if !defined(SPDLOG_FMT_EXTERNAL) - #ifdef SPDLOG_HEADER_ONLY - #ifndef FMT_HEADER_ONLY - #define FMT_HEADER_ONLY - #endif - #endif - #include - #else - #include - #endif +#if !defined(SPDLOG_FMT_EXTERNAL) +#ifdef SPDLOG_HEADER_ONLY +#ifndef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY +#endif +#endif +#include +#else +#include +#endif #endif diff --git a/include/spdlog/logger-inl.h b/include/spdlog/logger-inl.h index 6879273c..768cee37 100644 --- a/include/spdlog/logger-inl.h +++ b/include/spdlog/logger-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 8c3cd91f..9db3c6b3 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -19,30 +19,30 @@ #include #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT - #ifndef _WIN32 - #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows - #endif - #include +#ifndef _WIN32 +#error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows +#endif +#include #endif #include #ifndef SPDLOG_NO_EXCEPTIONS - #define SPDLOG_LOGGER_CATCH(location) \ - catch (const std::exception &ex) { \ - if (location.filename) { \ - err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), \ - location.filename, location.line)); \ - } else { \ - err_handler_(ex.what()); \ - } \ - } \ - catch (...) { \ - err_handler_("Rethrowing unknown exception in logger"); \ - throw; \ - } +#define SPDLOG_LOGGER_CATCH(location) \ + catch (const std::exception &ex) { \ + if (location.filename) { \ + err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), \ + location.filename, location.line)); \ + } else { \ + err_handler_(ex.what()); \ + } \ + } \ + catch (...) { \ + err_handler_("Rethrowing unknown exception in logger"); \ + throw; \ + } #else - #define SPDLOG_LOGGER_CATCH(location) +#define SPDLOG_LOGGER_CATCH(location) #endif namespace spdlog { @@ -375,5 +375,5 @@ void swap(logger &a, logger &b) noexcept; } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "logger-inl.h" +#include "logger-inl.h" #endif diff --git a/include/spdlog/mdc.h b/include/spdlog/mdc.h index bc131746..2f2665a7 100644 --- a/include/spdlog/mdc.h +++ b/include/spdlog/mdc.h @@ -4,7 +4,7 @@ #pragma once #if defined(SPDLOG_NO_TLS) - #error "This header requires thread local storage support, but SPDLOG_NO_TLS is defined." +#error "This header requires thread local storage support, but SPDLOG_NO_TLS is defined." #endif #include diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index 716a87fe..1c59663b 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include @@ -12,7 +12,7 @@ #include #ifndef SPDLOG_NO_TLS - #include +#include #endif #include @@ -702,9 +702,9 @@ public: : flag_formatter(padinfo) {} #ifdef _MSC_VER - #pragma warning(push) - #pragma warning(disable : 4127) // consider using 'if constexpr' instead -#endif // _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4127) // consider using 'if constexpr' instead +#endif // _MSC_VER static const char *basename(const char *filename) { // if the size is 2 (1 character + null terminator) we can use the more efficient strrchr // the branch will be elided by optimizations @@ -721,7 +721,7 @@ public: } } #ifdef _MSC_VER - #pragma warning(pop) +#pragma warning(pop) #endif // _MSC_VER void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h index ececd673..0658161c 100644 --- a/include/spdlog/pattern_formatter.h +++ b/include/spdlog/pattern_formatter.h @@ -114,5 +114,5 @@ private: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "pattern_formatter-inl.h" +#include "pattern_formatter-inl.h" #endif diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h index 4435a560..c9e1d27b 100644 --- a/include/spdlog/sinks/android_sink.h +++ b/include/spdlog/sinks/android_sink.h @@ -5,22 +5,22 @@ #ifdef __ANDROID__ - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - - #if !defined(SPDLOG_ANDROID_RETRIES) - #define SPDLOG_ANDROID_RETRIES 2 - #endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#if !defined(SPDLOG_ANDROID_RETRIES) +#define SPDLOG_ANDROID_RETRIES 2 +#endif namespace spdlog { namespace sinks { diff --git a/include/spdlog/sinks/ansicolor_sink-inl.h b/include/spdlog/sinks/ansicolor_sink-inl.h index 6a23f6c7..1d2c5447 100644 --- a/include/spdlog/sinks/ansicolor_sink-inl.h +++ b/include/spdlog/sinks/ansicolor_sink-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index e17b9a61..542888fb 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -114,5 +114,5 @@ using ansicolor_stderr_sink_st = ansicolor_stderr_sink +#include #endif #include diff --git a/include/spdlog/sinks/base_sink.h b/include/spdlog/sinks/base_sink.h index 1b4bb068..c4fb4fce 100644 --- a/include/spdlog/sinks/base_sink.h +++ b/include/spdlog/sinks/base_sink.h @@ -47,5 +47,5 @@ protected: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "base_sink-inl.h" +#include "base_sink-inl.h" #endif diff --git a/include/spdlog/sinks/basic_file_sink-inl.h b/include/spdlog/sinks/basic_file_sink-inl.h index ce0ddad0..8aec33c7 100644 --- a/include/spdlog/sinks/basic_file_sink-inl.h +++ b/include/spdlog/sinks/basic_file_sink-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index 48c07671..23ac6c1a 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -62,5 +62,5 @@ inline std::shared_ptr basic_logger_st(const std::string &logger_name, } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "basic_file_sink-inl.h" +#include "basic_file_sink-inl.h" #endif diff --git a/include/spdlog/sinks/msvc_sink.h b/include/spdlog/sinks/msvc_sink.h index c28d6ebd..1fe9892c 100644 --- a/include/spdlog/sinks/msvc_sink.h +++ b/include/spdlog/sinks/msvc_sink.h @@ -5,21 +5,21 @@ #if defined(_WIN32) - #include - #if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) - #include - #endif - #include +#include +#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +#include +#endif +#include - #include - #include +#include +#include - // Avoid including windows.h (https://stackoverflow.com/a/30741042) - #if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +// Avoid including windows.h (https://stackoverflow.com/a/30741042) +#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) extern "C" __declspec(dllimport) void __stdcall OutputDebugStringW(const wchar_t *lpOutputString); - #else +#else extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char *lpOutputString); - #endif +#endif extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); namespace spdlog { @@ -42,13 +42,13 @@ protected: memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); formatted.push_back('\0'); // add a null terminator for OutputDebugString - #if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) +#if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) wmemory_buf_t wformatted; details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), wformatted); OutputDebugStringW(wformatted.data()); - #else +#else OutputDebugStringA(formatted.data()); - #endif +#endif } void flush_() override {} diff --git a/include/spdlog/sinks/qt_sinks.h b/include/spdlog/sinks/qt_sinks.h index 60982eb1..ce74f888 100644 --- a/include/spdlog/sinks/qt_sinks.h +++ b/include/spdlog/sinks/qt_sinks.h @@ -160,20 +160,24 @@ protected: payload = QString::fromUtf8(str.data(), static_cast(str.size())); // convert color ranges from byte index to character index. if (msg.color_range_start < msg.color_range_end) { - color_range_start = QString::fromUtf8(str.data(), static_cast(msg.color_range_start)).size(); - color_range_end = QString::fromUtf8(str.data(), static_cast(msg.color_range_end)).size(); + color_range_start = + QString::fromUtf8(str.data(), static_cast(msg.color_range_start)) + .size(); + color_range_end = + QString::fromUtf8(str.data(), static_cast(msg.color_range_end)) + .size(); } } else { payload = QString::fromLatin1(str.data(), static_cast(str.size())); } - invoke_params params{max_lines_, // max lines - qt_text_edit_, // text edit to append to - std::move(payload), // text to append - default_color_, // default color + invoke_params params{max_lines_, // max lines + qt_text_edit_, // text edit to append to + std::move(payload), // text to append + default_color_, // default color colors_.at(static_cast(msg.level)), // color to apply - color_range_start, // color range start - color_range_end}; // color range end + color_range_start, // color range start + color_range_end}; // color range end QMetaObject::invokeMethod( qt_text_edit_, [params]() { invoke_method_(params); }, Qt::AutoConnection); diff --git a/include/spdlog/sinks/rotating_file_sink-inl.h b/include/spdlog/sinks/rotating_file_sink-inl.h index a3694d86..370fa7c2 100644 --- a/include/spdlog/sinks/rotating_file_sink-inl.h +++ b/include/spdlog/sinks/rotating_file_sink-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index 72302e69..522dab63 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -89,5 +89,5 @@ std::shared_ptr rotating_logger_st(const std::string &logger_name, } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "rotating_file_sink-inl.h" +#include "rotating_file_sink-inl.h" #endif diff --git a/include/spdlog/sinks/sink-inl.h b/include/spdlog/sinks/sink-inl.h index e4b27140..7ffb33e9 100644 --- a/include/spdlog/sinks/sink-inl.h +++ b/include/spdlog/sinks/sink-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 58506853..9c39522f 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -30,5 +30,5 @@ protected: } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "sink-inl.h" +#include "sink-inl.h" #endif diff --git a/include/spdlog/sinks/stdout_color_sinks-inl.h b/include/spdlog/sinks/stdout_color_sinks-inl.h index 166e3861..74c81130 100644 --- a/include/spdlog/sinks/stdout_color_sinks-inl.h +++ b/include/spdlog/sinks/stdout_color_sinks-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/stdout_color_sinks.h b/include/spdlog/sinks/stdout_color_sinks.h index 72991fe0..9ce26724 100644 --- a/include/spdlog/sinks/stdout_color_sinks.h +++ b/include/spdlog/sinks/stdout_color_sinks.h @@ -4,9 +4,9 @@ #pragma once #ifdef _WIN32 - #include +#include #else - #include +#include #endif #include @@ -45,5 +45,5 @@ std::shared_ptr stderr_color_st(const std::string &logger_name, } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "stdout_color_sinks-inl.h" +#include "stdout_color_sinks-inl.h" #endif diff --git a/include/spdlog/sinks/stdout_sinks-inl.h b/include/spdlog/sinks/stdout_sinks-inl.h index dcb21d84..74ec1414 100644 --- a/include/spdlog/sinks/stdout_sinks-inl.h +++ b/include/spdlog/sinks/stdout_sinks-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include @@ -13,17 +13,17 @@ #include #ifdef _WIN32 - // under windows using fwrite to non-binary stream results in \r\r\n (see issue #1675) - // so instead we use ::FileWrite - #include +// under windows using fwrite to non-binary stream results in \r\r\n (see issue #1675) +// so instead we use ::FileWrite +#include - #ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp - #include // WriteFile (..) - #endif +#ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp +#include // WriteFile (..) +#endif - #include // _get_osfhandle(..) - #include // _fileno(..) -#endif // _WIN32 +#include // _get_osfhandle(..) +#include // _fileno(..) +#endif // _WIN32 namespace spdlog { diff --git a/include/spdlog/sinks/stdout_sinks.h b/include/spdlog/sinks/stdout_sinks.h index 6ef09968..0b36c16f 100644 --- a/include/spdlog/sinks/stdout_sinks.h +++ b/include/spdlog/sinks/stdout_sinks.h @@ -9,7 +9,7 @@ #include #ifdef _WIN32 - #include +#include #endif namespace spdlog { @@ -80,5 +80,5 @@ std::shared_ptr stderr_logger_st(const std::string &logger_name); } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "stdout_sinks-inl.h" +#include "stdout_sinks-inl.h" #endif diff --git a/include/spdlog/sinks/systemd_sink.h b/include/spdlog/sinks/systemd_sink.h index d2cd55f2..1ad32ce7 100644 --- a/include/spdlog/sinks/systemd_sink.h +++ b/include/spdlog/sinks/systemd_sink.h @@ -10,7 +10,7 @@ #include #ifndef SD_JOURNAL_SUPPRESS_LOCATION - #define SD_JOURNAL_SUPPRESS_LOCATION +#define SD_JOURNAL_SUPPRESS_LOCATION #endif #include diff --git a/include/spdlog/sinks/tcp_sink.h b/include/spdlog/sinks/tcp_sink.h index 5d9ef825..cffd4339 100644 --- a/include/spdlog/sinks/tcp_sink.h +++ b/include/spdlog/sinks/tcp_sink.h @@ -7,9 +7,9 @@ #include #include #ifdef _WIN32 - #include +#include #else - #include +#include #endif #include diff --git a/include/spdlog/sinks/udp_sink.h b/include/spdlog/sinks/udp_sink.h index 4bff0fd2..6f287719 100644 --- a/include/spdlog/sinks/udp_sink.h +++ b/include/spdlog/sinks/udp_sink.h @@ -7,9 +7,9 @@ #include #include #ifdef _WIN32 - #include +#include #else - #include +#include #endif #include diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index a9c0fa25..910115c5 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index e62d14d3..743241c8 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -78,5 +78,5 @@ using wincolor_stderr_sink_st = wincolor_stderr_sink } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY - #include "wincolor_sink-inl.h" +#include "wincolor_sink-inl.h" #endif diff --git a/include/spdlog/spdlog-inl.h b/include/spdlog/spdlog-inl.h index e02081fe..56f19168 100644 --- a/include/spdlog/spdlog-inl.h +++ b/include/spdlog/spdlog-inl.h @@ -4,7 +4,7 @@ #pragma once #ifndef SPDLOG_HEADER_ONLY - #include +#include #endif #include diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 1a927ffc..681045e1 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -289,69 +289,66 @@ inline void critical(const T &msg) { // #ifndef SPDLOG_NO_SOURCE_LOC - #define SPDLOG_LOGGER_CALL(logger, level, ...) \ - (logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__) +#define SPDLOG_LOGGER_CALL(logger, level, ...) \ + (logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__) #else - #define SPDLOG_LOGGER_CALL(logger, level, ...) \ - (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__) +#define SPDLOG_LOGGER_CALL(logger, level, ...) \ + (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__) #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE - #define SPDLOG_LOGGER_TRACE(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__) - #define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_TRACE(logger, ...) \ + SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__) +#define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_TRACE(logger, ...) (void)0 - #define SPDLOG_TRACE(...) (void)0 +#define SPDLOG_LOGGER_TRACE(logger, ...) (void)0 +#define SPDLOG_TRACE(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG - #define SPDLOG_LOGGER_DEBUG(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__) - #define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_DEBUG(logger, ...) \ + SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__) +#define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0 - #define SPDLOG_DEBUG(...) (void)0 +#define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0 +#define SPDLOG_DEBUG(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO - #define SPDLOG_LOGGER_INFO(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__) - #define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_INFO(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__) +#define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_INFO(logger, ...) (void)0 - #define SPDLOG_INFO(...) (void)0 +#define SPDLOG_LOGGER_INFO(logger, ...) (void)0 +#define SPDLOG_INFO(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN - #define SPDLOG_LOGGER_WARN(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__) - #define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_WARN(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__) +#define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_WARN(logger, ...) (void)0 - #define SPDLOG_WARN(...) (void)0 +#define SPDLOG_LOGGER_WARN(logger, ...) (void)0 +#define SPDLOG_WARN(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR - #define SPDLOG_LOGGER_ERROR(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__) - #define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_ERROR(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__) +#define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_ERROR(logger, ...) (void)0 - #define SPDLOG_ERROR(...) (void)0 +#define SPDLOG_LOGGER_ERROR(logger, ...) (void)0 +#define SPDLOG_ERROR(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL - #define SPDLOG_LOGGER_CRITICAL(logger, ...) \ - SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__) - #define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__) +#define SPDLOG_LOGGER_CRITICAL(logger, ...) \ + SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__) +#define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__) #else - #define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0 - #define SPDLOG_CRITICAL(...) (void)0 +#define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0 +#define SPDLOG_CRITICAL(...) (void)0 #endif #ifdef SPDLOG_HEADER_ONLY - #include "spdlog-inl.h" +#include "spdlog-inl.h" #endif #endif // SPDLOG_H diff --git a/src/async.cpp b/src/async.cpp index 026185ac..77a07299 100644 --- a/src/async.cpp +++ b/src/async.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include diff --git a/src/bundled_fmtlib_format.cpp b/src/bundled_fmtlib_format.cpp index 50689fcb..999d6428 100644 --- a/src/bundled_fmtlib_format.cpp +++ b/src/bundled_fmtlib_format.cpp @@ -3,12 +3,12 @@ // All rights reserved. #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #if !defined(SPDLOG_FMT_EXTERNAL) && !defined(SPDLOG_USE_STD_FORMAT) - #include +#include FMT_BEGIN_NAMESPACE @@ -19,15 +19,12 @@ template FMT_API auto locale_ref::get() const -> std::locale; namespace detail { -template FMT_API auto dragonbox::to_decimal(float x) noexcept - -> dragonbox::decimal_fp; -template FMT_API auto dragonbox::to_decimal(double x) noexcept - -> dragonbox::decimal_fp; +template FMT_API auto dragonbox::to_decimal(float x) noexcept -> dragonbox::decimal_fp; +template FMT_API auto dragonbox::to_decimal(double x) noexcept -> dragonbox::decimal_fp; // Explicit instantiations for char. -template FMT_API auto thousands_sep_impl(locale_ref) - -> thousands_sep_result; +template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; template FMT_API auto decimal_point_impl(locale_ref) -> char; // DEPRECATED! @@ -35,8 +32,7 @@ template FMT_API void buffer::append(const char*, const char*); // Explicit instantiations for wchar_t. -template FMT_API auto thousands_sep_impl(locale_ref) - -> thousands_sep_result; +template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; // DEPRECATED! diff --git a/src/cfg.cpp b/src/cfg.cpp index ebdea166..98a96ca2 100644 --- a/src/cfg.cpp +++ b/src/cfg.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include diff --git a/src/color_sinks.cpp b/src/color_sinks.cpp index c44db197..6ee94327 100644 --- a/src/color_sinks.cpp +++ b/src/color_sinks.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include @@ -13,7 +13,7 @@ // color sinks // #ifdef _WIN32 - #include +#include template class SPDLOG_API spdlog::sinks::wincolor_sink; template class SPDLOG_API spdlog::sinks::wincolor_sink; template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink; @@ -21,7 +21,7 @@ template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink; template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink; #else - #include "spdlog/sinks/ansicolor_sink-inl.h" +#include "spdlog/sinks/ansicolor_sink-inl.h" template class SPDLOG_API spdlog::sinks::ansicolor_sink; template class SPDLOG_API spdlog::sinks::ansicolor_sink; template class SPDLOG_API spdlog::sinks::ansicolor_stdout_sink; diff --git a/src/file_sinks.cpp b/src/file_sinks.cpp index 04cb6c10..809883f0 100644 --- a/src/file_sinks.cpp +++ b/src/file_sinks.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include diff --git a/src/spdlog.cpp b/src/spdlog.cpp index 9f8390bc..c6c85149 100644 --- a/src/spdlog.cpp +++ b/src/spdlog.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include diff --git a/src/stdout_sinks.cpp b/src/stdout_sinks.cpp index bf4cfae2..d9d8ba4f 100644 --- a/src/stdout_sinks.cpp +++ b/src/stdout_sinks.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #ifndef SPDLOG_COMPILED_LIB - #error Please define SPDLOG_COMPILED_LIB to compile this file. +#error Please define SPDLOG_COMPILED_LIB to compile this file. #endif #include diff --git a/tests/includes.h b/tests/includes.h index 2e49a5cb..0bec4a0e 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -1,12 +1,12 @@ #pragma once #if defined(__GNUC__) && __GNUC__ == 12 - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 #endif #include #if defined(__GNUC__) && __GNUC__ == 12 - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif #include "utils.h" @@ -29,7 +29,7 @@ #include "spdlog/details/os.h" #ifndef SPDLOG_NO_TLS - #include "spdlog/mdc.h" +#include "spdlog/mdc.h" #endif #include "spdlog/sinks/basic_file_sink.h" diff --git a/tests/main.cpp b/tests/main.cpp index a4a4ff15..e80ceef0 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,10 +1,10 @@ #if defined(__GNUC__) && __GNUC__ == 12 - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 #endif #include #if defined(__GNUC__) && __GNUC__ == 12 - #pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif diff --git a/tests/test_create_dir.cpp b/tests/test_create_dir.cpp index fd040339..1a21f017 100644 --- a/tests/test_create_dir.cpp +++ b/tests/test_create_dir.cpp @@ -84,11 +84,11 @@ TEST_CASE("dir_name", "[create_dir]") { #ifdef _WIN32 - // - // test windows cases when drive letter is given e.g. C:\\some-folder - // - #include - #include +// +// test windows cases when drive letter is given e.g. C:\\some-folder +// +#include +#include std::string get_full_path(const std::string &relative_folder_path) { char full_path[MAX_PATH]; diff --git a/tests/test_daily_logger.cpp b/tests/test_daily_logger.cpp index 8a00c024..4a691a3c 100644 --- a/tests/test_daily_logger.cpp +++ b/tests/test_daily_logger.cpp @@ -98,7 +98,7 @@ TEST_CASE("rotating_file_sink::calc_filename3", "[rotating_file_sink]") { // regex supported only from gcc 4.9 and above #if defined(_MSC_VER) || !(__GNUC__ <= 4 && __GNUC_MINOR__ < 9) - #include +#include TEST_CASE("daily_file_sink::daily_filename_calculator", "[daily_file_sink]") { // daily_YYYY-MM-DD_hh-mm.txt diff --git a/tests/test_eventlog.cpp b/tests/test_eventlog.cpp index 702eabea..dca9896d 100644 --- a/tests/test_eventlog.cpp +++ b/tests/test_eventlog.cpp @@ -1,9 +1,9 @@ #if _WIN32 - #include "includes.h" - #include "test_sink.h" +#include "includes.h" +#include "test_sink.h" - #include "spdlog/sinks/win_eventlog_sink.h" +#include "spdlog/sinks/win_eventlog_sink.h" static const LPCSTR TEST_SOURCE = "spdlog_test"; diff --git a/tests/test_macros.cpp b/tests/test_macros.cpp index 132706f1..ce267efd 100644 --- a/tests/test_macros.cpp +++ b/tests/test_macros.cpp @@ -6,7 +6,7 @@ #include "includes.h" #if SPDLOG_ACTIVE_LEVEL != SPDLOG_LEVEL_DEBUG - #error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG" +#error "Invalid SPDLOG_ACTIVE_LEVEL in test. Should be SPDLOG_LEVEL_DEBUG" #endif #define TEST_FILENAME "test_logs/simple_log" diff --git a/tests/test_misc.cpp b/tests/test_misc.cpp index deb18e74..ff32fed2 100644 --- a/tests/test_misc.cpp +++ b/tests/test_misc.cpp @@ -1,5 +1,5 @@ #ifdef _WIN32 // to prevent fopen warning on windows - #define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS #endif #include "includes.h" diff --git a/tests/utils.cpp b/tests/utils.cpp index 405b5e5a..51a9b259 100644 --- a/tests/utils.cpp +++ b/tests/utils.cpp @@ -1,10 +1,10 @@ #include "includes.h" #ifdef _WIN32 - #include +#include #else - #include - #include +#include +#include #endif void prepare_logdir() {