sys-apps/systemd: patch to support gnu11 standard for compilation
authorDenis Pronin <dannftk@yandex.ru>
Mon, 9 Mar 2020 15:29:58 +0000 (18:29 +0300)
committerMike Gilbert <floppym@gentoo.org>
Mon, 9 Mar 2020 21:21:44 +0000 (17:21 -0400)
Closes: https://github.com/gentoo/gentoo/pull/14901
Signed-off-by: Denis Pronin <dannftk@yandex.ru>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
sys-apps/systemd/files/245-clang-gnu11.patch [new file with mode: 0644]
sys-apps/systemd/systemd-243-r2.ebuild
sys-apps/systemd/systemd-244.3.ebuild
sys-apps/systemd/systemd-244.ebuild
sys-apps/systemd/systemd-245.ebuild

diff --git a/sys-apps/systemd/files/245-clang-gnu11.patch b/sys-apps/systemd/files/245-clang-gnu11.patch
new file mode 100644 (file)
index 0000000..9056b56
--- /dev/null
@@ -0,0 +1,60 @@
+From 36e0d89a88c51ba879a2d7e2f90ea9b38333e2c0 Mon Sep 17 00:00:00 2001
+From: Denis Pronin <dannftk@yandex.ru>
+Date: Sun, 8 Mar 2020 23:57:07 +0300
+Subject: [PATCH] Support compiling with clang and gnu11 standard
+
+Signed-off-by: Denis Pronin <dannftk@yandex.ru>
+---
+ 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,
index 5c4c417bc3440f227f8cda6c69c9cd319bffc2ea..a46b5c8519f516118d3cf4f6e5377c79df46a6d6 100644 (file)
@@ -188,6 +188,7 @@ src_prepare() {
        # Add local patches here
        PATCHES+=(
                "${FILESDIR}/243-seccomp.patch"
+               "${FILESDIR}/245-clang-gnu11.patch"
        )
 
        if ! use vanilla; then
index c61aa348281fe15c74b589d27976bfb8251febbd..ee3dfc93eef1a7c50e1da8f235a9ce0ce7ffde46 100644 (file)
@@ -192,6 +192,7 @@ src_prepare() {
 
        # Add local patches here
        PATCHES+=(
+               "${FILESDIR}/245-clang-gnu11.patch"
        )
 
        if ! use vanilla; then
index 49383fe9a6f317944a5660ca1dc232f460f4cc0f..3bbbcca56972a7d2c164e480dd08806ba279cc97 100644 (file)
@@ -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
index 6454de6e1695f458cb86714c02f1b3c621418f2e..0b39a8aceb4b486d2368d5e96dee4d9983feb4d0 100644 (file)
@@ -194,6 +194,7 @@ src_prepare() {
 
        # Add local patches here
        PATCHES+=(
+               "${FILESDIR}/245-clang-gnu11.patch"
        )
 
        if ! use vanilla; then