Make it possible to build bionic with -I instead of -isystem.
Various things:
* work around -Wnullability-completeness.
* use C++ casts in C++ and C casts in C.
* stop using attributes clang doesn't support (such as `warning`).
* remove duplicate definitions of XATTR_CREATE and XATTR_REPLACE.
Change-Id: I07649e46275b28a23ca477deea119fe843999533
diff --git a/libc/include/netinet/in6.h b/libc/include/netinet/in6.h
index 879ac75..ae20f83 100644
--- a/libc/include/netinet/in6.h
+++ b/libc/include/netinet/in6.h
@@ -29,33 +29,34 @@
#ifndef _NETINET_IN6_H
#define _NETINET_IN6_H
+#include <sys/cdefs.h>
+
#include <linux/in6.h>
#define IN6_IS_ADDR_UNSPECIFIED(a) \
- ((*(const uint32_t*)(&(a)->s6_addr[0]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[4]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[8]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[12]) == 0))
+ ((((a)->s6_addr32[0]) == 0) && \
+ (((a)->s6_addr32[1]) == 0) && \
+ (((a)->s6_addr32[2]) == 0) && \
+ (((a)->s6_addr32[3]) == 0))
#define IN6_IS_ADDR_LOOPBACK(a) \
- ((*(const uint32_t*)(&(a)->s6_addr[0]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[4]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[8]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[12]) == ntohl(1)))
+ ((((a)->s6_addr32[0]) == 0) && \
+ (((a)->s6_addr32[1]) == 0) && \
+ (((a)->s6_addr32[2]) == 0) && \
+ (((a)->s6_addr32[3]) == ntohl(1)))
#define IN6_IS_ADDR_V4COMPAT(a) \
- ((*(const uint32_t*)(&(a)->s6_addr[0]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[4]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[8]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[12]) != 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[12]) != ntohl(1)))
+ ((((a)->s6_addr32[0]) == 0) && \
+ (((a)->s6_addr32[1]) == 0) && \
+ (((a)->s6_addr32[2]) == 0) && \
+ (((a)->s6_addr32[3]) != 0) && (((a)->s6_addr32[3]) != ntohl(1)))
#define IN6_IS_ADDR_V4MAPPED(a) \
- ((*(const uint32_t*)(&(a)->s6_addr[0]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[4]) == 0) && \
- (*(const uint32_t*)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
+ ((((a)->s6_addr32[0]) == 0) && \
+ (((a)->s6_addr32[1]) == 0) && \
+ (((a)->s6_addr32[2]) == ntohl(0x0000ffff)))
-#define __bionic_s6_addr(a) ((const uint8_t*)(a))
+#define __bionic_s6_addr(a) __BIONIC_CAST(reinterpret_cast, const uint8_t*, a)
#define IN6_IS_ADDR_LINKLOCAL(a) \
((__bionic_s6_addr(a)[0] == 0xfe) && ((__bionic_s6_addr(a)[1] & 0xc0) == 0x80))