mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-30 05:39:12 +02:00
Allow *RETURN*() macros to accept struct initializers.
Struct initializers look like multiple parameters in a macro so use __VA_ARGS__ to reconstruct them.
This commit is contained in:
parent
ea4d73f375
commit
e18b70bf55
@ -215,10 +215,10 @@ size_t typeToLog(const char *typeName, char *buffer, size_t bufferSize);
|
||||
/***********************************************************************************************************************************
|
||||
Macros to return function results (or void)
|
||||
***********************************************************************************************************************************/
|
||||
#define FUNCTION_LOG_RETURN_BASE(typePre, typeMacroPrefix, typePost, result) \
|
||||
#define FUNCTION_LOG_RETURN_BASE(typePre, typeMacroPrefix, typePost, ...) \
|
||||
do \
|
||||
{ \
|
||||
typePre FUNCTION_LOG_##typeMacroPrefix##_TYPE typePost FUNCTION_LOG_RETURN_result = result; \
|
||||
typePre FUNCTION_LOG_##typeMacroPrefix##_TYPE typePost FUNCTION_LOG_RETURN_result = __VA_ARGS__; \
|
||||
\
|
||||
STACK_TRACE_POP(false); \
|
||||
\
|
||||
@ -234,25 +234,25 @@ Macros to return function results (or void)
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define FUNCTION_LOG_RETURN(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, , result)
|
||||
#define FUNCTION_LOG_RETURN(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, , __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_P(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, *, result)
|
||||
#define FUNCTION_LOG_RETURN_P(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, *, __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_PP(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, **, result)
|
||||
#define FUNCTION_LOG_RETURN_PP(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(, typeMacroPrefix, **, __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_CONST(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, , result)
|
||||
#define FUNCTION_LOG_RETURN_CONST(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, , __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_CONST_P(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, *, result)
|
||||
#define FUNCTION_LOG_RETURN_CONST_P(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, *, __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_CONST_PP(typeMacroPrefix, result) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, **, result)
|
||||
#define FUNCTION_LOG_RETURN_CONST_PP(typeMacroPrefix, ...) \
|
||||
FUNCTION_LOG_RETURN_BASE(const, typeMacroPrefix, **, __VA_ARGS__)
|
||||
|
||||
#define FUNCTION_LOG_RETURN_STRUCT(result) \
|
||||
#define FUNCTION_LOG_RETURN_STRUCT(...) \
|
||||
do \
|
||||
{ \
|
||||
STACK_TRACE_POP(false); \
|
||||
@ -260,7 +260,7 @@ Macros to return function results (or void)
|
||||
IF_LOG_ANY(FUNCTION_LOG_LEVEL()) \
|
||||
LOG_FMT(FUNCTION_LOG_LEVEL(), 0, "=> struct"); \
|
||||
\
|
||||
return result; \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@ -327,14 +327,14 @@ Ignore DEBUG_TEST_TRACE_MACRO if DEBUG is not defined because the underlying fun
|
||||
FUNCTION_TEST_BEGIN(); \
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
#define FUNCTION_TEST_RETURN(result) \
|
||||
#define FUNCTION_TEST_RETURN(...) \
|
||||
do \
|
||||
{ \
|
||||
/* CHECK for presense of FUNCTION_TEST_BEGIN*() */ \
|
||||
(void)FUNCTION_TEST_BEGIN_exists; \
|
||||
\
|
||||
STACK_TRACE_POP(true); \
|
||||
return result; \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@ -355,8 +355,8 @@ Ignore DEBUG_TEST_TRACE_MACRO if DEBUG is not defined because the underlying fun
|
||||
#define FUNCTION_TEST_PARAM_PP(typeMacroPrefix, param)
|
||||
#define FUNCTION_TEST_END()
|
||||
#define FUNCTION_TEST_VOID()
|
||||
#define FUNCTION_TEST_RETURN(result) \
|
||||
return result
|
||||
#define FUNCTION_TEST_RETURN(...) \
|
||||
return __VA_ARGS__
|
||||
#define FUNCTION_TEST_RETURN_VOID() \
|
||||
return
|
||||
#endif // DEBUG_TEST_TRACE_MACRO
|
||||
|
@ -50,11 +50,11 @@ C Debug Harness
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define FUNCTION_HARNESS_RETURN(typeMacroPrefix, result) \
|
||||
#define FUNCTION_HARNESS_RETURN(typeMacroPrefix, ...) \
|
||||
do \
|
||||
{ \
|
||||
STACK_TRACE_POP(false); \
|
||||
return result; \
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@ -71,8 +71,8 @@ C Debug Harness
|
||||
#define FUNCTION_HARNESS_VOID()
|
||||
#define FUNCTION_HARNESS_ASSERT(condition)
|
||||
|
||||
#define FUNCTION_HARNESS_RETURN(typeMacroPrefix, result) \
|
||||
return result
|
||||
#define FUNCTION_HARNESS_RETURN(typeMacroPrefix, ...) \
|
||||
return __VA_ARGS__
|
||||
|
||||
#define FUNCTION_HARNESS_RETURN_VOID();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user