[PATCH] util: Fix build with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When compiling with clang on Linux, it complains that "passing an
object that undergoes default argument promotion to 'va_start' has
undefined behavior".  That is true according to the C standard,
although I couldn't find any mention about enum->int promotion (even
though it's a sensible one).  The only fix I came up with was changing
the layer parameter to int so that it does not undergo any default
argument promotion.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
Even though this is a build-breaker, I don't see anyone (or CI)
complaining about it, and the fix doesn't lok that nice, so...

 src/util/virfirewall.c | 4 ++--
 src/util/virfirewall.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 3f976186a671..da4602aa422b 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -417,7 +417,7 @@ virFirewallAddRuleFullV(virFirewallPtr firewall,
  */
 virFirewallRulePtr
 virFirewallAddRule(virFirewallPtr firewall,
-                   virFirewallLayer layer,
+                   int layer,
                    ...)
 {
     virFirewallRulePtr rule;
@@ -452,7 +452,7 @@ virFirewallAddRule(virFirewallPtr firewall,
  * Returns the new rule
  */
 virFirewallRulePtr virFirewallAddRuleFull(virFirewallPtr firewall,
-                                          virFirewallLayer layer,
+                                          int layer,
                                           bool ignoreErrors,
                                           virFirewallQueryCallback cb,
                                           void *opaque,
diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h
index dbf397537fa8..51608b648633 100644
--- a/src/util/virfirewall.h
+++ b/src/util/virfirewall.h
@@ -45,7 +45,7 @@ virFirewallPtr virFirewallNew(void);
 void virFirewallFree(virFirewallPtr firewall);

 virFirewallRulePtr virFirewallAddRule(virFirewallPtr firewall,
-                                      virFirewallLayer layer,
+                                      int layer,
                                       ...)
     ATTRIBUTE_SENTINEL;

@@ -54,7 +54,7 @@ typedef int (*virFirewallQueryCallback)(virFirewallPtr firewall,
                                         void *opaque);

 virFirewallRulePtr virFirewallAddRuleFull(virFirewallPtr firewall,
-                                          virFirewallLayer layer,
+                                          int layer,
                                           bool ignoreErrors,
                                           virFirewallQueryCallback cb,
                                           void *opaque,
--
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux