Subject: bug#78903: [PATCH] ISO C99 does not support _Noreturn

From: Helmut Eller <[email-masked]>
Date: Sat, 28 Jun 2025 21:57:39 +0200

On Sat, Jun 28 2025, Paul Eggert wrote:

> On 2025-06-27 07:05, Helmut Eller wrote:
>> 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.
>
> You can suppress those statement-expression warnings by configuring
> this way:
>
>   ./configure \
>     CFLAGS='-O0 -std=c99 -Wpedantic' \
>     emacs_cv_statement_expressions=no

That's useful.  I didn't know about this.  Thanks.

> I did that, and the resulting build generated several warnings about
> converting between function and data pointers that don't matter on any
> practical platform that I know of. I'm not sure it's worth the hassle
> to pacify GCC about them.

Probably not; there aren't that many.  It's an odd warning that deserves
the name "pedantic."

> I did find a few other C99 violations, though, and fixed them by
> installing the attached patch.

Thanks.

> Is it still important that Emacs port to C99? Perhaps we should
> upgrade the build requirement to C11 or later. It has been 14 years
> since C11, after all....

Not my decision to make.  Some lightweight compilers like Tiny CC or PCC
apparently only support C99.  Not sure how relevant those are, though.

>> I would place the 201112 <= STDC_VERSION test first and only if it fails
>> fall back to __attribute__((__return__)).
>
> Thanks for checking. I made the changes you suggested to Gnulib, and
> updated Emacs master from Gnulib. Please give it a try.

Oh. That must have been a lot of work.  Thanks again.

Helmut