indent: use 'AlignEscapedNewlines: Right' to put backslashed in macros at ends of lines

This commit is contained in:
Robert Swiecki 2023-09-22 16:43:40 +02:00
parent d1b74c2238
commit 275de833ba
4 changed files with 44 additions and 44 deletions

View File

@ -100,7 +100,7 @@ depend: all
.PHONY: indent .PHONY: indent
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) clang-format -style="{BasedOnStyle: google, IndentWidth: 4, UseTab: Always, ColumnLimit: 100}" -i $(SRCS_PROTO)
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

62
logs.h
View File

@ -30,49 +30,49 @@
namespace logs { namespace logs {
#define LOG_HELP(...) logs::logMsg(logs::HELP, __FUNCTION__, __LINE__, false, __VA_ARGS__); #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__); logs::logMsg(logs::HELP_BOLD, __FUNCTION__, __LINE__, false, __VA_ARGS__);
#define LOG_D(...) \ #define LOG_D(...) \
if (logs::getLogLevel() <= logs::DEBUG) { \ if (logs::getLogLevel() <= logs::DEBUG) { \
logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, false, __VA_ARGS__); \
} }
#define LOG_I(...) \ #define LOG_I(...) \
if (logs::getLogLevel() <= logs::INFO) { \ if (logs::getLogLevel() <= logs::INFO) { \
logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, false, __VA_ARGS__); \
} }
#define LOG_W(...) \ #define LOG_W(...) \
if (logs::getLogLevel() <= logs::WARNING) { \ if (logs::getLogLevel() <= logs::WARNING) { \
logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, false, __VA_ARGS__); \
} }
#define LOG_E(...) \ #define LOG_E(...) \
if (logs::getLogLevel() <= logs::ERROR) { \ if (logs::getLogLevel() <= logs::ERROR) { \
logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, false, __VA_ARGS__); \
} }
#define LOG_F(...) \ #define LOG_F(...) \
if (logs::getLogLevel() <= logs::FATAL) { \ if (logs::getLogLevel() <= logs::FATAL) { \
logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, false, __VA_ARGS__); \ logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, false, __VA_ARGS__); \
} }
#define PLOG_D(...) \ #define PLOG_D(...) \
if (logs::getLogLevel() <= logs::DEBUG) { \ if (logs::getLogLevel() <= logs::DEBUG) { \
logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ logs::logMsg(logs::DEBUG, __FUNCTION__, __LINE__, true, __VA_ARGS__); \
} }
#define PLOG_I(...) \ #define PLOG_I(...) \
if (logs::getLogLevel() <= logs::INFO) { \ if (logs::getLogLevel() <= logs::INFO) { \
logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ logs::logMsg(logs::INFO, __FUNCTION__, __LINE__, true, __VA_ARGS__); \
} }
#define PLOG_W(...) \ #define PLOG_W(...) \
if (logs::getLogLevel() <= logs::WARNING) { \ if (logs::getLogLevel() <= logs::WARNING) { \
logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ logs::logMsg(logs::WARNING, __FUNCTION__, __LINE__, true, __VA_ARGS__); \
} }
#define PLOG_E(...) \ #define PLOG_E(...) \
if (logs::getLogLevel() <= logs::ERROR) { \ if (logs::getLogLevel() <= logs::ERROR) { \
logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ logs::logMsg(logs::ERROR, __FUNCTION__, __LINE__, true, __VA_ARGS__); \
} }
#define PLOG_F(...) \ #define PLOG_F(...) \
if (logs::getLogLevel() <= logs::FATAL) { \ if (logs::getLogLevel() <= logs::FATAL) { \
logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, true, __VA_ARGS__); \ logs::logMsg(logs::FATAL, __FUNCTION__, __LINE__, true, __VA_ARGS__); \
} }
enum llevel_t { enum llevel_t {

View File

@ -25,12 +25,12 @@
#include <unistd.h> #include <unistd.h>
#if !defined(TEMP_FAILURE_RETRY) #if !defined(TEMP_FAILURE_RETRY)
#define TEMP_FAILURE_RETRY(expression) \ #define TEMP_FAILURE_RETRY(expression) \
(__extension__({ \ (__extension__({ \
long int __result; \ long int __result; \
do __result = (long int)(expression); \ do __result = (long int)(expression); \
while (__result == -1L && errno == EINTR); \ while (__result == -1L && errno == EINTR); \
__result; \ __result; \
})) }))
#endif /* !defined(TEMP_FAILURE_RETRY) */ #endif /* !defined(TEMP_FAILURE_RETRY) */
@ -38,7 +38,7 @@
#define ARR_SZ(array) (sizeof(array) / sizeof(*array)) #define ARR_SZ(array) (sizeof(array) / sizeof(*array))
#endif /* !defined(ARR_SZ) */ #endif /* !defined(ARR_SZ) */
#define NS_VALSTR_STRUCT(x) \ #define NS_VALSTR_STRUCT(x) \
{ (uint64_t) x, #x } { (uint64_t) x, #x }
#endif /* NS_COMMON_H */ #endif /* NS_COMMON_H */

10
util.h
View File

@ -32,11 +32,11 @@
#include "nsjail.h" #include "nsjail.h"
#define RETURN_ON_FAILURE(expr) \ #define RETURN_ON_FAILURE(expr) \
do { \ do { \
if (!(expr)) { \ if (!(expr)) { \
return false; \ return false; \
} \ } \
} while (0) } while (0)
#define QC(x) (util::StrQuote(x).c_str()) #define QC(x) (util::StrQuote(x).c_str())