[Spice-commits] 3 commits - common/agent_interface.h common/backtrace.c common/log.h common/mem.c common/quic_tmpl.c common/recorder.h tests/helper-fuzzer-demarshallers.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 10 08:56:10 UTC 2020
common/agent_interface.h | 14 +++++++-------
common/backtrace.c | 3 +++
common/log.h | 24 ++++++++++++------------
common/mem.c | 6 +++---
common/quic_tmpl.c | 8 ++++----
common/recorder.h | 4 ++--
tests/helper-fuzzer-demarshallers.c | 5 +++++
7 files changed, 36 insertions(+), 28 deletions(-)
New commits:
commit 2f045752d587d197e99ec8331ae764fe33deb408
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Jun 26 11:00:47 2020 +0100
helper-fuzzer-demarshallers: Provide replacement for ftello for MSVC
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Uri Lublin <uril at redhat.com>
diff --git a/tests/helper-fuzzer-demarshallers.c b/tests/helper-fuzzer-demarshallers.c
index 1599886..c8e49ce 100644
--- a/tests/helper-fuzzer-demarshallers.c
+++ b/tests/helper-fuzzer-demarshallers.c
@@ -38,6 +38,11 @@
#include <common/demarshallers.h>
+#ifdef _MSC_VER
+typedef __int64 off_t;
+#define ftello(f) _ftelli64((f))
+#endif
+
typedef uint8_t *
spice_parse_t(uint8_t *message_start, uint8_t *message_end,
uint32_t channel, uint16_t message_type, SPICE_GNUC_UNUSED int minor,
commit b843d02a1be3caf4c08a918301762dc700f42010
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Thu Jun 18 20:12:47 2020 +0100
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 at gmail.com>
Acked-by: Uri Lublin <uril at redhat.com>
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");
commit ca1016eb155131ddb6c548a03c80cd6709515e2e
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Jun 26 10:54:58 2020 +0100
backtrace: Do not attempt to compile if spice_backtrace is empty
In backtrace.h spice_backtrace is defined as:
#if defined(WIN32) && !defined(__MINGW32__)
#define spice_backtrace()
#else
..
so don't try to compile if an empty macro is used.
Currently not causing any issue as we use MingW on Windows but
does not hurt is code is more portable.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Uri Lublin <uril at redhat.com>
diff --git a/common/backtrace.c b/common/backtrace.c
index 2136191..74c05f8 100644
--- a/common/backtrace.c
+++ b/common/backtrace.c
@@ -23,6 +23,8 @@
#include <config.h>
+#if !defined(WIN32) || defined(__MINGW32__)
+
#include "backtrace.h"
#include <errno.h>
@@ -130,3 +132,4 @@ void spice_backtrace(void)
spice_backtrace_backtrace();
}
}
+#endif
More information about the Spice-commits
mailing list