SHA256
1
0
forked from pool/systemd
systemd/0001-sizeof-bool-used-by-gcc-depends-on-arch.patch

130 lines
4.7 KiB
Diff

This patch includes changes of the upstream commits
6017365a1d0c1c78fc34a7da63768ee5df5da511 and
4f4b92ba7ae9c56cb0f181d5f95d709e085b8bd5 as well as the fix for the size
of the gcc builtin type bool also known as _Bool from the include header
stdbool.h.
---
src/libsystemd/sd-bus/bus-message.c | 19 +++++++++++++++----
src/libsystemd/sd-bus/bus-protocol.h | 1 +
src/shared/architecture.h | 22 ++++++++++++++++------
3 files changed, 32 insertions(+), 10 deletions(-)
--- src/libsystemd/sd-bus/bus-message.c
+++ src/libsystemd/sd-bus/bus-message.c 2014-09-17 15:55:49.830236907 +0000
@@ -2259,14 +2259,25 @@ int bus_message_append_ap(
r = sd_bus_message_append_basic(m, *t, &x);
break;
}
+ case SD_BUS_TYPE_BOOLEAN: {
+ if (sizeof(bool) == sizeof(uint32_t)) {
+ uint32_t x;
+
+ x = va_arg(ap, uint32_t);
+ r = sd_bus_message_append_basic(m, *t, &x);
+ } else {
+ uint8_t x;
- case SD_BUS_TYPE_BOOLEAN:
+ x = (uint8_t) va_arg(ap, int);
+ r = sd_bus_message_append_basic(m, *t, &x);
+ }
+ break;
+ }
case SD_BUS_TYPE_INT32:
case SD_BUS_TYPE_UINT32:
case SD_BUS_TYPE_UNIX_FD: {
uint32_t x;
- /* We assume a boolean is the same as int32_t */
assert_cc(sizeof(int32_t) == sizeof(int));
x = va_arg(ap, uint32_t);
@@ -3229,7 +3240,7 @@ _public_ int sd_bus_message_read_basic(s
case SD_BUS_TYPE_BOOLEAN:
if (p)
- *(int*) p = !!*(uint8_t*) q;
+ *(bool*) p = !!*(uint8_t*) q;
break;
case SD_BUS_TYPE_INT16:
@@ -3339,7 +3350,7 @@ _public_ int sd_bus_message_read_basic(s
case SD_BUS_TYPE_BOOLEAN:
if (p)
- *(int*) p = !!*(uint32_t*) q;
+ *(bool*) p = !!*(uint32_t*) q;
break;
case SD_BUS_TYPE_INT16:
--- src/libsystemd/sd-bus/bus-protocol.h
+++ src/libsystemd/sd-bus/bus-protocol.h 2014-09-17 13:28:12.582235580 +0000
@@ -21,6 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <endian.h>
/* Endianness */
--- src/shared/architecture.h
+++ src/shared/architecture.h 2014-09-17 13:31:46.710735633 +0000
@@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <endian.h>
+
#include "util.h"
/* A cleaned up architecture definition */
@@ -64,13 +66,13 @@ Architecture uname_architecture(void);
#elif defined(__i386__)
# define native_architecture() ARCHITECTURE_X86
#elif defined(__powerpc64__)
-# if defined(WORDS_BIGENDIAN)
+# if __BYTE_ORDER == __BIG_ENDIAN
# define native_architecture() ARCHITECTURE_PPC64
# else
# define native_architecture() ARCHITECTURE_PPC64_LE
# endif
#elif defined(__powerpc__)
-# if defined(WORDS_BIGENDIAN)
+# if __BYTE_ORDER == __BIG_ENDIAN
# define native_architecture() ARCHITECTURE_PPC
# else
# define native_architecture() ARCHITECTURE_PPC_LE
@@ -90,19 +92,27 @@ Architecture uname_architecture(void);
#elif defined(__sparc__)
# define native_architecture() ARCHITECTURE_SPARC
#elif defined(__mips64__)
-# define native_architecture() ARCHITECTURE_MIPS64
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define native_architecture() ARCHITECTURE_MIPS64
+# else
+# define native_architecture() ARCHITECTURE_MIPS64_LE
+# endif
#elif defined(__mips__)
-# define native_architecture() ARCHITECTURE_MIPS
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define native_architecture() ARCHITECTURE_MIPS
+# else
+# define native_architecture() ARCHITECTURE_MIPS_LE
+#endif
#elif defined(__alpha__)
# define native_architecture() ARCHITECTURE_ALPHA
#elif defined(__aarch64__)
-# if defined(WORDS_BIGENDIAN)
+# if __BYTE_ORDER == __BIG_ENDIAN
# define native_architecture() ARCHITECTURE_ARM64_BE
# else
# define native_architecture() ARCHITECTURE_ARM64
# endif
#elif defined(__arm__)
-# if defined(WORDS_BIGENDIAN)
+# if __BYTE_ORDER == __BIG_ENDIAN
# define native_architecture() ARCHITECTURE_ARM_BE
# else
# define native_architecture() ARCHITECTURE_ARM