Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /intern/clog/CLG_log.h
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/clog/CLG_log.h')
-rw-r--r--intern/clog/CLG_log.h144
1 files changed, 80 insertions, 64 deletions
diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h
index 810997ac78b..1d78c401924 100644
--- a/intern/clog/CLG_log.h
+++ b/intern/clog/CLG_log.h
@@ -73,13 +73,14 @@ extern "C" {
#endif /* __cplusplus */
#ifdef __GNUC__
-# define _CLOG_ATTR_NONNULL(args ...) __attribute__((nonnull(args)))
+# define _CLOG_ATTR_NONNULL(args...) __attribute__((nonnull(args)))
#else
# define _CLOG_ATTR_NONNULL(...)
#endif
#ifdef __GNUC__
-# define _CLOG_ATTR_PRINTF_FORMAT(format_param, dots_param) __attribute__((format(printf, format_param, dots_param)))
+# define _CLOG_ATTR_PRINTF_FORMAT(format_param, dots_param) \
+ __attribute__((format(printf, format_param, dots_param)))
#else
# define _CLOG_ATTR_PRINTF_FORMAT(format_param, dots_param)
#endif
@@ -92,41 +93,44 @@ struct CLogContext;
/* Don't typedef enums. */
enum CLG_LogFlag {
- CLG_FLAG_USE = (1 << 0),
+ CLG_FLAG_USE = (1 << 0),
};
enum CLG_Severity {
- CLG_SEVERITY_INFO = 0,
- CLG_SEVERITY_WARN,
- CLG_SEVERITY_ERROR,
- CLG_SEVERITY_FATAL,
+ CLG_SEVERITY_INFO = 0,
+ CLG_SEVERITY_WARN,
+ CLG_SEVERITY_ERROR,
+ CLG_SEVERITY_FATAL,
};
#define CLG_SEVERITY_LEN (CLG_SEVERITY_FATAL + 1)
/* Each logger ID has one of these. */
typedef struct CLG_LogType {
- struct CLG_LogType *next;
- char identifier[64];
- /** FILE output. */
- struct CLogContext *ctx;
- /** Control behavior. */
- int level;
- enum CLG_LogFlag flag;
+ struct CLG_LogType *next;
+ char identifier[64];
+ /** FILE output. */
+ struct CLogContext *ctx;
+ /** Control behavior. */
+ int level;
+ enum CLG_LogFlag flag;
} CLG_LogType;
typedef struct CLG_LogRef {
- const char *identifier;
- CLG_LogType *type;
+ const char *identifier;
+ CLG_LogType *type;
} CLG_LogRef;
-void CLG_log_str(
- CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn,
- const char *message)
- _CLOG_ATTR_NONNULL(1, 3, 4, 5);
-void CLG_logf(
- CLG_LogType *lg, enum CLG_Severity severity, const char *file_line, const char *fn,
- const char *format, ...)
- _CLOG_ATTR_NONNULL(1, 3, 4, 5) _CLOG_ATTR_PRINTF_FORMAT(5, 6);
+void CLG_log_str(CLG_LogType *lg,
+ enum CLG_Severity severity,
+ const char *file_line,
+ const char *fn,
+ const char *message) _CLOG_ATTR_NONNULL(1, 3, 4, 5);
+void CLG_logf(CLG_LogType *lg,
+ enum CLG_Severity severity,
+ const char *file_line,
+ const char *fn,
+ const char *format,
+ ...) _CLOG_ATTR_NONNULL(1, 3, 4, 5) _CLOG_ATTR_PRINTF_FORMAT(5, 6);
/* Main initializer and distructor (per session, not logger). */
void CLG_init(void);
@@ -147,51 +151,63 @@ void CLG_logref_init(CLG_LogRef *clg_ref);
/** Declare outside function, declare as extern in header. */
#define CLG_LOGREF_DECLARE_GLOBAL(var, id) \
- static CLG_LogRef _static_ ## var = {id}; \
- CLG_LogRef *var = &_static_ ## var
+ static CLG_LogRef _static_##var = {id}; \
+ CLG_LogRef *var = &_static_##var
/** Initialize struct once. */
#define CLOG_ENSURE(clg_ref) \
- ((clg_ref)->type ? (clg_ref)->type : (CLG_logref_init(clg_ref), (clg_ref)->type))
-
-#define CLOG_AT_SEVERITY(clg_ref, severity, verbose_level, ...) { \
- CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
- if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || (severity >= CLG_SEVERITY_WARN)) { \
- CLG_logf(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
- } \
-} ((void)0)
-
-#define CLOG_STR_AT_SEVERITY(clg_ref, severity, verbose_level, str) { \
- CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
- if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || (severity >= CLG_SEVERITY_WARN)) { \
- CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, str); \
- } \
-} ((void)0)
-
-#define CLOG_STR_AT_SEVERITY_N(clg_ref, severity, verbose_level, str) { \
- CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
- if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || (severity >= CLG_SEVERITY_WARN)) { \
- const char *_str = str; \
- CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, _str); \
- MEM_freeN((void *)_str); \
- } \
-} ((void)0)
-
-#define CLOG_INFO(clg_ref, level, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, __VA_ARGS__)
-#define CLOG_WARN(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, __VA_ARGS__)
-#define CLOG_ERROR(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, __VA_ARGS__)
-#define CLOG_FATAL(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, __VA_ARGS__)
-
-#define CLOG_STR_INFO(clg_ref, level, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, str)
-#define CLOG_STR_WARN(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, str)
-#define CLOG_STR_ERROR(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, str)
-#define CLOG_STR_FATAL(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, str)
+ ((clg_ref)->type ? (clg_ref)->type : (CLG_logref_init(clg_ref), (clg_ref)->type))
+
+#define CLOG_AT_SEVERITY(clg_ref, severity, verbose_level, ...) \
+ { \
+ CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
+ if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
+ (severity >= CLG_SEVERITY_WARN)) { \
+ CLG_logf(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
+ } \
+ } \
+ ((void)0)
+
+#define CLOG_STR_AT_SEVERITY(clg_ref, severity, verbose_level, str) \
+ { \
+ CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
+ if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
+ (severity >= CLG_SEVERITY_WARN)) { \
+ CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, str); \
+ } \
+ } \
+ ((void)0)
+
+#define CLOG_STR_AT_SEVERITY_N(clg_ref, severity, verbose_level, str) \
+ { \
+ CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
+ if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
+ (severity >= CLG_SEVERITY_WARN)) { \
+ const char *_str = str; \
+ CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, _str); \
+ MEM_freeN((void *)_str); \
+ } \
+ } \
+ ((void)0)
+
+#define CLOG_INFO(clg_ref, level, ...) \
+ CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, __VA_ARGS__)
+#define CLOG_WARN(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, __VA_ARGS__)
+#define CLOG_ERROR(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, __VA_ARGS__)
+#define CLOG_FATAL(clg_ref, ...) CLOG_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, __VA_ARGS__)
+
+#define CLOG_STR_INFO(clg_ref, level, str) \
+ CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_INFO, level, str)
+#define CLOG_STR_WARN(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_WARN, 0, str)
+#define CLOG_STR_ERROR(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_ERROR, 0, str)
+#define CLOG_STR_FATAL(clg_ref, str) CLOG_STR_AT_SEVERITY(clg_ref, CLG_SEVERITY_FATAL, 0, str)
/* Allocated string which is immediately freed. */
-#define CLOG_STR_INFO_N(clg_ref, level, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_INFO, level, str)
-#define CLOG_STR_WARN_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_WARN, 0, str)
-#define CLOG_STR_ERROR_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_ERROR, 0, str)
-#define CLOG_STR_FATAL_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_FATAL, 0, str)
+#define CLOG_STR_INFO_N(clg_ref, level, str) \
+ CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_INFO, level, str)
+#define CLOG_STR_WARN_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_WARN, 0, str)
+#define CLOG_STR_ERROR_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_ERROR, 0, str)
+#define CLOG_STR_FATAL_N(clg_ref, str) CLOG_STR_AT_SEVERITY_N(clg_ref, CLG_SEVERITY_FATAL, 0, str)
#ifdef __cplusplus
}