]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: Update description of C library facilities provided by GCC for C23
authorJoseph Myers <josmyers@redhat.com>
Fri, 30 May 2025 20:15:53 +0000 (20:15 +0000)
committerJoseph Myers <josmyers@redhat.com>
Fri, 30 May 2025 20:15:53 +0000 (20:15 +0000)
commitdd9b6035a317a70a33112b830ce96b381d323af4
tree3ce6065d0e85bf45fbc852a78b91ae8d9c454e64
parent490072b927dac2f57e541b0ee680896e23c5d998
c: Update description of C library facilities provided by GCC for C23

The documentation of which standard C library facilities (headers) are
provided by GCC, as being those required of freestanding
implementations, is reasonably accurate for C99 and before (if you
ignore the provision of <tgmath.h> for non-GNU targets).  It's less
accurate for C11, since we provide <stdatomic.h> although that's not
required for freestanding implementations.  And it's very inaccurate
for C23, which specifies that freestanding implementations also
provide most of <string.h>, memalignment from <stdlib.h>, and, when
supporting Annex F, also <fenv.h>, <math.h> and the strto*
floating-point numeric conversion functions from <stdlib.h>.

I don't think expanding the scope of the C library facilities GCC
provides to include all those extra facilities specified by C23 for
freestanding implementations is a good idea.  (Indeed, GCC once used
to install assert.h on some platforms, but stopped doing so a long
time ago.)  Rather, it seems better to document that in both the
freestanding and the hosted cases, GCC is intended to provide the
compiler part of a conforming implementation, to be combined with a
corresponding library implementation, rather than providing all the
required library facilities in either case.

The rule about which headers GCC provides is then described in terms
of headers not declaring functions with external linkage, which is
much closer to existing practice, although still not perfect in all
cases (<stdatomic.h>, although mainly providing type-generic
operations, does declare a few non-type-generic functions that we
provide in libatomic).

A paragraph in trouble.texi that talks about freestanding
implementations with -ansi -pedantic is not changed (given that the
description in terms of freestanding implementations is sufficiently
accurate for C90); if the -ansi there were changed to an option for a
more recent standard, a corresponding change to that paragraph might
be needed as well.

Tested with "make info html pdf".

* doc/standards.texi (C Language): Document library facilities
provided in terms of headers not declaring functions with external
linkage, not in terms of headers required of freestanding
implementations.
* doc/sourcebuild.texi (Subdirectories, Headers): Likewise.
* doc/trouble.texi (Standard Libraries): Likewise.
gcc/doc/sourcebuild.texi
gcc/doc/standards.texi
gcc/doc/trouble.texi