
On 2/26/19 9:08 AM, Julio Faracco wrote:
Hi John,
I'm seeing clang warnings after applying patches. Clang is complaining about this line:
- if (STREQ(name, "lxc.network.type")) { + if (STREQ(name, "type")) { virDomainDefPtr def = parseData->def;
I think it is irrelevant because there is no way to get a NULL pointer from case structure. During my tests, I'm being redirected to "Unhandled network property". Technically, only lxcNetworkParseDataSuffix is using this method. Btw, here is a possible fix for that...
Hmm.. I don't typically compile with clang, although I know there are a few on the team that do and they haven't posted anything yet. I did see on the #virt channel that travis-ci's bot complained: https://travis-ci.org/libvirt/libvirt/builds/498459437 However, in looking at the output, it wasn't a compilation failure, rather it was a failure to 'mv mr.gmo-t mr.gmo' it seems which would be unrelated. I also just installed clang 7.0.1, ran CC=clang sh autogen.sh, and then did a build, but didn't see any failure. If anything - I would think a well placed sa_assert(suffix) in lxcNetworkParseDataEntry would assert to the compiler that suffix isn't NULL. Of course the fact that lxcNetworkParseDataIPs got called means that virLXCNetworkConfigEntryTypeFromString had a valid string. So, perhaps it's an older clang compiler that's issuing the message. John
--- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -612,7 +612,7 @@ lxcNetworkParseDataIPs(const char *name, if (VIR_ALLOC(ip) < 0) return -1;
- if (STREQ(name, "ipv6")) + if (STREQ_NULLABLE(name, "ipv6")) family = AF_INET6;
ipparts = virStringSplit(value->str, "/", 2);
-- Julio Cesar Faracco