ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
dd65c9
From 59a855f7dbbd79c01ab9e8d326e986de786dda3f Mon Sep 17 00:00:00 2001
dd65c9
From: Lubomir Rintel <lkundrak@v3.sk>
dd65c9
Date: Wed, 11 Jan 2017 10:50:25 +0100
dd65c9
Subject: [PATCH] sparse: avoid clash with __bitwise and __force from 4.10
dd65c9
 linux/types.h (#5061)
dd65c9
dd65c9
It also used __bitwise and __force. It seems easier to rename
dd65c9
our versions since they are local to this one single header.
dd65c9
dd65c9
Also, undefine them afteerwards, so that we don't pollute the
dd65c9
preprocessor macro namespace.
dd65c9
dd65c9
(cherry picked from commit dc66f33a16596c2886a24da12e56ec096214e124)
dd65c9
dd65c9
Related: #1447937
dd65c9
---
23b3cf
 src/shared/sparse-endian.h | 47 ++++++++++++++++++++------------------
dd65c9
 1 file changed, 25 insertions(+), 22 deletions(-)
dd65c9
dd65c9
diff --git a/src/shared/sparse-endian.h b/src/shared/sparse-endian.h
c62b8e
index c913fda8c5..a3573b84a9 100644
dd65c9
--- a/src/shared/sparse-endian.h
dd65c9
+++ b/src/shared/sparse-endian.h
dd65c9
@@ -26,19 +26,19 @@
dd65c9
 #include <stdint.h>
dd65c9
 
dd65c9
 #ifdef __CHECKER__
dd65c9
-#define __bitwise __attribute__((bitwise))
dd65c9
-#define __force __attribute__((force))
dd65c9
+#define __sd_bitwise __attribute__((bitwise))
dd65c9
+#define __sd_force __attribute__((force))
dd65c9
 #else
dd65c9
-#define __bitwise
dd65c9
-#define __force
dd65c9
+#define __sd_bitwise
dd65c9
+#define __sd_force
dd65c9
 #endif
dd65c9
 
dd65c9
-typedef uint16_t __bitwise le16_t;
dd65c9
-typedef uint16_t __bitwise be16_t;
dd65c9
-typedef uint32_t __bitwise le32_t;
dd65c9
-typedef uint32_t __bitwise be32_t;
dd65c9
-typedef uint64_t __bitwise le64_t;
dd65c9
-typedef uint64_t __bitwise be64_t;
dd65c9
+typedef uint16_t __sd_bitwise le16_t;
dd65c9
+typedef uint16_t __sd_bitwise be16_t;
dd65c9
+typedef uint32_t __sd_bitwise le32_t;
dd65c9
+typedef uint32_t __sd_bitwise be32_t;
dd65c9
+typedef uint64_t __sd_bitwise le64_t;
dd65c9
+typedef uint64_t __sd_bitwise be64_t;
dd65c9
 
dd65c9
 #undef htobe16
dd65c9
 #undef htole16
dd65c9
@@ -69,20 +69,23 @@ typedef uint64_t __bitwise be64_t;
dd65c9
 #define bswap_64_on_be(x) __bswap_64(x)
dd65c9
 #endif
dd65c9
 
dd65c9
-static inline le16_t htole16(uint16_t value) { return (le16_t __force) bswap_16_on_be(value); }
dd65c9
-static inline le32_t htole32(uint32_t value) { return (le32_t __force) bswap_32_on_be(value); }
dd65c9
-static inline le64_t htole64(uint64_t value) { return (le64_t __force) bswap_64_on_be(value); }
dd65c9
+static inline le16_t htole16(uint16_t value) { return (le16_t __sd_force) bswap_16_on_be(value); }
dd65c9
+static inline le32_t htole32(uint32_t value) { return (le32_t __sd_force) bswap_32_on_be(value); }
dd65c9
+static inline le64_t htole64(uint64_t value) { return (le64_t __sd_force) bswap_64_on_be(value); }
dd65c9
 
dd65c9
-static inline be16_t htobe16(uint16_t value) { return (be16_t __force) bswap_16_on_le(value); }
dd65c9
-static inline be32_t htobe32(uint32_t value) { return (be32_t __force) bswap_32_on_le(value); }
dd65c9
-static inline be64_t htobe64(uint64_t value) { return (be64_t __force) bswap_64_on_le(value); }
dd65c9
+static inline be16_t htobe16(uint16_t value) { return (be16_t __sd_force) bswap_16_on_le(value); }
dd65c9
+static inline be32_t htobe32(uint32_t value) { return (be32_t __sd_force) bswap_32_on_le(value); }
dd65c9
+static inline be64_t htobe64(uint64_t value) { return (be64_t __sd_force) bswap_64_on_le(value); }
dd65c9
 
dd65c9
-static inline uint16_t le16toh(le16_t value) { return bswap_16_on_be((uint16_t __force)value); }
dd65c9
-static inline uint32_t le32toh(le32_t value) { return bswap_32_on_be((uint32_t __force)value); }
dd65c9
-static inline uint64_t le64toh(le64_t value) { return bswap_64_on_be((uint64_t __force)value); }
dd65c9
+static inline uint16_t le16toh(le16_t value) { return bswap_16_on_be((uint16_t __sd_force)value); }
dd65c9
+static inline uint32_t le32toh(le32_t value) { return bswap_32_on_be((uint32_t __sd_force)value); }
dd65c9
+static inline uint64_t le64toh(le64_t value) { return bswap_64_on_be((uint64_t __sd_force)value); }
dd65c9
 
dd65c9
-static inline uint16_t be16toh(be16_t value) { return bswap_16_on_le((uint16_t __force)value); }
dd65c9
-static inline uint32_t be32toh(be32_t value) { return bswap_32_on_le((uint32_t __force)value); }
dd65c9
-static inline uint64_t be64toh(be64_t value) { return bswap_64_on_le((uint64_t __force)value); }
dd65c9
+static inline uint16_t be16toh(be16_t value) { return bswap_16_on_le((uint16_t __sd_force)value); }
dd65c9
+static inline uint32_t be32toh(be32_t value) { return bswap_32_on_le((uint32_t __sd_force)value); }
dd65c9
+static inline uint64_t be64toh(be64_t value) { return bswap_64_on_le((uint64_t __sd_force)value); }
dd65c9
+
dd65c9
+#undef __sd_bitwise
dd65c9
+#undef __sd_force
dd65c9
 
dd65c9
 #endif /* SPARSE_ENDIAN_H */