[libvirt PATCH v2 02/12] virxml: Simplify VIR_XPATH_NODE_AUTORESTORE
Tim Wiederhake
twiederh at redhat.com
Tue Sep 14 13:28:09 UTC 2021
On Fri, 2021-09-10 at 14:36 +0200, Ján Tomko wrote:
> On a Friday in 2021, Tim Wiederhake wrote:
> > Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
> > ---
> > src/util/virxml.h | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/src/util/virxml.h b/src/util/virxml.h
> > index 06fb7aebd8..e69fd08ea6 100644
> > --- a/src/util/virxml.h
> > +++ b/src/util/virxml.h
> > @@ -358,10 +358,8 @@
> > G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virXPathContextNodeSave,
> > virXPathContextNodeRes
> > * node pointer is reset to the original value when this macro was
> > used.
> > */
> > #define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
> > - VIR_WARNINGS_NO_UNUSED_VARIABLE \
> > g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt =
> > _ctxt,\
> > - .node =
> > _ctxt->node}; \
> > - VIR_WARNINGS_RESET
> > + .node =
> > _ctxt->node};
> >
> > G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlDoc, xmlFreeDoc);
> > G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlXPathContext,
> > xmlXPathFreeContext);
>
> https://listman.redhat.com/archives/libvir-list/2021-August/msg00851.html
>
Patch #1 adds G_GNUC_UNUSED to g_auto if compiled with clang. This
removes the need to disable unused-variable-detection for
VIR_XPATH_NODE_AUTORESTORE.
Disabling unused-variable-detection unconditionally to work around a
bug in one compiler (see llvm bugs 3888 and 43482) does more harm than
good I think.
Tim
More information about the libvir-list
mailing list