diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-06-14 15:10:02 +0100 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2017-08-04 16:00:15 -0400 |
commit | 5f71aa734767c294a663d86aba098cdbf437e3fd (patch) | |
tree | 09f110b19f6a7e02552b4bedaf178c37c6660c41 | |
parent | 68b19542ec28b451c761d9cc203c574e35636af9 (diff) | |
download | libvirt-5f71aa734767c294a663d86aba098cdbf437e3fd.tar.gz |
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>
(cherry picked from commit 1ba693994a0ed97764f2c9058e4ae1a64f1287d1)
-rw-r--r-- | m4/virt-compile-warnings.m4 | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index eb689e2f88..0735ee7838 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -61,6 +61,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ dontwarn="$dontwarn -Wenum-compare" # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time dontwarn="$dontwarn -Wformat-signedness" + # Several conditionals expand the same on both branches + # depending on the particular platform/architecture + dontwarn="$dontwarn -Wduplicated-branches" # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull), # which triggers spurious warnings for our usage |