C++ does not allow implicit conversion from void pointer to a specific pointer type. This change adds explicit typecasts to appropriate types wherever needed.
Signed-off-by: Shireesh Kumar Singh <shireesh...@vmware.com> Signed-off-by: Sairam Venugopal <vsai...@vmware.com> Co-authored-by: Sairam Venugopal <vsai...@vmware.com> --- lib/netlink.h | 3 ++- lib/ovs-thread.h | 4 ++-- lib/packets.h | 15 ++++++++++----- lib/socket-util.h | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/netlink.h b/lib/netlink.h index 6dfac27..e4cb2f7 100644 --- a/lib/netlink.h +++ b/lib/netlink.h @@ -153,7 +153,8 @@ enum nl_attr_type static inline struct nlattr * nl_attr_next(const struct nlattr *nla) { - return (void *) ((uint8_t *) nla + NLA_ALIGN(nla->nla_len)); + return ALIGNED_CAST(struct nlattr *, + ((uint8_t *) nla + NLA_ALIGN(nla->nla_len))); } static inline bool diff --git a/lib/ovs-thread.h b/lib/ovs-thread.h index 55e51a4..03fd804 100644 --- a/lib/ovs-thread.h +++ b/lib/ovs-thread.h @@ -260,7 +260,7 @@ void xpthread_join(pthread_t, void **); static inline NAME##_type * \ NAME##_get_unsafe(void) \ { \ - return &NAME##_var; \ + return (NAME##_type *)&NAME##_var; \ } \ \ static inline NAME##_type * \ @@ -316,7 +316,7 @@ void xpthread_join(pthread_t, void **); static inline NAME##_type * \ NAME##_get_unsafe(void) \ { \ - return pthread_getspecific(NAME##_key); \ + return (NAME##_type *)pthread_getspecific(NAME##_key); \ } \ \ NAME##_type *NAME##_get(void); diff --git a/lib/packets.h b/lib/packets.h index 13ea46d..45e6345 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -1123,7 +1123,8 @@ in6_addr_set_mapped_ipv4(struct in6_addr *ip6, ovs_be32 ip4) static inline ovs_be32 in6_addr_get_mapped_ipv4(const struct in6_addr *addr) { - union ovs_16aligned_in6_addr *taddr = (void *) addr; + union ovs_16aligned_in6_addr *taddr = + (union ovs_16aligned_in6_addr *) addr; if (IN6_IS_ADDR_V4MAPPED(addr)) { return get_16aligned_be32(&taddr->be32[3]); } else { @@ -1134,7 +1135,8 @@ in6_addr_get_mapped_ipv4(const struct in6_addr *addr) static inline void in6_addr_solicited_node(struct in6_addr *addr, const struct in6_addr *ip6) { - union ovs_16aligned_in6_addr *taddr = (void *) addr; + union ovs_16aligned_in6_addr *taddr = + (union ovs_16aligned_in6_addr *) addr; memset(taddr->be16, 0, sizeof(taddr->be16)); taddr->be16[0] = htons(0xff02); taddr->be16[5] = htons(0x1); @@ -1150,8 +1152,10 @@ static inline void in6_generate_eui64(struct eth_addr ea, struct in6_addr *prefix, struct in6_addr *lla) { - union ovs_16aligned_in6_addr *taddr = (void *) lla; - union ovs_16aligned_in6_addr *prefix_taddr = (void *) prefix; + union ovs_16aligned_in6_addr *taddr = + (union ovs_16aligned_in6_addr *) lla; + union ovs_16aligned_in6_addr *prefix_taddr = + (union ovs_16aligned_in6_addr *) prefix; taddr->be16[0] = prefix_taddr->be16[0]; taddr->be16[1] = prefix_taddr->be16[1]; taddr->be16[2] = prefix_taddr->be16[2]; @@ -1169,7 +1173,8 @@ in6_generate_eui64(struct eth_addr ea, struct in6_addr *prefix, static inline void in6_generate_lla(struct eth_addr ea, struct in6_addr *lla) { - union ovs_16aligned_in6_addr *taddr = (void *) lla; + union ovs_16aligned_in6_addr *taddr = + (union ovs_16aligned_in6_addr *) lla; memset(taddr->be16, 0, sizeof(taddr->be16)); taddr->be16[0] = htons(0xfe80); taddr->be16[4] = htons(((ea.ea[0] ^ 0x02) << 8) | ea.ea[1]); diff --git a/lib/socket-util.h b/lib/socket-util.h index 873a59a..439f0c2 100644 --- a/lib/socket-util.h +++ b/lib/socket-util.h @@ -138,7 +138,7 @@ static inline int make_unix_socket(int style, bool nonblock, static inline int rpl_setsockopt(int sock, int level, int optname, const void *optval, socklen_t optlen) { - return (setsockopt)(sock, level, optname, optval, optlen); + return (setsockopt)(sock, level, optname, (const char *)optval, optlen); } #define getsockopt(sock, level, optname, optval, optlen) \ @@ -146,7 +146,7 @@ static inline int rpl_setsockopt(int sock, int level, int optname, static inline int rpl_getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen) { - return (getsockopt)(sock, level, optname, optval, optlen); + return (getsockopt)(sock, level, optname, (char *)optval, optlen); } #endif -- 2.7.4 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev