[libvirt] [PATCH 1/2] util: ignore -Wcast-align in virNetlinkDumpCommand

Ján Tomko jtomko at redhat.com
Tue Apr 4 10:57:58 UTC 2017


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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 9bc1f0f..92ecf77 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -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;
 
-- 
2.10.2




More information about the libvir-list mailing list