From fa86c4df89ef7ee58b7608bfa95c4b0cc9539ab0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 16 Jan 2024 17:21:08 -0800 Subject: [PATCH] posixtm: pacify clang 18 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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. --- ChangeLog | 10 ++++++++++ lib/posixtm.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7d58e6b67..b0ec990055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-01-16 Paul Eggert + + posixtm: pacify clang 18 + 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. + 2024-01-15 Bruno Haible test-framework-sh: Improve portability to native Windows and OS/2. diff --git a/lib/posixtm.c b/lib/posixtm.c index 43d65f5975..a072c7cad0 100644 --- a/lib/posixtm.c +++ b/lib/posixtm.c @@ -1,6 +1,6 @@ /* Parse dates for touch and date. - Copyright (C) 1989-1991, 1998, 2000-2023 Free Software Foundation, Inc. + Copyright (C) 1989-1991, 1998, 2000-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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.39.5