diff options
author | Zack Weinberg <zackw@panix.com> | 2020-12-06 11:40:39 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-12-06 11:40:39 -0500 |
commit | b045574cb2ea1c8441be7a7b56fd471d704ebf3a (patch) | |
tree | 4e93553716d40939551f142b3b2121f5cbe59a42 /tests/tools.at | |
parent | c467efab94cd2d0331655d68d067fa0719fc8762 (diff) | |
download | autoconf-b045574cb2ea1c8441be7a7b56fd471d704ebf3a.tar.gz |
AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)
Since 1993, Autoconf has been assuming that it is safe to include any
of the headers defined by ISO C90 without checking for them; this is
inaccurate, since only a subset are necessarily available in a
C90 *freestanding* environment.
It is OK to assume the presence of a header in a macro that checks
specifically for something declared by that header (if the header is
not present, we will think the specific declaration is unavailable,
which is probably accurate for modern embedded environments). It is
also OK to continue recommending that user code use these headers
unconditionally—anyone working with a freestanding environment knows
it. But it is not OK for very generic code within Autoconf itself,
such as AC_INCLUDES_DEFAULT, to make this assumption.
Note that the set of headers that are not always available includes
stdio.h, which we have been assuming can be included unconditionally
for even longer.
In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h
before including them. Also revert to defining STDC_HEADERS only when
string.h and stdlib.h are available (but do not check for float.h and
stdarg.h, as these are part of the freestanding set). Add a new check
for stdio.h. Sort the inclusion list by standard (C90 freestanding;
C90 hosted; C99; POSIX) and alphabetically within each group. Revise
all the documentation and update the testsuite.
This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89
and is a partial fix for bug #110393.
* lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for
stdio.h, stdlib.h, and string.h before including them. Define
STDC_HEADERS only when string.h and stdlib.h are both available.
Organize includes list by standard, then alphabetically.
* doc/autoconf.texi, NEWS: Update to match.
* tests/local.at (AT_CHECK_DEFINES): Make regexes more specific.
Also expect a definition of HAVE_STDIO_H.
* tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>,
not <stdio.h>, as a header that we expect always to exist.
Add HAVE_STDIO_H to various lists of macros that are expected to
appear in config.h.
Diffstat (limited to 'tests/tools.at')
-rw-r--r-- | tests/tools.at | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/tools.at b/tests/tools.at index 967d9be1..d32ad362 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -1035,6 +1035,7 @@ AT_CHECK_AUTOHEADER([-Wno-obsolete], [ AC_APPLE_UNIVERSAL_BUILD HAVE_INTTYPES_H HAVE_STDINT_H + HAVE_STDIO_H HAVE_STDLIB_H HAVE_STRINGS_H HAVE_STRING_H |