mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE
The VIR_XPATH_NODE_AUTORESTORE contains an ignore_value statement to silence an unused variable warning on clang. Use a pragma instead, which is not a statement. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
aeb59ff576
commit
8cc177fc5d
@ -189,6 +189,11 @@
|
|||||||
_Pragma ("GCC diagnostic push")
|
_Pragma ("GCC diagnostic push")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Where ignore_value cannot be used because it's a statement */
|
||||||
|
#define VIR_WARNINGS_NO_UNUSED_VARIABLE \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wunused-variable\"")
|
||||||
|
|
||||||
#define VIR_WARNINGS_RESET \
|
#define VIR_WARNINGS_RESET \
|
||||||
_Pragma ("GCC diagnostic pop")
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
|
||||||
|
@ -241,9 +241,10 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virXPathContextNodeSave, virXPathContextNodeRes
|
|||||||
* node pointer is reset to the original value when this macro was used.
|
* node pointer is reset to the original value when this macro was used.
|
||||||
*/
|
*/
|
||||||
#define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
|
#define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
|
||||||
|
VIR_WARNINGS_NO_UNUSED_VARIABLE \
|
||||||
g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt = _ctxt,\
|
g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt = _ctxt,\
|
||||||
.node = _ctxt->node}; \
|
.node = _ctxt->node}; \
|
||||||
ignore_value(&_ctxt ## CtxtSave)
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlDoc, xmlFreeDoc);
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlDoc, xmlFreeDoc);
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlXPathContext, xmlXPathFreeContext);
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlXPathContext, xmlXPathFreeContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user