summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2020-06-18 20:12:47 +0100
committerFrediano Ziglio <freddy77@gmail.com>2020-08-10 09:55:27 +0100
commitb843d02a1be3caf4c08a918301762dc700f42010 (patch)
treee57995ae401538bbc232826deb07d974f71a3b82
parentca1016eb155131ddb6c548a03c80cd6709515e2e (diff)
Avoid usage of GCC extension for __VA_ARGS__ where possible
The "##" before __VA_ARGS__ is a GCC extension. Try to limit its usage where necessary. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
-rw-r--r--common/agent_interface.h14
-rw-r--r--common/log.h24
-rw-r--r--common/mem.c6
-rw-r--r--common/quic_tmpl.c8
-rw-r--r--common/recorder.h4
5 files changed, 28 insertions, 28 deletions
diff --git a/common/agent_interface.h b/common/agent_interface.h
index ce5b8d9..fdb9b5f 100644
--- a/common/agent_interface.h
+++ b/common/agent_interface.h
@@ -216,12 +216,12 @@ typedef struct SpiceEmptyStruct {
#define record(Name, ...) RECORD_MACRO(Name, __VA_ARGS__)
#define RECORD(Name,...) RECORD_MACRO(Name, __VA_ARGS__)
-#define RECORD_MACRO(Name, Format,...) \
- RECORD_(RECORD,RECORD_COUNT_(__VA_ARGS__),Name,Format,##__VA_ARGS__)
-#define RECORD_(RECORD,RCOUNT,Name,Format,...) \
- RECORD__(RECORD,RCOUNT,Name,Format,## __VA_ARGS__)
-#define RECORD__(RECORD,RCOUNT,Name,Format,...) \
- RECORD##RCOUNT(Name,Format,##__VA_ARGS__)
+#define RECORD_MACRO(Name, ...) \
+ RECORD_(RECORD,RECORD_COUNT_(__VA_ARGS__),Name,__VA_ARGS__)
+#define RECORD_(RECORD,RCOUNT,Name,...) \
+ RECORD__(RECORD,RCOUNT,Name,__VA_ARGS__)
+#define RECORD__(RECORD,RCOUNT,Name,...) \
+ RECORD##RCOUNT(Name,__VA_ARGS__)
#define RECORD_COUNT_(...) RECORD_COUNT__(Dummy,##__VA_ARGS__,_X,_X,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,_0)
#define RECORD_COUNT__(Dummy,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_N,...) _N
@@ -368,7 +368,7 @@ typedef struct SpiceEmptyStruct {
RECORDER_ARG(j), \
RECORDER_ARG(k), \
RECORDER_ARG(l))
-#define RECORD_X(Name, Format, ...) RECORD_TOO_MANY_ARGS(printf(Format, __VA_ARGS__))
+#define RECORD_X(Name, ...) RECORD_TOO_MANY_ARGS(printf(__VA_ARGS__))
// Some ugly macro drudgery to make things easy to use. Adjust type.
diff --git a/common/log.h b/common/log.h
index f38e80e..714e916 100644
--- a/common/log.h
+++ b/common/log.h
@@ -59,26 +59,26 @@ void spice_log(GLogLevelFlags log_level,
spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "should not be reached"); \
} G_STMT_END
-#define spice_info(format, ...) G_STMT_START { \
- spice_log(G_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
+#define spice_info(...) G_STMT_START { \
+ spice_log(G_LOG_LEVEL_INFO, SPICE_STRLOC, __FUNCTION__, "" __VA_ARGS__); \
} G_STMT_END
-#define spice_debug(format, ...) G_STMT_START { \
- spice_log(G_LOG_LEVEL_DEBUG, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
+#define spice_debug(...) G_STMT_START { \
+ spice_log(G_LOG_LEVEL_DEBUG, SPICE_STRLOC, __FUNCTION__, "" __VA_ARGS__); \
} G_STMT_END
-#define spice_warning(format, ...) G_STMT_START { \
- spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
+#define spice_warning(...) G_STMT_START { \
+ spice_log(G_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "" __VA_ARGS__); \
} G_STMT_END
-#define spice_critical(format, ...) G_STMT_START { \
- spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
- SPICE_UNREACHABLE; \
+#define spice_critical(...) G_STMT_START { \
+ spice_log(G_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "" __VA_ARGS__); \
+ SPICE_UNREACHABLE; \
} G_STMT_END
-#define spice_error(format, ...) G_STMT_START { \
- spice_log(G_LOG_LEVEL_ERROR, SPICE_STRLOC, __FUNCTION__, "" format, ## __VA_ARGS__); \
- SPICE_UNREACHABLE; \
+#define spice_error(...) G_STMT_START { \
+ spice_log(G_LOG_LEVEL_ERROR, SPICE_STRLOC, __FUNCTION__, "" __VA_ARGS__); \
+ SPICE_UNREACHABLE; \
} G_STMT_END
#define spice_warn_if_fail(x) G_STMT_START { \
diff --git a/common/mem.c b/common/mem.c
index 8d7ed1e..f9543b7 100644
--- a/common/mem.c
+++ b/common/mem.c
@@ -22,9 +22,9 @@
#include <string.h>
#ifndef MALLOC_ERROR
-#define MALLOC_ERROR(format, ...) SPICE_STMT_START { \
- spice_error(format, ## __VA_ARGS__); \
- abort(); \
+#define MALLOC_ERROR(...) SPICE_STMT_START { \
+ spice_error(__VA_ARGS__); \
+ abort(); \
} SPICE_STMT_END
#endif
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index f0a4927..7c999f1 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -20,8 +20,8 @@
#define COMPRESS_IMP
#if defined(ONE_BYTE) || defined(FOUR_BYTE)
-# define FARGS_DECL(arg1, ...) (Encoder *encoder, Channel *channel_a, arg1, ##__VA_ARGS__)
-# define FARGS_CALL(arg1, ...) (encoder, channel_a, arg1, ##__VA_ARGS__)
+# define FARGS_DECL(...) (Encoder *encoder, Channel *channel_a, __VA_ARGS__)
+# define FARGS_CALL(...) (encoder, channel_a, __VA_ARGS__)
# define UNCOMPRESS_PIX_START(row) do { } while (0)
# define SET_a(pix, val) ((pix)->a = val)
# define GET_a(pix) ((pix)->a)
@@ -35,8 +35,8 @@
# define APPLY_ALL_COMP(macro, ...) \
macro(a, ## __VA_ARGS__)
#else
-# define FARGS_DECL(arg1, ...) (Encoder *encoder, arg1, ##__VA_ARGS__)
-# define FARGS_CALL(arg1, ...) (encoder, arg1, ##__VA_ARGS__)
+# define FARGS_DECL(...) (Encoder *encoder, __VA_ARGS__)
+# define FARGS_CALL(...) (encoder, __VA_ARGS__)
# define SAME_PIXEL(p1, p2) \
(GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \
GET_b(p1) == GET_b(p2))
diff --git a/common/recorder.h b/common/recorder.h
index 61aa759..62230cc 100644
--- a/common/recorder.h
+++ b/common/recorder.h
@@ -62,8 +62,8 @@ typedef struct SpiceDummyTweak {
const SpiceDummyTweak spice_recorder_tweak_ ## rec = { (value) }
#define RECORDER_TWEAK(rec) \
((spice_recorder_tweak_ ## rec).tweak_value)
-#define RECORD(rec, format, ...) do { \
- if (sizeof((spice_recorder_ ## rec).dummy)) printf(format, ##__VA_ARGS__); \
+#define RECORD(rec, ...) do { \
+ if (sizeof((spice_recorder_ ## rec).dummy)) printf(__VA_ARGS__); \
} while(0)
#define RECORD_TIMING_BEGIN(rec) \
do { RECORD(rec, "begin");