From 275de833ba76f3f2e32358a4d209b682df45517c Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Fri, 22 Sep 2023 16:43:40 +0200 Subject: [PATCH] indent: use 'AlignEscapedNewlines: Right' to put backslashed in macros at ends of lines --- Makefile | 2 +- logs.h | 62 ++++++++++++++++++++++++++++---------------------------- macros.h | 14 ++++++------- util.h | 10 ++++----- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index e4b2305..fb89dac 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ depend: all .PHONY: indent indent: - clang-format -style="{BasedOnStyle: google, IndentWidth: 8, UseTab: Always, IndentCaseLabels: false, ColumnLimit: 100, AlignAfterOpenBracket: false, AllowShortFunctionsOnASingleLine: false, AlwaysBreakBeforeMultilineStrings: false}" -i -sort-includes $(SRCS_H) $(SRCS_CXX) + clang-format -style="{BasedOnStyle: google, IndentWidth: 8, UseTab: Always, IndentCaseLabels: false, ColumnLimit: 100, AlignAfterOpenBracket: false, AllowShortFunctionsOnASingleLine: false, AlwaysBreakBeforeMultilineStrings: false, AlignEscapedNewlines: Right}" -i -sort-includes $(SRCS_H) $(SRCS_CXX) clang-format -style="{BasedOnStyle: google, IndentWidth: 4, UseTab: Always, ColumnLimit: 100}" -i $(SRCS_PROTO) # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/logs.h b/logs.h index 00077bb..051fb95 100644 --- a/logs.h +++ b/logs.h @@ -30,49 +30,49 @@ namespace logs { #define LOG_HELP(...) logs::logMsg(logs::HELP, __FUNCTION__, __LINE__, false, __VA_ARGS__); -#define LOG_HELP_BOLD(...) \ +#define LOG_HELP_BOLD(...) \ logs::logMsg(logs::HELP_BOLD, __FUNCTION__, __LINE__, false, __VA_ARGS__); -#define LOG_D(...) \ - if (logs::getLogLevel() <= logs::DEBUG) { \ - logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ +#define LOG_D(...) \ + if (logs::getLogLevel() <= logs::DEBUG) { \ + logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ } -#define LOG_I(...) \ - if (logs::getLogLevel() <= logs::INFO) { \ - logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ +#define LOG_I(...) \ + if (logs::getLogLevel() <= logs::INFO) { \ + logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ } -#define LOG_W(...) \ - if (logs::getLogLevel() <= logs::WARNING) { \ - logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ +#define LOG_W(...) \ + if (logs::getLogLevel() <= logs::WARNING) { \ + logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ } -#define LOG_E(...) \ - if (logs::getLogLevel() <= logs::ERROR) { \ - logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ +#define LOG_E(...) \ + if (logs::getLogLevel() <= logs::ERROR) { \ + logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ } -#define LOG_F(...) \ - if (logs::getLogLevel() <= logs::FATAL) { \ - logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ +#define LOG_F(...) \ + if (logs::getLogLevel() <= logs::FATAL) { \ + logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ } -#define PLOG_D(...) \ - if (logs::getLogLevel() <= logs::DEBUG) { \ - logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ +#define PLOG_D(...) \ + if (logs::getLogLevel() <= logs::DEBUG) { \ + logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ } -#define PLOG_I(...) \ - if (logs::getLogLevel() <= logs::INFO) { \ - logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ +#define PLOG_I(...) \ + if (logs::getLogLevel() <= logs::INFO) { \ + logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ } -#define PLOG_W(...) \ - if (logs::getLogLevel() <= logs::WARNING) { \ - logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ +#define PLOG_W(...) \ + if (logs::getLogLevel() <= logs::WARNING) { \ + logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ } -#define PLOG_E(...) \ - if (logs::getLogLevel() <= logs::ERROR) { \ - logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ +#define PLOG_E(...) \ + if (logs::getLogLevel() <= logs::ERROR) { \ + logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ } -#define PLOG_F(...) \ - if (logs::getLogLevel() <= logs::FATAL) { \ - logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ +#define PLOG_F(...) \ + if (logs::getLogLevel() <= logs::FATAL) { \ + logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ } enum llevel_t { diff --git a/macros.h b/macros.h index d25ff33..ea295ef 100644 --- a/macros.h +++ b/macros.h @@ -25,12 +25,12 @@ #include #if !defined(TEMP_FAILURE_RETRY) -#define TEMP_FAILURE_RETRY(expression) \ - (__extension__({ \ - long int __result; \ - do __result = (long int)(expression); \ - while (__result == -1L && errno == EINTR); \ - __result; \ +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__({ \ + long int __result; \ + do __result = (long int)(expression); \ + while (__result == -1L && errno == EINTR); \ + __result; \ })) #endif /* !defined(TEMP_FAILURE_RETRY) */ @@ -38,7 +38,7 @@ #define ARR_SZ(array) (sizeof(array) / sizeof(*array)) #endif /* !defined(ARR_SZ) */ -#define NS_VALSTR_STRUCT(x) \ +#define NS_VALSTR_STRUCT(x) \ { (uint64_t) x, #x } #endif /* NS_COMMON_H */ diff --git a/util.h b/util.h index 821d0e3..b0f401a 100644 --- a/util.h +++ b/util.h @@ -32,11 +32,11 @@ #include "nsjail.h" -#define RETURN_ON_FAILURE(expr) \ - do { \ - if (!(expr)) { \ - return false; \ - } \ +#define RETURN_ON_FAILURE(expr) \ + do { \ + if (!(expr)) { \ + return false; \ + } \ } while (0) #define QC(x) (util::StrQuote(x).c_str())