GNU bug report logs -
#78659
[PATCH] Pacify Clang's -Wformat-signedness.
Previous Next
To reply to this bug, email your comments to 78659 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Sun, 01 Jun 2025 05:17:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Collin Funk <collin.funk1 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 01 Jun 2025 05:17:06 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Sun, 01 Jun 2025 06:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78659 <at> debbugs.gnu.org (full text, mbox):
> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Sun, 01 Jun 2025 06:48:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78659 <at> debbugs.gnu.org (full text, mbox):
On 2025-05-31 23:24, Eli Zaretskii wrote:
> Paul, any comments or suggestions?
As a general rule of thumb, I wouldn't bother pacifying anything but the
latest GCC, especially to work around false alarms (which these are).
Since this is isn't the latest GCC and these are false alarms, I suggest
ignoring the false alarms, or silencing them by using ./configure
--disable-gcc-warnings.
Come to think of it, when building from Git maybe 'configure' should
make --enable-gcc-warnings the default only when using recent GCC.
Currently it also defaults to --enable-gcc-warnings with Clang or with
older GCC, but that's probably more trouble than it's worth.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Sun, 01 Jun 2025 07:30:06 GMT)
Full text and
rfc822 format available.
Message #14 received at 78659 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 31 May 2025 23:47:15 -0700
> Cc: 78659 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
>
> On 2025-05-31 23:24, Eli Zaretskii wrote:
> > Paul, any comments or suggestions?
>
> As a general rule of thumb, I wouldn't bother pacifying anything but the
> latest GCC, especially to work around false alarms (which these are).
> Since this is isn't the latest GCC and these are false alarms, I suggest
> ignoring the false alarms, or silencing them by using ./configure
> --disable-gcc-warnings.
Agreed.
> Come to think of it, when building from Git maybe 'configure' should
> make --enable-gcc-warnings the default only when using recent GCC.
I tend to agree, but isn't the latest GCC prone to bugs in this area?
And how can we know what is "recent GCC"?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Mon, 02 Jun 2025 01:05:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 78659 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Eli and Paul,
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Date: Sat, 31 May 2025 23:47:15 -0700
>> Cc: 78659 <at> debbugs.gnu.org
>> From: Paul Eggert <eggert <at> cs.ucla.edu>
>>
>> On 2025-05-31 23:24, Eli Zaretskii wrote:
>> > Paul, any comments or suggestions?
>>
>> As a general rule of thumb, I wouldn't bother pacifying anything but the
>> latest GCC, especially to work around false alarms (which these are).
>> Since this is isn't the latest GCC and these are false alarms, I suggest
>> ignoring the false alarms, or silencing them by using ./configure
>> --disable-gcc-warnings.
>
> Agreed.
How about just disabling this warning if Clang is being used like we do
for many others?
Simple 1 line patch attached.
Collin
[v2-0001-Pacify-Clang-s-Wformat-signedness.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Mon, 02 Jun 2025 07:27:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 78659 <at> debbugs.gnu.org (full text, mbox):
On 2025-06-01 00:29, Eli Zaretskii wrote:
> I tend to agree, but isn't the latest GCC prone to bugs in this area?
Not that I know of. I usually build with it.
> And how can we know what is "recent GCC"?
I suggest worrying only about the most recent stable GCC release.
Anything older than that is generally not worth worrying about, though
there may be some exceptions in extremely annoying circumstances. After
all, these warnings are meant only for developers who should be using
recent GCC anyway.
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Mon, 02 Jun 2025 07:28:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Collin Funk <collin.funk1 <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 02 Jun 2025 07:28:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 78659-done <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Mon, 02 Jun 2025 07:53:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 78659 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 2 Jun 2025 00:26:30 -0700
> Cc: collin.funk1 <at> gmail.com, 78659 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
>
> On 2025-06-01 00:29, Eli Zaretskii wrote:
> > I tend to agree, but isn't the latest GCC prone to bugs in this area?
>
> Not that I know of. I usually build with it.
>
> > And how can we know what is "recent GCC"?
>
> I suggest worrying only about the most recent stable GCC release.
> Anything older than that is generally not worth worrying about, though
> there may be some exceptions in extremely annoying circumstances. After
> all, these warnings are meant only for developers who should be using
> recent GCC anyway.
OK, but the question of how to recognize that version still stand.
Assuming we want to enable the warning automatically by some autoconf
test, that is.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Mon, 02 Jun 2025 18:26:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 78659 <at> debbugs.gnu.org (full text, mbox):
On 2025-06-02 00:52, Eli Zaretskii wrote:
> the question of how to recognize that version still stand.
That version recognition is done by configure.ac; see its use of
gl_GCC_VERSION_IFELSE. Currently the default is to enable warnings (but
don't fail the build) with any version of Clang, or with GCC 5.3 or
later. We could easily change the default to some other version.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Tue, 03 Jun 2025 11:14:07 GMT)
Full text and
rfc822 format available.
Message #34 received at 78659 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 2 Jun 2025 11:24:57 -0700
> Cc: collin.funk1 <at> gmail.com, 78659 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
>
> On 2025-06-02 00:52, Eli Zaretskii wrote:
> > the question of how to recognize that version still stand.
>
> That version recognition is done by configure.ac; see its use of
> gl_GCC_VERSION_IFELSE. Currently the default is to enable warnings (but
> don't fail the build) with any version of Clang, or with GCC 5.3 or
> later. We could easily change the default to some other version.
I see. Should we perhaps have some procedure in place to update the
cutoff version? Like in make-tarball.txt, perhaps (since releasing a
new version might be a good time to consider updating this)?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78659
; Package
emacs
.
(Wed, 04 Jun 2025 06:06:03 GMT)
Full text and
rfc822 format available.
Message #37 received at 78659 <at> debbugs.gnu.org (full text, mbox):
On 2025-06-03 04:13, Eli Zaretskii wrote:
> I see. Should we perhaps have some procedure in place to update the
> cutoff version? Like in make-tarball.txt, perhaps
Wouldn't hurt to add it to a checklist somewhere, I suppose. But since
this a developer thing, not a user thing, we can change the cutoff any
time; it doesn't need to be associated with a release. It's more likely
we'd change the cutoff due to a change in Emacs's bleeding-edge code,
than due to a release.
This bug report was last modified 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.