[PATCH 3/9] libiberty: assume C89 headers
Jeff Law
jeffrey.law@oss.qualcomm.com
Sat Oct 10 18:17:15 GMT 2026
On 10/10/26 5:29 AM, Sam James wrote:
> Assume string.h, stdlib.h, and limits.h. We don't need to look for strings.h
> as we don't use any functions that are only defined in it.
>
> There are some changes to files (very) loosely based on glibc here
> but I don't think we've synced them in a very long time, and I've tried
> to keep such changes minimal.
>
> Other autoconf macros mean we don't actually save header checks in configure
> here other than limits.h for now, unfortunately.
>
> libiberty/ChangeLog:
> PR bootstrap/112422
>
> * config.h-vms: Don't define obsolete HAVE_*.
> * config.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Don't search for string.h, strings.h, stdlib.h, or
> limits.h.
> * _doprnt.c: Drop redundant ifdefs for headers.
> * acinclude.m4: Ditto.
> * alloca.c: Ditto.
> * choose-temp.c: Ditto.
> * concat.c: Ditto.
> * cp-demangle.c: Ditto.
> * cp-demint.c: Ditto.
> * cplus-dem.c: Ditto.
> * d-demangle.c: Ditto.
> * dyn-string.c: Ditto.
> * fibheap.c: Ditto.
> * filename_cmp.c: Ditto.
> * floatformat.c: Ditto.
> * getcwd.c: Ditto.
> * getopt.c: Ditto.
> * getpwd.c: Ditto.
> * hashtab.c: Ditto.
> * ldirname.c: Ditto.
> * lrealpath.c: Ditto.
> * make-relative-prefix.c: Ditto.
> * make-temp-file.c: Ditto.
> * mkstemps.c: Ditto.
> * objalloc.c: Ditto.
> * partition.c: Ditto.
> * pex-common.c: Ditto.
> * pex-djgpp.c: Ditto.
> * pex-msdos.c: Ditto.
> * pex-unix.c: Ditto.
> * pex-win32.c: Ditto.
> * pexecute.c: Ditto.
> * putenv.c: Ditto.
> * regex.c: Ditto.
> * rust-demangle.c: Ditto.
> * setenv.c: Ditto.
> * simple-object-coff.c: Ditto.
> * simple-object-elf.c: Ditto.
> * simple-object-mach-o.c: Ditto.
> * simple-object-xcoff.c: Ditto.
> * simple-object.c: Ditto.
> * sort.c: Ditto.
> * splay-tree.c: Ditto.
> * strerror.c: Ditto.
> * strsignal.c: Ditto.
> * strtol.c: Ditto.
> * strtoll.c: Ditto.
> * strtoul.c: Ditto.
> * strtoull.c: Ditto.
> * testsuite/test-demangle.c: Ditto.
> * testsuite/test-expandargv.c: Ditto.
> * testsuite/test-pexecute.c: Ditto.
> * testsuite/test-strtol.c: Ditto.
> * vasprintf.c: Ditto.
> * vprintf-support.c: Ditto.
> * vsnprintf.c: Ditto.
> * xatexit.c: Ditto.
> * xexit.c: Ditto.
> * xmalloc.c: Ditto.
> * xmemdup.c: Ditto.
> * xstrdup.c: Ditto.
> * xstrndup.c: Ditto.
> * xvasprintf.c: Ditto.
Yea, we need to be careful here since libiberty is used in other
projects that may not require a sane compiler for building. I can't
really speak for those projects.
So you're unconditionally including <stdlib.h>, in xmalloc.c, but you
left the fallback declarations of malloc, realloc & calloc. Intentional?
I think we have a similar situation with sbrk's fallback declarations.
There's probably more here. It may make sense to break this down
further. I'll keep it in my queue for another looksie.
jeff
More information about the Gcc-patches
mailing list