Patrick Williams | f52e3dd | 2024-01-26 13:04:43 -0600 | [diff] [blame] | 1 | From 67c298c36f69b6906840b7584be06b7b5f33f829 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Eggert <eggert@cs.ucla.edu> |
| 3 | Date: Tue, 16 Jan 2024 17:21:08 -0800 |
| 4 | Subject: [PATCH] posixtm: pacify clang 18 |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | Problem reported by Khem Raj in: |
| 10 | https://lists.gnu.org/r/bug-gnulib/2024-01/msg00045.html |
| 11 | * lib/posixtm.c (posixtime): Pacify clang 18 by converting bool to int. |
| 12 | Arguably this is a bug in draft C2x, since the non-pointer args to |
| 13 | ckd_add should promote just like any other expressions do; |
| 14 | but that’s not clang’s fault. |
| 15 | |
| 16 | Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00046.html] |
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 18 | --- |
| 19 | ChangeLog | 10 ++++++++++ |
| 20 | lib/posixtm.c | 2 +- |
| 21 | 2 files changed, 11 insertions(+), 1 deletion(-) |
| 22 | |
| 23 | diff --git a/lib/posixtm.c b/lib/posixtm.c |
| 24 | index ef9f55f873..a072c7cad0 100644 |
| 25 | --- a/lib/posixtm.c |
| 26 | +++ b/lib/posixtm.c |
| 27 | @@ -191,7 +191,7 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits) |
| 28 | | (tm0.tm_min ^ tm1.tm_min) |
| 29 | | (tm0.tm_sec ^ tm1.tm_sec))) |
| 30 | { |
| 31 | - if (ckd_add (&t, t, leapsec)) |
| 32 | + if (ckd_add (&t, t, +leapsec)) |
| 33 | return false; |
| 34 | *p = t; |
| 35 | return true; |
| 36 | -- |
| 37 | 2.43.0 |
| 38 | |