]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Disable the -Wduplicated-branches warning
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 14 Jun 2017 14:10:02 +0000 (15:10 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 15 Jun 2017 12:26:51 +0000 (13:26 +0100)
commit1ba693994a0ed97764f2c9058e4ae1a64f1287d1
tree72bfb1950ac2ad5c6eee849b5c9bc5beb74f1c51
parentf0a3fe1b0a2996272dd167501bb5de752d9d1956
Disable the -Wduplicated-branches warning

Depending on the platform/architecture, a number of conditionals
in libvirt code expand the same on both branches. This is expected
behaviour and harmless, so disable the warning to avoid creating
unexpected build failures

Two examples, mingw32:

../../src/util/vircommand.c: In function 'virCommandWait':
../../src/util/vircommand.c:2562:51: error: this condition has identical branches [-Werror=duplicated-branches]
             *exitstatus = cmd->rawStatus ? status : WEXITSTATUS(status);
                                                   ^
and gcc7.1

In file included from util/virobject.c:28:0:
util/virobject.c: In function 'virClassNew':
util/viratomic.h:176:46: error: this condition has identical branches [-Werror=duplicated-branches]
            (void)(0 ? *(atomic) ^ *(atomic) : 0);                      \
                                             ^
util/virobject.c:144:20: note: in expansion of macro 'virAtomicIntInc'
    klass->magic = virAtomicIntInc(&magicCounter);
                   ^~~~~~~~~~~~~~~

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
m4/virt-compile-warnings.m4