[RFC 04/21] maint: Add helper macro VIR_USED

Daniel P. Berrangé berrange at redhat.com
Mon Jun 29 12:40:57 UTC 2020


On Wed, Jun 10, 2020 at 09:20:32AM +0800, Shi Lei wrote:
> The macro VIR_USED is used in generated parse/format functions to
> avoid args-unused warnings.

I mentioned in the earlier patch that we can just use G_GNUC_UNUSED
on any parameters which might be unused. It doesn't matter if they
really are unused or not.

> 
> Signed-off-by: Shi Lei <shi_lei at massclouds.com>
> ---
>  src/internal.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/internal.h b/src/internal.h
> index e181218..315f12d 100644
> --- a/src/internal.h
> +++ b/src/internal.h
> @@ -502,3 +502,5 @@ enum {
>  # define fprintf(fh, ...) g_fprintf(fh, __VA_ARGS__)
>  
>  #endif /* VIR_NO_GLIB_STDIO */
> +
> +#define VIR_USED(var) do { break; } while(var)
> -- 
> 2.17.1
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list