From: Denis Pronin Date: Mon, 9 Mar 2020 15:29:58 +0000 (+0300) Subject: sys-apps/systemd: patch to support gnu11 standard for compilation X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff57f388b782354cb5f6bca825cc4aa34e23e16b;p=gentoo.git sys-apps/systemd: patch to support gnu11 standard for compilation Closes: https://github.com/gentoo/gentoo/pull/14901 Signed-off-by: Denis Pronin Signed-off-by: Mike Gilbert --- diff --git a/sys-apps/systemd/files/245-clang-gnu11.patch b/sys-apps/systemd/files/245-clang-gnu11.patch new file mode 100644 index 000000000000..9056b56d48ee --- /dev/null +++ b/sys-apps/systemd/files/245-clang-gnu11.patch @@ -0,0 +1,60 @@ +From 36e0d89a88c51ba879a2d7e2f90ea9b38333e2c0 Mon Sep 17 00:00:00 2001 +From: Denis Pronin +Date: Sun, 8 Mar 2020 23:57:07 +0300 +Subject: [PATCH] Support compiling with clang and gnu11 standard + +Signed-off-by: Denis Pronin +--- + src/shared/json-internal.h | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/src/shared/json-internal.h b/src/shared/json-internal.h +index bf158bff0d4..fabff0c860e 100644 +--- a/src/shared/json-internal.h ++++ b/src/shared/json-internal.h +@@ -26,21 +26,34 @@ assert_cc(sizeof(JsonValue) == 16U); + /* We use fake JsonVariant objects for some special values, in order to avoid memory allocations for them. Note that + * effectively this means that there are multiple ways to encode the same objects: via these magic values or as + * properly allocated JsonVariant. We convert between both on-the-fly as necessary. */ +-#define JSON_VARIANT_MAGIC_TRUE ((JsonVariant*) 1) +-#define JSON_VARIANT_MAGIC_FALSE ((JsonVariant*) 2) +-#define JSON_VARIANT_MAGIC_NULL ((JsonVariant*) 3) +-#define JSON_VARIANT_MAGIC_ZERO_INTEGER ((JsonVariant*) 4) +-#define JSON_VARIANT_MAGIC_ZERO_UNSIGNED ((JsonVariant*) 5) +-#define JSON_VARIANT_MAGIC_ZERO_REAL ((JsonVariant*) 6) +-#define JSON_VARIANT_MAGIC_EMPTY_STRING ((JsonVariant*) 7) +-#define JSON_VARIANT_MAGIC_EMPTY_ARRAY ((JsonVariant*) 8) +-#define JSON_VARIANT_MAGIC_EMPTY_OBJECT ((JsonVariant*) 9) +-#define _JSON_VARIANT_MAGIC_MAX ((JsonVariant*) 10) ++enum ++{ ++ _JSON_VARIANT_MAGIC_TRUE = 1, ++#define JSON_VARIANT_MAGIC_TRUE ((JsonVariant*) _JSON_VARIANT_MAGIC_TRUE) ++ _JSON_VARIANT_MAGIC_FALSE, ++#define JSON_VARIANT_MAGIC_FALSE ((JsonVariant*) _JSON_VARIANT_MAGIC_FALSE) ++ _JSON_VARIANT_MAGIC_NULL, ++#define JSON_VARIANT_MAGIC_NULL ((JsonVariant*) _JSON_VARIANT_MAGIC_NULL) ++ _JSON_VARIANT_MAGIC_ZERO_INTEGER, ++#define JSON_VARIANT_MAGIC_ZERO_INTEGER ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_INTEGER) ++ _JSON_VARIANT_MAGIC_ZERO_UNSIGNED, ++#define JSON_VARIANT_MAGIC_ZERO_UNSIGNED ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_UNSIGNED) ++ _JSON_VARIANT_MAGIC_ZERO_REAL, ++#define JSON_VARIANT_MAGIC_ZERO_REAL ((JsonVariant*) _JSON_VARIANT_MAGIC_ZERO_REAL) ++ _JSON_VARIANT_MAGIC_EMPTY_STRING, ++#define JSON_VARIANT_MAGIC_EMPTY_STRING ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_STRING) ++ _JSON_VARIANT_MAGIC_EMPTY_ARRAY, ++#define JSON_VARIANT_MAGIC_EMPTY_ARRAY ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_ARRAY) ++ _JSON_VARIANT_MAGIC_EMPTY_OBJECT, ++#define JSON_VARIANT_MAGIC_EMPTY_OBJECT ((JsonVariant*) _JSON_VARIANT_MAGIC_EMPTY_OBJECT) ++ __JSON_VARIANT_MAGIC_MAX ++#define _JSON_VARIANT_MAGIC_MAX ((JsonVariant*) __JSON_VARIANT_MAGIC_MAX) ++}; + + /* This is only safe as long as we don't define more than 4K magic pointers, i.e. the page size of the simplest + * architectures we support. That's because we rely on the fact that malloc() will never allocate from the first memory + * page, as it is a faulting page for catching NULL pointer dereferences. */ +-assert_cc((uintptr_t) _JSON_VARIANT_MAGIC_MAX < 4096U); ++assert_cc((unsigned) __JSON_VARIANT_MAGIC_MAX < 4096U); + + enum { /* JSON tokens */ + JSON_TOKEN_END, diff --git a/sys-apps/systemd/systemd-243-r2.ebuild b/sys-apps/systemd/systemd-243-r2.ebuild index 5c4c417bc344..a46b5c8519f5 100644 --- a/sys-apps/systemd/systemd-243-r2.ebuild +++ b/sys-apps/systemd/systemd-243-r2.ebuild @@ -188,6 +188,7 @@ src_prepare() { # Add local patches here PATCHES+=( "${FILESDIR}/243-seccomp.patch" + "${FILESDIR}/245-clang-gnu11.patch" ) if ! use vanilla; then diff --git a/sys-apps/systemd/systemd-244.3.ebuild b/sys-apps/systemd/systemd-244.3.ebuild index c61aa348281f..ee3dfc93eef1 100644 --- a/sys-apps/systemd/systemd-244.3.ebuild +++ b/sys-apps/systemd/systemd-244.3.ebuild @@ -192,6 +192,7 @@ src_prepare() { # Add local patches here PATCHES+=( + "${FILESDIR}/245-clang-gnu11.patch" ) if ! use vanilla; then diff --git a/sys-apps/systemd/systemd-244.ebuild b/sys-apps/systemd/systemd-244.ebuild index 49383fe9a6f3..3bbbcca56972 100644 --- a/sys-apps/systemd/systemd-244.ebuild +++ b/sys-apps/systemd/systemd-244.ebuild @@ -188,6 +188,7 @@ src_prepare() { # Add local patches here PATCHES+=( "${FILESDIR}"/244-efi-gcc-10.patch + "${FILESDIR}/245-clang-gnu11.patch" ) if ! use vanilla; then diff --git a/sys-apps/systemd/systemd-245.ebuild b/sys-apps/systemd/systemd-245.ebuild index 6454de6e1695..0b39a8aceb4b 100644 --- a/sys-apps/systemd/systemd-245.ebuild +++ b/sys-apps/systemd/systemd-245.ebuild @@ -194,6 +194,7 @@ src_prepare() { # Add local patches here PATCHES+=( + "${FILESDIR}/245-clang-gnu11.patch" ) if ! use vanilla; then