From 070dd181df89bbdcb26e344c21ede5bc857f555d Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 31 Oct 2022 17:09:45 +0200 Subject: [PATCH] clang format --- example/example.cpp | 5 ++--- include/spdlog/details/periodic_worker.h | 3 ++- include/spdlog/spdlog.h | 5 +++-- tests/includes.h | 11 +++++------ tests/main.cpp | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index b348afb9..f7b4572b 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -262,13 +262,12 @@ struct my_type : i(i){}; }; - // Using a namespace alias like fmt_lib is not allowed when extending an existing namespace, // but the correct namespace can still be selected with the SPDLOG_USE_STD_FORMAT macro. #ifdef SPDLOG_USE_STD_FORMAT - namespace std { +namespace std { #else - namespace fmt { +namespace fmt { #endif template<> struct formatter : formatter diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h index 919ba7ed..d7d69b28 100644 --- a/include/spdlog/details/periodic_worker.h +++ b/include/spdlog/details/periodic_worker.h @@ -21,7 +21,8 @@ class SPDLOG_API periodic_worker { public: template - periodic_worker(const std::function &callback_fun, std::chrono::duration interval) { + periodic_worker(const std::function &callback_fun, std::chrono::duration interval) + { active_ = (interval > std::chrono::duration::zero()); if (!active_) { diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 40c2bcad..ee83e8de 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -293,9 +293,10 @@ 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 diff --git a/tests/includes.h b/tests/includes.h index 155ae78d..16394440 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -1,13 +1,12 @@ #pragma once - -#if defined (__GNUC__) && __GNUC__ == 12 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#if defined(__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 #endif #include "catch.hpp" -#if defined (__GNUC__) && __GNUC__ == 12 -# pragma GCC diagnostic pop +#if defined(__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic pop #endif #include "utils.h" diff --git a/tests/main.cpp b/tests/main.cpp index 4f0be406..f8ed5192 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,11 +1,11 @@ -#if defined (__GNUC__) && __GNUC__ == 12 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#if defined(__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 #endif #define CATCH_CONFIG_MAIN #include "catch.hpp" -#if defined (__GNUC__) && __GNUC__ == 12 -# pragma GCC diagnostic pop +#if defined(__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic pop #endif