diff mbox series

coreutils: Fix build with clang

Message ID 20240117070953.1058681-1-raj.khem@gmail.com
State Accepted, archived
Commit 8f661c567f773c22a03ec0991d700ee900c1f8d7
Headers show
Series coreutils: Fix build with clang | expand

Commit Message

Khem Raj Jan. 17, 2024, 7:09 a.m. UTC
Add a gnulib patch to fix build with clang-18

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-posixtm-pacify-clang-18.patch        | 38 +++++++++++++++++++
 meta/recipes-core/coreutils/coreutils_9.4.bb  |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch
diff mbox series

Patch

diff --git a/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch b/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch
new file mode 100644
index 00000000000..e6c84be3c41
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch
@@ -0,0 +1,38 @@ 
+From 67c298c36f69b6906840b7584be06b7b5f33f829 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Tue, 16 Jan 2024 17:21:08 -0800
+Subject: [PATCH] posixtm: pacify clang 18
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Problem reported by Khem Raj in:
+https://lists.gnu.org/r/bug-gnulib/2024-01/msg00045.html
+* lib/posixtm.c (posixtime): Pacify clang 18 by converting bool to int.
+Arguably this is a bug in draft C2x, since the non-pointer args to
+ckd_add should promote just like any other expressions do;
+but that’s not clang’s fault.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00046.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ ChangeLog     | 10 ++++++++++
+ lib/posixtm.c |  2 +-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/lib/posixtm.c b/lib/posixtm.c
+index ef9f55f873..a072c7cad0 100644
+--- a/lib/posixtm.c
++++ b/lib/posixtm.c
+@@ -191,7 +191,7 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
+              | (tm0.tm_min ^ tm1.tm_min)
+              | (tm0.tm_sec ^ tm1.tm_sec)))
+         {
+-          if (ckd_add (&t, t, leapsec))
++          if (ckd_add (&t, t, +leapsec))
+             return false;
+           *p = t;
+           return true;
+-- 
+2.43.0
+
diff --git a/meta/recipes-core/coreutils/coreutils_9.4.bb b/meta/recipes-core/coreutils/coreutils_9.4.bb
index c0ca150253b..f233ce07eb8 100644
--- a/meta/recipes-core/coreutils/coreutils_9.4.bb
+++ b/meta/recipes-core/coreutils/coreutils_9.4.bb
@@ -16,6 +16,7 @@  inherit autotools gettext texinfo
 SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
            file://remove-usr-local-lib-from-m4.patch \
            file://0001-local.mk-fix-cross-compiling-problem.patch \
+           file://0001-posixtm-pacify-clang-18.patch \
            file://run-ptest \
            "
 SRC_URI[sha256sum] = "ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e52"