GNU bug report logs -
#78903
[PATCH] ISO C99 does not support _Noreturn
Previous Next
To reply to this bug, email your comments to 78903 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 07:22:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Helmut Eller <eller.helmut <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 26 Jun 2025 07:22:02 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)]
Tags: patch
When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
the form
warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
To avoid those warnings, I propose to use __attribute__ ((__noreturn__))
instead.
[0001-Don-t-use-_Noreturn-with-GCC-unless-__STDC_VERSION__.patch (text/patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 07:52:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78903 <at> debbugs.gnu.org (full text, mbox):
> From: Helmut Eller <eller.helmut <at> gmail.com>
> Date: Thu, 26 Jun 2025 09:20:51 +0200
>
> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
> the form
>
> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
Why did you use -Wpedantic? The Emacs build doesn't use that, and for
a good reason.
> To avoid those warnings, I propose to use __attribute__ ((__noreturn__))
> instead.
We have already a portable solution for _Noreturn, see src/config.in.
We could modify it if needed, but I'm not sure we should try straying
too far from what we have (which works), definitely not for the
benefit of "-Wpedantic".
Paul, WDYT?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 08:10:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 78903 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jun 26 2025, Eli Zaretskii wrote:
>> From: Helmut Eller <eller.helmut <at> gmail.com>
>> Date: Thu, 26 Jun 2025 09:20:51 +0200
>>
>> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
>> the form
>>
>> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
>
> Why did you use -Wpedantic?
To get warnings when I use a non-C99 feature. Emacs' C code should be
written in C99. It would be easier to follow that rule it were checked
automatically.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 08:24:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 78903 <at> debbugs.gnu.org (full text, mbox):
> From: Helmut Eller <eller.helmut <at> gmail.com>
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 78903 <at> debbugs.gnu.org
> Date: Thu, 26 Jun 2025 10:08:54 +0200
>
> On Thu, Jun 26 2025, Eli Zaretskii wrote:
>
> >> From: Helmut Eller <eller.helmut <at> gmail.com>
> >> Date: Thu, 26 Jun 2025 09:20:51 +0200
> >>
> >> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
> >> the form
> >>
> >> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
> >
> > Why did you use -Wpedantic?
>
> To get warnings when I use a non-C99 feature. Emacs' C code should be
> written in C99. It would be easier to follow that rule it were checked
> automatically.
AFAIK, Emacs is written in C99 with extensions.
Can you tell why the definition of _Noreturn in src/config.in doesn't
work for you? AFAIU, it exactly defines _Noreturn to use
__attribute__ ((__noreturn__)), but I'm probably missing something.
is the problem that you use clang, and config.in currently doesn't
cater to that? If so, the change should be in config.in, I think.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 08:41:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 78903 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jun 26 2025, Eli Zaretskii wrote:
>> From: Helmut Eller <eller.helmut <at> gmail.com>
>> Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 78903 <at> debbugs.gnu.org
>> Date: Thu, 26 Jun 2025 10:08:54 +0200
>>
>> On Thu, Jun 26 2025, Eli Zaretskii wrote:
>>
>> >> From: Helmut Eller <eller.helmut <at> gmail.com>
>> >> Date: Thu, 26 Jun 2025 09:20:51 +0200
>> >>
>> >> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
>> >> the form
>> >>
>> >> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
>> >
>> > Why did you use -Wpedantic?
>>
>> To get warnings when I use a non-C99 feature. Emacs' C code should be
>> written in C99. It would be easier to follow that rule it were checked
>> automatically.
>
> AFAIK, Emacs is written in C99 with extensions.
It would still be easier if the somewhat arbitrary set of extensions
would be checked automatically.
> Can you tell why the definition of _Noreturn in src/config.in doesn't
> work for you? AFAIU, it exactly defines _Noreturn to use
> __attribute__ ((__noreturn__)), but I'm probably missing something.
Without the patch, the case with the comment /* _Noreturn works as-is.
*/ is used. That causes the warnings.
> is the problem that you use clang, and config.in currently doesn't
> cater to that?
No. I don't use clang.
> If so, the change should be in config.in, I think.
I don't think so, because config.in is generated by autogen.sh.
Helmut
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 09:14:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 78903 <at> debbugs.gnu.org (full text, mbox):
> From: Helmut Eller <eller.helmut <at> gmail.com>
> Cc: eggert <at> cs.ucla.edu, 78903 <at> debbugs.gnu.org
> Date: Thu, 26 Jun 2025 10:40:47 +0200
>
> On Thu, Jun 26 2025, Eli Zaretskii wrote:
>
> >> From: Helmut Eller <eller.helmut <at> gmail.com>
> >> Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 78903 <at> debbugs.gnu.org
> >> Date: Thu, 26 Jun 2025 10:08:54 +0200
> >>
> >> On Thu, Jun 26 2025, Eli Zaretskii wrote:
> >>
> >> >> From: Helmut Eller <eller.helmut <at> gmail.com>
> >> >> Date: Thu, 26 Jun 2025 09:20:51 +0200
> >> >>
> >> >> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
> >> >> the form
> >> >>
> >> >> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
> >> >
> >> > Why did you use -Wpedantic?
> >>
> >> To get warnings when I use a non-C99 feature. Emacs' C code should be
> >> written in C99. It would be easier to follow that rule it were checked
> >> automatically.
> >
> > AFAIK, Emacs is written in C99 with extensions.
>
> It would still be easier if the somewhat arbitrary set of extensions
> would be checked automatically.
>
> > Can you tell why the definition of _Noreturn in src/config.in doesn't
> > work for you? AFAIU, it exactly defines _Noreturn to use
> > __attribute__ ((__noreturn__)), but I'm probably missing something.
>
> Without the patch, the case with the comment /* _Noreturn works as-is.
> */ is used. That causes the warnings.
>
> > is the problem that you use clang, and config.in currently doesn't
> > cater to that?
>
> No. I don't use clang.
>
> > If so, the change should be in config.in, I think.
>
> I don't think so, because config.in is generated by autogen.sh.
OK, let's see what Paul thinks about this.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 18:44:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 78903 <at> debbugs.gnu.org (full text, mbox):
On 2025-06-26 01:08, Helmut Eller wrote:
> On Thu, Jun 26 2025, Eli Zaretskii wrote:
>
>>> From: Helmut Eller<eller.helmut <at> gmail.com>
>>> Date: Thu, 26 Jun 2025 09:20:51 +0200
>>>
>>> When I use gcc 14 with -std=gnu99 -Wpedantic I get lots of warnings of
>>> the form
>>>
>>> warning: ISO C99 does not support ‘_Noreturn’ [-Wpedantic].
>> Why did you use -Wpedantic?
> To get warnings when I use a non-C99 feature.
To do that, you can run something like this:
./configure CFLAGS='-std=c99 -Wpedantic'
make
You'll still see many warnings, though none about _Noreturn.
'-std=gnu99' says "it's OK to use GNU extensions" and so is not the best
choice to test for C99 conformance. '-std=c99' is better (though still
not perfect of course). Running 'configure' as shown above should avoid
the _Noreturn warnings you mentioned.
Alternatively, you can compile with -D_Noreturn='__attribute__
((__noreturn__))'.
Not sure it's worth changing Gnulib to support what appears to be a GCC
option clash. I suppose I could ask on bug-gnulib.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Thu, 26 Jun 2025 21:07:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 78903 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
After looking at the definition of _Noreturn, perhaps you're right and
it would be a win to simplify m4/gnulib-common.m4, which should pacify
the unusual GCC configuration you mentioned. Does the attached patch
work for you?
[noreturn.diff (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78903
; Package
emacs
.
(Fri, 27 Jun 2025 14:06:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 78903 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jun 26 2025, Paul Eggert wrote:
> After looking at the definition of _Noreturn, perhaps you're right and
> it would be a win to simplify m4/gnulib-common.m4, which should pacify
> the unusual GCC configuration you mentioned. Does the attached patch
> work for you?
Yes, after a fashion. The combination -Og -std=gnu99 -Wpedantic is
usable; -Og -std=cc99 -Wpedantic produces fewer warnings though. With
-O0, both -std=gnu99 and -std=c99 produce too many warnings about
statement expressions to be of any use.
I would place the 201112 <= STDC_VERSION test first and only if it fails
fall back to __attribute__((__return__)).
Helmut
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.