]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Use a temporary int variable to store GIC version
authorAndrea Bolognani <abologna@redhat.com>
Tue, 16 Feb 2016 16:41:47 +0000 (17:41 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 16 Feb 2016 17:12:17 +0000 (18:12 +0100)
commitcda1cc170f07b45911b3dad03e42c8ebfc210fa1
treeb023cf13ee09695cf7174e25aa1c5089850ec68b
parent731ed05ce9c63e80ec041f3f41b84a9ff950e88d
conf: Use a temporary int variable to store GIC version

Since no value in the virGICVersion enumeration is negative, a clever
enough compiler can report an error such as

  src/conf/domain_conf.c:15337:75: error: comparison of unsigned enum
  expression < 0 is always false [-Werror,-Wtautological-compare]
    if ((def->gic_version = virGICVersionTypeFromString(tmp)) < 0 ||
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~

virGICVersionTypeFromString() can, however, return a negative value if
the input string is not part of the enumeration, so we definitely need
that check.

Work around the problem by storing the return value in a temporary int
variable.
src/conf/domain_conf.c