[libvirt] [PATCH 06/35] examples: use G_GNUC_UNUSED

Ján Tomko jtomko at redhat.com
Tue Oct 15 08:57:40 UTC 2019


On Tue, Oct 15, 2019 at 10:40:47AM +0200, Michal Privoznik wrote:
>On 10/14/19 3:15 PM, Ján Tomko wrote:
>>Name the macro G_GNUC_UNUSED instead of ATTRIBUTE_UNUSED
>>to match the rest of libvirt code.
>>
>>Signed-off-by: Ján Tomko <jtomko at redhat.com>
>>---
>>  examples/c/misc/event-test.c | 140 +++++++++++++++++------------------
>>  1 file changed, 70 insertions(+), 70 deletions(-)
>>
>>diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
>>index fcf4492470..533b8da9bf 100644
>>--- a/examples/c/misc/event-test.c
>>+++ b/examples/c/misc/event-test.c
>>@@ -21,17 +21,17 @@
>>  # define verify(cond)
>>  #endif
>>-#ifndef ATTRIBUTE_UNUSED
>>-# define ATTRIBUTE_UNUSED __attribute__((__unused__))
>>+#ifndef G_GNUC_UNUSED
>>+# define G_GNUC_UNUSED __attribute__((__unused__))
>>  #endif
>
>Now, that we no longer use ATTRIBUTE_UNUSED - a private macro, can't 
>we just #include <glib.h> here and drop this definition? This example 
>is linked with glib anyways since it's linking with libvirt.so so we 
>wouldn't be dragging in any dependency.

Having libvirt.so and glib.so does not necessarily mean you need to have
the GLib headers installed.

The idea for examples is to use base C with no other dependencies than
libvirt, see e.g.:

commit acf522e85a9747457e6d81a6cae9eef1cf677ff0
    examples: Avoid gnulib, have standalone examples

or

commit 6933ebc497f5b432c0dc8c89450a2723c45371bd
    examples: Drop event-test.c dependency on gnulib <verify.h>


Jano

>
>Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191015/ab698580/attachment-0001.sig>


More information about the libvir-list mailing list