Fix variadic macro syntax

It turns out that the macros looked fine in the header, but made
gcc fall over on first use. __VA_ARGS__ is only allowed in the
replacement text.
This commit is contained in:
Matthias Clasen 2016-07-17 02:05:07 -04:00
parent 75084c990f
commit 17f48d7144

View File

@ -258,9 +258,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_debug_structured(format, __va_args__) \ #define g_debug_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \
@ -280,9 +280,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_info_structured(format, __va_args__) \ #define g_info_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \
@ -302,9 +302,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_message_structured(format, __va_args__) \ #define g_message_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \
@ -325,9 +325,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_warning_structured(format, __va_args__) \ #define g_warning_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \
@ -347,9 +347,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_critical_structured(format, __va_args__) \ #define g_critical_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \
@ -369,9 +369,9 @@ GLogWriterOutput g_log_writer_default (GLogLevelFlags log_level,
* *
* Since: 2.50 * Since: 2.50
*/ */
#define g_error_structured(format, __va_args__) \ #define g_error_structured(format, ...) \
g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
format, ##__va_args__, \ format, __VA_ARGS__, \
"CODE_FILE", G_STRINGIFY (__FILE__), \ "CODE_FILE", G_STRINGIFY (__FILE__), \
"CODE_LINE", G_STRINGIFY (__LINE__), \ "CODE_LINE", G_STRINGIFY (__LINE__), \
"CODE_FUNC", G_STRINGIFY (__FUNC__), \ "CODE_FUNC", G_STRINGIFY (__FUNC__), \