dev-libs/ell: fix C23 compat

Closes: https://bugs.gentoo.org/943704
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2024-11-18 05:34:05 +00:00
parent d0832514a9
commit 047579dd5f
5 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic linux-info
DESCRIPTION="Embedded Linux Library provides core, low-level functionality for system daemons"
HOMEPAGE="https://git.kernel.org/pub/scm/libs/ell/ell.git"
if [[ "${PV}" == *9999 ]] ; then
inherit autotools git-r3
EGIT_REPO_URI="https://git.kernel.org/pub/scm/libs/ell/ell.git"
else
SRC_URI="https://mirrors.edge.kernel.org/pub/linux/libs/${PN}/${P}.tar.xz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
LICENSE="LGPL-2.1+"
SLOT="0"
IUSE="pie test"
RESTRICT="!test? ( test )"
DEPEND="test? ( sys-apps/dbus )"
CONFIG_CHECK="
~TIMERFD
~EVENTFD
~CRYPTO_USER_API
~CRYPTO_USER_API_HASH
~CRYPTO_MD5
~CRYPTO_SHA1
~KEY_DH_OPERATIONS
"
PATCHES=(
"${FILESDIR}"/0.70
)
src_prepare() {
default
sed -i -e "s#/tmp/ell-test-bus#/tmp/ell-test-bus-$(uuidgen)#" \
unit/test-dbus*.c unit/dbus.conf || die
[[ "${PV}" == *9999 ]] && eautoreconf
}
src_configure() {
append-cflags "-fsigned-char" #662694
local myeconfargs=(
$(use_enable pie)
)
econf "${myeconfargs[@]}"
}
src_install() {
default
find "${ED}" -name "*.la" -delete || die
}
src_test() {
# New dbus tests fail with >3 jobs, this should get fixed soon
emake -j1 check
}

View File

@@ -0,0 +1,43 @@
https://bugs.gentoo.org/943704
https://lore.kernel.org/all/20241117001814.2149181-2-slyich@gmail.com/T/#m1770e7c457dbb58d6950ee981c68cdd39a996724
From fdfed58104edd309431f738eaf3a7b5361ff9c86 Mon Sep 17 00:00:00 2001
Message-ID: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 17 Nov 2024 00:18:11 +0000
Subject: [PATCH 1/4] settings: fix -std=c23 build failure
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
As a result `ell` fails the build as:
ell/settings.c: In function 'l_settings_get_embedded_value':
ell/settings.c:1521:24: error: incompatible types when returning type '_Bool' but 'const char *' was expected
1521 | return false;
| ^~~~~
The change uses poiter instead of a bool to return the zero value.
---
ell/settings.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/settings.c b/ell/settings.c
index a5f17d1..b46d00b 100644
--- a/ell/settings.c
+++ b/ell/settings.c
@@ -1518,7 +1518,7 @@ LIB_EXPORT const char *l_settings_get_embedded_value(
struct embedded_group_data *group;
if (unlikely(!settings))
- return false;
+ return NULL;
group = l_queue_find(settings->embedded_groups,
embedded_group_match, group_name);
base-commit: 373b828093fd48e5f33558bfba9fceaed311486c
--
2.47.0

View File

@@ -0,0 +1,67 @@
https://bugs.gentoo.org/943704
https://lore.kernel.org/all/20241117001814.2149181-2-slyich@gmail.com/T/#m1770e7c457dbb58d6950ee981c68cdd39a996724
From f06bcc6e1b08563ef9a8c8837ad39aaa4357ee43 Mon Sep 17 00:00:00 2001
Message-ID: <f06bcc6e1b08563ef9a8c8837ad39aaa4357ee43.1731907744.git.sam@gentoo.org>
In-Reply-To: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
References: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 17 Nov 2024 00:18:12 +0000
Subject: [PATCH 2/4] cert: fix -std=c23 build failure
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff
259b06c212
As a result `ell` fails the build as:
390 | return false;
| ^~~~~
ell/cert.c:390:32: error: incompatible types when returning type '_Bool' but 'const uint8_t *' {aka 'const unsigned char *'} was expected
---
ell/cert.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ell/cert.c b/ell/cert.c
index 38bb01a..19a6556 100644
--- a/ell/cert.c
+++ b/ell/cert.c
@@ -387,13 +387,13 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
seq = asn1_der_find_elem(ext, end - ext, 0, &tag, &len);
if (unlikely(!seq || tag != ASN1_ID_SEQUENCE))
- return false;
+ return NULL;
ext = seq + len;
oid = asn1_der_find_elem(seq, len, 0, &tag, &oid_len);
if (unlikely(!oid || tag != ASN1_ID_OID))
- return false;
+ return NULL;
if (!asn1_oid_eq(ext_id, oid_len, oid))
continue;
@@ -403,7 +403,7 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
if (data && tag == ASN1_ID_BOOLEAN) {
if (data_len != 1)
- return false;
+ return NULL;
critical = *data != 0; /* Tolerate BER booleans */
@@ -411,7 +411,7 @@ const uint8_t *cert_get_extension(struct l_cert *cert,
}
if (unlikely(!data || tag != ASN1_ID_OCTET_STRING))
- return false;
+ return NULL;
if (out_critical)
*out_critical = critical;
--
2.47.0

View File

@@ -0,0 +1,45 @@
https://bugs.gentoo.org/943704
https://lore.kernel.org/all/20241117001814.2149181-2-slyich@gmail.com/T/#m1770e7c457dbb58d6950ee981c68cdd39a996724
From 4aebc7cd5b40df939532bcf4c15e0407e2748750 Mon Sep 17 00:00:00 2001
Message-ID: <4aebc7cd5b40df939532bcf4c15e0407e2748750.1731907744.git.sam@gentoo.org>
In-Reply-To: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
References: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 17 Nov 2024 00:18:13 +0000
Subject: [PATCH 3/4] dbus: fix -std=c23 build failure
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
As a result `ell` fails the build as:
1700 | return false;
| ^~~~~
ell/dbus.c:1700:24: error: incompatible types when returning type '_Bool' but 'void *' was expected
---
ell/dbus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ell/dbus.c b/ell/dbus.c
index bd6e1b8..1ab4ded 100644
--- a/ell/dbus.c
+++ b/ell/dbus.c
@@ -1697,10 +1697,10 @@ LIB_EXPORT void *l_dbus_object_get_data(struct l_dbus *dbus, const char *object,
const char *interface)
{
if (unlikely(!dbus))
- return false;
+ return NULL;
if (unlikely(!dbus->tree))
- return false;
+ return NULL;
return _dbus_object_tree_get_interface_data(dbus->tree, object,
interface);
--
2.47.0

View File

@@ -0,0 +1,58 @@
https://bugs.gentoo.org/943704
https://lore.kernel.org/all/20241117001814.2149181-2-slyich@gmail.com/T/#m1770e7c457dbb58d6950ee981c68cdd39a996724
From f5048a5412a0f046c58e1566569dfcc31cd5b5d6 Mon Sep 17 00:00:00 2001
Message-ID: <f5048a5412a0f046c58e1566569dfcc31cd5b5d6.1731907744.git.sam@gentoo.org>
In-Reply-To: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
References: <fdfed58104edd309431f738eaf3a7b5361ff9c86.1731907744.git.sam@gentoo.org>
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 17 Nov 2024 00:18:14 +0000
Subject: [PATCH 4/4] test-rtnl: fix -std=c23 build failure
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
As a result `ell` fails the build as:
passing argument 1 of 'l_idle_oneshot' from incompatible pointer type [-Wincompatible-pointer-types]
501 | l_idle_oneshot(test_next, NULL, NULL);
| ^~~~~~~~~
| |
| void (*)(void)
unit/test-rtnl.c: In function 'test_run':
unit/test-rtnl.c:501:24: error:
---
unit/test-rtnl.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/unit/test-rtnl.c b/unit/test-rtnl.c
index 59d8492..6fbac9e 100644
--- a/unit/test-rtnl.c
+++ b/unit/test-rtnl.c
@@ -358,6 +358,12 @@ static void test_next()
test->start(rtnl, test->data);
}
+static void test_next_cb(void * unused)
+{
+ (void)unused;
+ test_next();
+}
+
#define test_assert(cond) \
do { \
if (!(cond)) { \
@@ -498,7 +504,7 @@ static void test_run(void)
{
success = false;
- l_idle_oneshot(test_next, NULL, NULL);
+ l_idle_oneshot(test_next_cb, NULL, NULL);
l_main_run_with_signal(signal_handler, NULL);
}
--
2.47.0