]> xenbits.xensource.com Git - libvirt.git/commitdiff
VIR_REQUIRE_FLAG_(GOTO|RET): Add parens around arguments in expansion
authorPeter Krempa <pkrempa@redhat.com>
Thu, 2 Dec 2021 09:48:54 +0000 (10:48 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 7 Dec 2021 08:00:39 +0000 (09:00 +0100)
Make the macro useful also for cases when one of multiple flags is
required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/internal.h

index 2e404cd705d6fd0562fcb8bac02f2e8f74a3eab2..b6e43325422d1f0123d78221528704dc1fe1e12f 100644 (file)
  */
 #define VIR_REQUIRE_FLAG_RET(FLAG1, FLAG2, RET) \
     do { \
-        if ((flags & FLAG1) && !(flags & FLAG2)) { \
+        if ((flags & (FLAG1)) && !(flags & (FLAG2))) { \
             virReportInvalidArg(ctl, \
                                 _("Flag '%s' is required by flag '%s'"), \
                                 #FLAG2, #FLAG1); \
  */
 #define VIR_REQUIRE_FLAG_GOTO(FLAG1, FLAG2, LABEL) \
     do { \
-        if ((flags & FLAG1) && !(flags & FLAG2)) { \
+        if ((flags & (FLAG1)) && !(flags & (FLAG2))) { \
             virReportInvalidArg(ctl, \
                                 _("Flag '%s' is required by flag '%s'"), \
                                 #FLAG2, #FLAG1); \