summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-04-17 16:04:39 +0000
committerjilles <jilles@FreeBSD.org>2011-04-17 16:04:39 +0000
commit933648d638b9e6ad349de688d2137a3353d4ef9c (patch)
treeef3d83b22ff78c9cdcca3bd033c418a2b32c5032
parent581206dfd1dc64a43afb04717dded328bd5c9ab2 (diff)
downloadFreeBSD-src-933648d638b9e6ad349de688d2137a3353d4ef9c.zip
FreeBSD-src-933648d638b9e6ad349de688d2137a3353d4ef9c.tar.gz
Allow using CMSG_NXTHDR with -Wcast-align.
If various checks are omitted, the CMSG_NXTHDR macro expands to (struct cmsghdr *)((char *)(cmsg) + \ _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len)) Although there is no alignment problem (assuming cmsg is properly aligned and _ALIGN is correct), this violates -Wcast-align on strict-alignment architectures. Therefore an intermediate cast to void * is appropriate here. There is no workaround other than not using -Wcast-align. MFC after: 2 weeks
-rw-r--r--sys/sys/socket.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index 6a58219..7800c42 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -515,7 +515,7 @@ struct sockcred {
_ALIGN(sizeof(struct cmsghdr)) > \
(char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
(struct cmsghdr *)0 : \
- (struct cmsghdr *)((char *)(cmsg) + \
+ (struct cmsghdr *)(void *)((char *)(cmsg) + \
_ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len)))
/*
OpenPOWER on IntegriCloud