GNU bug report logs - #78659
[PATCH] Pacify Clang's -Wformat-signedness.

Previous Next

Package: emacs;

Reported by: Collin Funk <collin.funk1 <at> gmail.com>

Date: Sun, 1 Jun 2025 05:17:05 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Full log


Message #8 received at 78659 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Collin Funk <collin.funk1 <at> gmail.com>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 78659 <at> debbugs.gnu.org
Subject: Re: bug#78659: [PATCH] Pacify Clang's -Wformat-signedness.
Date: Sun, 01 Jun 2025 09:24:07 +0300
> From: Collin Funk <collin.funk1 <at> gmail.com>
> Date: Sat, 31 May 2025 22:16:15 -0700
> 
> When compiling with './autogen.sh && ./configure CC=clang && make':
> 
>     [...]
>     xfns.c:2041:6: warning: format specifies type 'unsigned int' but the argument has type 'int' [-Wformat]
>      2040 |           sprintf (css, "scrollbar slider { background-color: #%02x%02x%02x; }",
>           |                                                                ~~~~
>           |                                                                %02x
>      2041 |                    color.red >> 8, color.green >> 8, color.blue >> 8);
>     [...]
> 
> This warning is harmless, but interestingly 'gcc -Wformat-signedness'
> does not warn about it, but 'clang -Wformat-signedness' does.
> 
> Since the color fields of struct XColor are 'unsigned short' and the
> constant is an 'int', the expression should be an 'int'.
> 
> Anyways, the attached patch silences the warnings.

Thanks.

Paul, any comments or suggestions?




This bug report was last modified 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.