[Spice-devel] [PATCH spice-server 07/10] red-common: Avoid some not used warning using clang

Victor Toso victortoso at redhat.com
Wed Jan 31 13:48:30 UTC 2018


Hi,

On Mon, Jan 22, 2018 at 05:54:59PM +0000, Frediano Ziglio wrote:
> 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.

Yes, might be interesting to know why just in case. Didn't find
out in a quick look. Still, should be a harmless change.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-common.h | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> 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) \

Acked-by: Victor Toso <victortoso at redhat.com>

>      { 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); }
>  
> -- 
> 2.14.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180131/0cf4e4a1/attachment.sig>


More information about the Spice-devel mailing list