[Spice-commits] server/red-common.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Jan 31 13:50:43 UTC 2018


 server/red-common.h |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit f34fbc15551b622ad2af8b9314acc46cf84fe876
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jan 22 16:58:28 2018 +0000

    red-common: Avoid some not used warning using clang
    
    clang reports lot of warnings like:
    
    spicevmc.c:47:1: error: unused function 'RED_CHAR_DEVICE_SPICEVMC_CLASS' [-Werror,-Wunused-function]
    SPICE_DECLARE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, CHAR_DEVICE_SPICEVMC);
    ^
    ./red-common.h:110:43: note: expanded from macro 'SPICE_DECLARE_TYPE'
        static inline ModuleObjName ## Class *G_PASTE(G_PASTE(RED_,OBJ_NAME),_CLASS)(void *klass) \
                                              ^
    
    They are all static inline function and usually should not generate
    warnings but for some reasons they do.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/red-common.h b/server/red-common.h
index 171a1877..617e42d6 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -104,17 +104,20 @@ typedef struct GListIter {
     typedef struct ModuleObjName ## Class ModuleObjName ## Class; \
     typedef struct ModuleObjName ## Private ModuleObjName ## Private; \
     GType module_obj_name ## _get_type(void) G_GNUC_CONST; \
-    static inline ModuleObjName *G_PASTE(RED_,OBJ_NAME)(void *obj) \
+    static inline SPICE_GNUC_UNUSED ModuleObjName *G_PASTE(RED_,OBJ_NAME)(void *obj) \
     { return G_TYPE_CHECK_INSTANCE_CAST(obj, \
              module_obj_name ## _get_type(), ModuleObjName); } \
-    static inline ModuleObjName ## Class *G_PASTE(G_PASTE(RED_,OBJ_NAME),_CLASS)(void *klass) \
+    static inline SPICE_GNUC_UNUSED \
+    ModuleObjName ## Class *G_PASTE(G_PASTE(RED_,OBJ_NAME),_CLASS)(void *klass) \
     { return G_TYPE_CHECK_CLASS_CAST(klass, \
              module_obj_name ## _get_type(), ModuleObjName ## Class); } \
-    static inline gboolean G_PASTE(RED_IS_,OBJ_NAME)(void *obj) \
+    static inline SPICE_GNUC_UNUSED gboolean G_PASTE(RED_IS_,OBJ_NAME)(void *obj) \
     { return G_TYPE_CHECK_INSTANCE_TYPE(obj, module_obj_name ## _get_type()); } \
-    static inline gboolean G_PASTE(G_PASTE(RED_IS_,OBJ_NAME),_CLASS)(void *klass) \
+    static inline SPICE_GNUC_UNUSED \
+    gboolean G_PASTE(G_PASTE(RED_IS_,OBJ_NAME),_CLASS)(void *klass) \
     { return G_TYPE_CHECK_CLASS_TYPE((klass), module_obj_name ## _get_type()); } \
-    static inline ModuleObjName ## Class *G_PASTE(G_PASTE(RED_,OBJ_NAME),_GET_CLASS)(void *obj) \
+    static inline SPICE_GNUC_UNUSED \
+    ModuleObjName ## Class *G_PASTE(G_PASTE(RED_,OBJ_NAME),_GET_CLASS)(void *obj) \
     { return G_TYPE_INSTANCE_GET_CLASS(obj, \
              module_obj_name ## _get_type(), ModuleObjName ## Class); }
 


More information about the Spice-commits mailing list