]> xenbits.xensource.com Git - libvirt.git/commit
util: Turn virFirewallAddRule() into a macro
authorAndrea Bolognani <abologna@redhat.com>
Mon, 2 Jan 2017 18:15:30 +0000 (19:15 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 4 Jan 2017 10:14:56 +0000 (11:14 +0100)
commitb9cc24839b755c47e1a85b267321d1119d2735f2
tree6f7234afbc4e16e698e4c104bed320899dce20d3
parent7f7d99048350935a394d07b98a13d7da9c4b0502
util: Turn virFirewallAddRule() into a macro

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.
src/libvirt_private.syms
src/util/virfirewall.c
src/util/virfirewall.h