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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#78659: closed ([PATCH] Pacify Clang's -Wformat-signedness.)
Date: Mon, 02 Jun 2025 07:28:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 2 Jun 2025 00:27:31 -0700
with message-id <70d89b66-b69a-4662-b73d-5abcf49ab12b <at> cs.ucla.edu>
and subject line Re: bug#78659: [PATCH] Pacify Clang's -Wformat-signedness.
has caused the debbugs.gnu.org bug report #78659,
regarding [PATCH] Pacify Clang's -Wformat-signedness.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
78659: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78659
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Collin Funk <collin.funk1 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Pacify Clang's -Wformat-signedness.
Date: Sat, 31 May 2025 22:16:15 -0700
[Message part 3 (text/plain, inline)]
Hi,

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.

Collin

[0001-Pacify-Clang-s-Wformat-signedness.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Collin Funk <collin.funk1 <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 78659-done <at> debbugs.gnu.org
Subject: Re: bug#78659: [PATCH] Pacify Clang's -Wformat-signedness.
Date: Mon, 2 Jun 2025 00:27:31 -0700
On 2025-06-01 18:04, Collin Funk wrote:
> How about just disabling this warning if Clang is being used like we do
> for many others?

Thanks, I installed that. Closing the bug report.


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.