[Spice-commits] common/canvas_base.c common/lz.h common/macros.h common/quic.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 19 13:46:04 UTC 2020


 common/canvas_base.c |   12 ++++++------
 common/lz.h          |    8 ++++----
 common/macros.h      |   10 ----------
 common/quic.h        |    8 ++++----
 4 files changed, 14 insertions(+), 24 deletions(-)

New commits:
commit 5d8feeb19a110c915970acf1a15d9a6d8b8f862c
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Wed Jun 17 08:13:37 2020 +0100

    Reuse macros from spice-protocol
    
    Reuse SPICE_GNUC_NORETURN and SPICE_GNUC_PRINTF
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
    Acked-by: Julien Ropé <jrope at gmail.com>

diff --git a/common/canvas_base.c b/common/canvas_base.c
index 07b8dee..175a8a2 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -1763,8 +1763,8 @@ static pixman_image_t *canvas_scale_surface(pixman_image_t *src, const SpiceRect
     return surface;
 }
 
-SPICE_ATTR_NORETURN
-SPICE_ATTR_PRINTF(2, 3) static void quic_usr_error(QuicUsrContext *usr, const char *fmt, ...)
+SPICE_GNUC_NORETURN
+SPICE_GNUC_PRINTF(2, 3) static void quic_usr_error(QuicUsrContext *usr, const char *fmt, ...)
 {
     QuicData *usr_data = (QuicData *)usr;
     va_list ap;
@@ -1776,7 +1776,7 @@ SPICE_ATTR_PRINTF(2, 3) static void quic_usr_error(QuicUsrContext *usr, const ch
     longjmp(usr_data->jmp_env, 1);
 }
 
-SPICE_ATTR_PRINTF(2, 3) static void quic_usr_warn(QuicUsrContext *usr, const char *fmt, ...)
+SPICE_GNUC_PRINTF(2, 3) static void quic_usr_warn(QuicUsrContext *usr, const char *fmt, ...)
 {
     QuicData *usr_data = (QuicData *)usr;
     va_list ap;
@@ -1796,7 +1796,7 @@ static void quic_usr_free(QuicUsrContext *usr, void *ptr)
     free(ptr);
 }
 
-SPICE_ATTR_PRINTF(2, 3) static void lz_usr_warn(LzUsrContext *usr, const char *fmt, ...)
+SPICE_GNUC_PRINTF(2, 3) static void lz_usr_warn(LzUsrContext *usr, const char *fmt, ...)
 {
     LzData *usr_data = (LzData *)usr;
     va_list ap;
@@ -1806,8 +1806,8 @@ SPICE_ATTR_PRINTF(2, 3) static void lz_usr_warn(LzUsrContext *usr, const char *f
     va_end(ap);
 }
 
-SPICE_ATTR_NORETURN
-SPICE_ATTR_PRINTF(2, 3) static void lz_usr_error(LzUsrContext *usr, const char *fmt, ...)
+SPICE_GNUC_NORETURN
+SPICE_GNUC_PRINTF(2, 3) static void lz_usr_error(LzUsrContext *usr, const char *fmt, ...)
 {
     LzData *usr_data = (LzData *)usr;
     va_list ap;
diff --git a/common/lz.h b/common/lz.h
index 9acffea..388eda0 100644
--- a/common/lz.h
+++ b/common/lz.h
@@ -19,10 +19,10 @@ typedef void *LzContext;
 
 typedef struct LzUsrContext LzUsrContext;
 struct LzUsrContext {
-    SPICE_ATTR_NORETURN
-    SPICE_ATTR_PRINTF(2, 3) void (*error)(LzUsrContext *usr, const char *fmt, ...);
-    SPICE_ATTR_PRINTF(2, 3) void (*warn)(LzUsrContext *usr, const char *fmt, ...);
-    SPICE_ATTR_PRINTF(2, 3) void (*info)(LzUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_NORETURN
+    SPICE_GNUC_PRINTF(2, 3) void (*error)(LzUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*warn)(LzUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*info)(LzUsrContext *usr, const char *fmt, ...);
     void    *(*malloc)(LzUsrContext *usr, int size);
     void (*free)(LzUsrContext *usr, void *ptr);
     int (*more_space)(LzUsrContext *usr, uint8_t **io_ptr);     // get the next chunk of the
diff --git a/common/macros.h b/common/macros.h
index 92cd82c..01765ab 100644
--- a/common/macros.h
+++ b/common/macros.h
@@ -21,16 +21,6 @@
 
 #include "verify.h"
 
-#if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
-#define SPICE_ATTR_NORETURN                                  \
-    __attribute__((noreturn))
-#define SPICE_ATTR_PRINTF(a,b)                               \
-    __attribute__((format(printf,a,b)))
-#else
-#define SPICE_ATTR_NORETURN
-#define SPICE_ATTR_PRINTF
-#endif /* __GNUC__ */
-
 #ifdef __GNUC__
 #define SPICE_CONSTRUCTOR_FUNC(func_name) \
     static void __attribute__((constructor)) func_name(void)
diff --git a/common/quic.h b/common/quic.h
index 42fc3f8..4bfe927 100644
--- a/common/quic.h
+++ b/common/quic.h
@@ -40,10 +40,10 @@ typedef void *QuicContext;
 
 typedef struct QuicUsrContext QuicUsrContext;
 struct QuicUsrContext {
-    SPICE_ATTR_NORETURN
-    SPICE_ATTR_PRINTF(2, 3) void (*error)(QuicUsrContext *usr, const char *fmt, ...);
-    SPICE_ATTR_PRINTF(2, 3) void (*warn)(QuicUsrContext *usr, const char *fmt, ...);
-    SPICE_ATTR_PRINTF(2, 3) void (*info)(QuicUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_NORETURN
+    SPICE_GNUC_PRINTF(2, 3) void (*error)(QuicUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*warn)(QuicUsrContext *usr, const char *fmt, ...);
+    SPICE_GNUC_PRINTF(2, 3) void (*info)(QuicUsrContext *usr, const char *fmt, ...);
     void *(*malloc)(QuicUsrContext *usr, int size);
     void (*free)(QuicUsrContext *usr, void *ptr);
     int (*more_space)(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed);


More information about the Spice-commits mailing list