Re: C23 support in Autoconf
Alan Coopersmith <[email protected]> Tue, 30 Apr 2024 11:24:14 -0700
| Newsgroups | gmane.comp.sysutils.autoconf.general |
|---|---|
| Message-ID | <[email protected]> |
On 4/30/24 10:51, Paul Eggert wrote:
> I installed the attached patch into Savannah master to get the ball rolling on
> Autoconf supporting C23.
>
> Most C23 compatibility gizmos are now done in Gnulib. However, Autoconf's
> AC_PROG_CC needs to be changed to tack --std=gnu23 onto $CC. Although this may
> cause a few backward compatibility hassles with ancient packages that still use
> K&R C functions, C23 means these packages need to be changed to use function
> prototypes anyway.
Just FYI, from my experiments building the X.Org packages (a code base that
still has many bits originally written before the C89 standard) with gcc 13.2
and --std=gnu23, the biggest source of problems was not function prototypes,
but the change of "true" and "false" to no longer be acceptable lvalues,
and of "bool" to be a builtin type.
Fortunately in our cases, the patches were small & simple:
https://gitlab.freedesktop.org/xorg/app/xprop/-/commit/0d2837162ef0e54647485eee2ba4b88012fbb1b4
https://gitlab.freedesktop.org/xorg/lib/libxt/-/commit/56875344b2a62845b8a494830bfb0a5f6ed2d3d6
https://gitlab.freedesktop.org/xorg/driver/xf86-video-vbox/-/commit/b66441a27fa85e2a3b63f10a0a5a846344327042
but I know we're not alone here with these changes, even in much newer code:
https://gitlab.freedesktop.org/cairo/cairo/-/issues/825
https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/a0b1329ee6cce22aca0c9b064fe9c136cc05d630
Of course, our experience is somewhat biased by the XORG_COMPILER_FLAGS macro
in our xorg-macros.m4 set of autoconf macros having included
-Wold-style-definition in our default CFLAGS since 2011.
--
-Alan Coopersmith- [email protected]
Oracle Solaris Engineering - https://blogs.oracle.com/solaris