Re: [PATCH 1/2] util: Turn virFirewallAddRule() into a macro

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

 



On Mon, Jan 02, 2017 at 07:15:30PM +0100, Andrea Bolognani wrote:
Clang 3.9 refuses to compile the existing code with the
following error:

 util/virfirewall.c:425:20: error: passing an object that undergoes
                            default argument promotion to 'va_start'
                            has undefined behavior [-Werror,-Wvarargs]
     va_start(args, layer);
                    ^
 util/virfirewall.c:420:37: note: parameter of type 'virFirewallLayer'
                            is declared here
                    virFirewallLayer layer,
                                     ^

This happens because 'layer' is of type virFirewallLayer, which
is an enum type and not a standard type such as eg. void* or int.

To solve the issue, turn virFirewallAddRule() from a very thin
wrapper around virFirewallAddRuleFullV() to a macro that expands
to a call to virFirewallAddRuleFull() - itself a very thin wrapper
around the aforementioned virFirewallAddRuleFullV() - with no loss
of functionality or type safety.
---
This only seems to be required on very specific combinations
of Clang and host OS, eg. I need it on Clang 3.9 / Fedora
rawhide but not on Clang 3.8 or 4.0 / Debian sid.


We sent various patches for this (me, Jan and maybe other people as
well).  I never realized it's not a problem with different versions of
clang.  I would say it's not a problem for us to solve it in this case,
however, as I wrote in my solution, it works, but it's undefined from
the specification point of view.  Can it work just because
virFirewallAddRule() gets optimized into inline function?  it shouldn't
be, though...  I don't know.

Attachment: signature.asc
Description: Digital signature

--
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