]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: ignore -Wcast-align in virNetlinkDumpCommand
authorJán Tomko <jtomko@redhat.com>
Tue, 4 Apr 2017 10:51:47 +0000 (12:51 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 4 Apr 2017 10:53:23 +0000 (12:53 +0200)
Similar to commit b202c39 ignore the warning that breaks the build
with clang:
util/virnetlink.c:365:52: error: cast from 'char *' to 'struct nlmsghdr *'
 increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) {
                                                   ^~~~~~~~~~~~~~~~~~~~
/usr/include/linux/netlink.h:87:7: note: expanded from macro 'NLMSG_NEXT'
         (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/util/virnetlink.c

index 9bc1f0f2bdabcd2d80b88bb2e7895c06e89905f1..92ecf77dc8a8f696108e4e89dbbf3ed72e92f929 100644 (file)
@@ -361,8 +361,9 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg,
 
     while (!end) {
         len = nl_recv(nlhandle, &nladdr, (unsigned char **)&resp, NULL);
-
+        VIR_WARNINGS_NO_CAST_ALIGN
         for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) {
+            VIR_WARNINGS_RESET
             if (msg->nlmsg_type == NLMSG_DONE)
                 end = true;