From de3d8ae71b43f80244c4d813ff1503b8551f0026 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 24 Jan 2023 10:23:52 +0800 Subject: [PATCH] Update android port * xcompile: Move to cross. * cross: New directory. --- {xcompile => cross}/lib/COPYING | 0 {xcompile => cross}/lib/acl-errno-valid.c | 0 {xcompile => cross}/lib/acl-internal.c | 0 {xcompile => cross}/lib/acl-internal.h | 0 {xcompile => cross}/lib/acl.h | 0 {xcompile => cross}/lib/acl_entries.c | 0 {xcompile => cross}/lib/af_alg.h | 0 {xcompile => cross}/lib/alloca.in.h | 0 {xcompile => cross}/lib/allocator.c | 0 {xcompile => cross}/lib/allocator.h | 0 {xcompile => cross}/lib/arg-nonnull.h | 0 {xcompile => cross}/lib/assert.in.h | 0 {xcompile => cross}/lib/at-func.c | 0 {xcompile => cross}/lib/attribute.h | 0 {xcompile => cross}/lib/binary-io.c | 0 {xcompile => cross}/lib/binary-io.h | 0 {xcompile => cross}/lib/byteswap.in.h | 0 {xcompile => cross}/lib/c++defs.h | 0 {xcompile => cross}/lib/c-ctype.c | 0 {xcompile => cross}/lib/c-ctype.h | 0 {xcompile => cross}/lib/c-strcase.h | 0 {xcompile => cross}/lib/c-strcasecmp.c | 0 {xcompile => cross}/lib/c-strncasecmp.c | 0 {xcompile => cross}/lib/canonicalize-lgpl.c | 0 {xcompile => cross}/lib/careadlinkat.c | 0 {xcompile => cross}/lib/careadlinkat.h | 0 {xcompile => cross}/lib/cdefs.h | 0 {xcompile => cross}/lib/cloexec.c | 0 {xcompile => cross}/lib/cloexec.h | 0 {xcompile => cross}/lib/close-stream.c | 0 {xcompile => cross}/lib/close-stream.h | 0 {xcompile => cross}/lib/copy-file-range.c | 0 {xcompile => cross}/lib/count-leading-zeros.c | 0 {xcompile => cross}/lib/count-leading-zeros.h | 0 {xcompile => cross}/lib/count-one-bits.c | 0 {xcompile => cross}/lib/count-one-bits.h | 0 .../lib/count-trailing-zeros.c | 0 .../lib/count-trailing-zeros.h | 0 {xcompile => cross}/lib/diffseq.h | 0 {xcompile => cross}/lib/dirent.in.h | 0 {xcompile => cross}/lib/dirfd.c | 0 {xcompile => cross}/lib/dtoastr.c | 0 {xcompile => cross}/lib/dtotimespec.c | 0 {xcompile => cross}/lib/dup2.c | 0 {xcompile => cross}/lib/dynarray.h | 0 {xcompile => cross}/lib/eloop-threshold.h | 0 {xcompile => cross}/lib/errno.in.h | 0 {xcompile => cross}/lib/euidaccess.c | 0 {xcompile => cross}/lib/execinfo.c | 0 {xcompile => cross}/lib/execinfo.in.h | 0 {xcompile => cross}/lib/explicit_bzero.c | 0 {xcompile => cross}/lib/faccessat.c | 0 {xcompile => cross}/lib/fchmodat.c | 0 {xcompile => cross}/lib/fcntl.c | 0 {xcompile => cross}/lib/fcntl.in.h | 0 {xcompile => cross}/lib/fdopendir.c | 0 {xcompile => cross}/lib/file-has-acl.c | 0 {xcompile => cross}/lib/filemode.c | 0 {xcompile => cross}/lib/filemode.h | 0 {xcompile => cross}/lib/filename.h | 0 {xcompile => cross}/lib/filevercmp.c | 0 {xcompile => cross}/lib/filevercmp.h | 0 {xcompile => cross}/lib/fingerprint.c | 0 {xcompile => cross}/lib/fingerprint.h | 0 {xcompile => cross}/lib/flexmember.h | 0 {xcompile => cross}/lib/fpending.c | 0 {xcompile => cross}/lib/fpending.h | 0 {xcompile => cross}/lib/free.c | 0 {xcompile => cross}/lib/fstatat.c | 0 {xcompile => cross}/lib/fsusage.c | 0 {xcompile => cross}/lib/fsusage.h | 0 {xcompile => cross}/lib/fsync.c | 0 {xcompile => cross}/lib/ftoastr.c | 0 {xcompile => cross}/lib/ftoastr.h | 0 {xcompile => cross}/lib/futimens.c | 0 {xcompile => cross}/lib/get-permissions.c | 0 {xcompile => cross}/lib/getdelim.c | 0 {xcompile => cross}/lib/getdtablesize.c | 0 {xcompile => cross}/lib/getgroups.c | 0 {xcompile => cross}/lib/getline.c | 0 {xcompile => cross}/lib/getloadavg.c | 0 {xcompile => cross}/lib/getopt-cdefs.in.h | 0 {xcompile => cross}/lib/getopt-core.h | 0 {xcompile => cross}/lib/getopt-ext.h | 0 {xcompile => cross}/lib/getopt-pfx-core.h | 0 {xcompile => cross}/lib/getopt-pfx-ext.h | 0 {xcompile => cross}/lib/getopt.c | 0 {xcompile => cross}/lib/getopt.in.h | 0 {xcompile => cross}/lib/getopt1.c | 0 {xcompile => cross}/lib/getopt_int.h | 0 {xcompile => cross}/lib/getrandom.c | 0 {xcompile => cross}/lib/gettext.h | 0 {xcompile => cross}/lib/gettime.c | 0 {xcompile => cross}/lib/gettimeofday.c | 0 {xcompile => cross}/lib/group-member.c | 0 {xcompile => cross}/lib/idx.h | 0 {xcompile => cross}/lib/ieee754.in.h | 0 {xcompile => cross}/lib/ignore-value.h | 0 {xcompile => cross}/lib/intprops-internal.h | 0 {xcompile => cross}/lib/intprops.h | 0 {xcompile => cross}/lib/inttypes.in.h | 0 {xcompile => cross}/lib/lchmod.c | 0 {xcompile => cross}/lib/libc-config.h | 0 {xcompile => cross}/lib/limits.in.h | 0 {xcompile => cross}/lib/lstat.c | 0 {xcompile => cross}/lib/malloc.c | 0 .../lib/malloc/dynarray-skeleton.c | 0 {xcompile => cross}/lib/malloc/dynarray.h | 0 .../lib/malloc/dynarray_at_failure.c | 0 .../lib/malloc/dynarray_emplace_enlarge.c | 0 .../lib/malloc/dynarray_finalize.c | 0 .../lib/malloc/dynarray_resize.c | 0 .../lib/malloc/dynarray_resize_clear.c | 0 .../lib/malloc/scratch_buffer.h | 0 .../lib/malloc/scratch_buffer_dupfree.c | 0 .../lib/malloc/scratch_buffer_grow.c | 0 .../lib/malloc/scratch_buffer_grow_preserve.c | 0 .../malloc/scratch_buffer_set_array_size.c | 0 {xcompile => cross}/lib/md5-stream.c | 0 {xcompile => cross}/lib/md5.c | 0 {xcompile => cross}/lib/md5.h | 0 {xcompile => cross}/lib/memmem.c | 0 {xcompile => cross}/lib/mempcpy.c | 0 {xcompile => cross}/lib/memrchr.c | 0 {xcompile => cross}/lib/memset_explicit.c | 0 {xcompile => cross}/lib/min-max.h | 0 {xcompile => cross}/lib/mini-gmp-gnulib.c | 0 {xcompile => cross}/lib/mini-gmp.c | 0 {xcompile => cross}/lib/mini-gmp.h | 0 {xcompile => cross}/lib/minmax.h | 0 {xcompile => cross}/lib/mkostemp.c | 0 {xcompile => cross}/lib/mktime-internal.h | 0 {xcompile => cross}/lib/mktime.c | 0 {xcompile => cross}/lib/nanosleep.c | 0 {xcompile => cross}/lib/nproc.c | 0 {xcompile => cross}/lib/nproc.h | 0 {xcompile => cross}/lib/nstrftime.c | 0 {xcompile => cross}/lib/open.c | 0 {xcompile => cross}/lib/openat-die.c | 0 {xcompile => cross}/lib/openat-priv.h | 0 {xcompile => cross}/lib/openat-proc.c | 0 {xcompile => cross}/lib/openat.h | 0 {xcompile => cross}/lib/pathmax.h | 0 {xcompile => cross}/lib/pipe2.c | 0 {xcompile => cross}/lib/pselect.c | 0 {xcompile => cross}/lib/pthread_sigmask.c | 0 {xcompile => cross}/lib/qcopy-acl.c | 0 {xcompile => cross}/lib/rawmemchr.c | 0 {xcompile => cross}/lib/rawmemchr.valgrind | 0 {xcompile => cross}/lib/readlink.c | 0 {xcompile => cross}/lib/readlinkat.c | 0 {xcompile => cross}/lib/realloc.c | 0 {xcompile => cross}/lib/regcomp.c | 0 {xcompile => cross}/lib/regex.c | 0 {xcompile => cross}/lib/regex.h | 0 {xcompile => cross}/lib/regex_internal.c | 0 {xcompile => cross}/lib/regex_internal.h | 0 {xcompile => cross}/lib/regexec.c | 0 {xcompile => cross}/lib/root-uid.h | 0 {xcompile => cross}/lib/save-cwd.c | 0 {xcompile => cross}/lib/save-cwd.h | 0 {xcompile => cross}/lib/scratch_buffer.h | 0 {xcompile => cross}/lib/set-permissions.c | 0 {xcompile => cross}/lib/sha1.c | 0 {xcompile => cross}/lib/sha1.h | 0 {xcompile => cross}/lib/sha256.c | 0 {xcompile => cross}/lib/sha256.h | 0 {xcompile => cross}/lib/sha512.c | 0 {xcompile => cross}/lib/sha512.h | 0 {xcompile => cross}/lib/sig2str.c | 0 {xcompile => cross}/lib/sig2str.h | 0 {xcompile => cross}/lib/sigdescr_np.c | 0 {xcompile => cross}/lib/signal.in.h | 0 {xcompile => cross}/lib/stat-time.c | 0 {xcompile => cross}/lib/stat-time.h | 0 cross/lib/stdalign.in.h | 34 + cross/lib/stdckdint.in.h | 35 + cross/lib/stddef.in.h | 147 ++ cross/lib/stdint.in.h | 740 +++++++ cross/lib/stdio-impl.h | 218 +++ cross/lib/stdio.in.h | 1719 +++++++++++++++++ cross/lib/stdlib.in.h | 1563 +++++++++++++++ {xcompile => cross}/lib/stpcpy.c | 0 {xcompile => cross}/lib/str-two-way.h | 0 {xcompile => cross}/lib/strftime.h | 0 {xcompile => cross}/lib/string.in.h | 0 {xcompile => cross}/lib/strnlen.c | 0 {xcompile => cross}/lib/strtoimax.c | 0 {xcompile => cross}/lib/strtol.c | 0 {xcompile => cross}/lib/strtoll.c | 0 {xcompile => cross}/lib/symlink.c | 0 {xcompile => cross}/lib/sys_random.in.h | 0 {xcompile => cross}/lib/sys_select.in.h | 0 {xcompile => cross}/lib/sys_stat.in.h | 0 {xcompile => cross}/lib/sys_time.in.h | 0 {xcompile => cross}/lib/sys_types.in.h | 0 {xcompile => cross}/lib/tempname.c | 0 {xcompile => cross}/lib/tempname.h | 0 {xcompile => cross}/lib/time-internal.h | 0 {xcompile => cross}/lib/time.in.h | 0 {xcompile => cross}/lib/time_r.c | 0 {xcompile => cross}/lib/time_rz.c | 0 {xcompile => cross}/lib/timegm.c | 0 {xcompile => cross}/lib/timespec-add.c | 0 {xcompile => cross}/lib/timespec-sub.c | 0 {xcompile => cross}/lib/timespec.c | 0 {xcompile => cross}/lib/timespec.h | 0 {xcompile => cross}/lib/u64.c | 0 {xcompile => cross}/lib/u64.h | 0 {xcompile => cross}/lib/unistd.c | 0 {xcompile => cross}/lib/unistd.in.h | 0 {xcompile => cross}/lib/unlocked-io.h | 0 {xcompile => cross}/lib/utimens.c | 0 {xcompile => cross}/lib/utimens.h | 0 {xcompile => cross}/lib/utimensat.c | 0 {xcompile => cross}/lib/verify.h | 0 {xcompile => cross}/lib/vla.h | 0 {xcompile => cross}/lib/warn-on-use.h | 0 {xcompile => cross}/lib/xalloc-oversized.h | 0 xcompile/Makefile.in | 176 -- xcompile/README | 3 - xcompile/langinfo.h | 20 - xcompile/malloc/dynarray-skeleton.c | 528 ----- xcompile/malloc/dynarray.h | 177 -- xcompile/malloc/dynarray_at_failure.c | 40 - xcompile/malloc/dynarray_emplace_enlarge.c | 77 - xcompile/malloc/dynarray_finalize.c | 66 - xcompile/malloc/dynarray_resize.c | 68 - xcompile/malloc/dynarray_resize_clear.c | 39 - xcompile/malloc/scratch_buffer.h | 135 -- xcompile/malloc/scratch_buffer_dupfree.c | 41 - xcompile/malloc/scratch_buffer_grow.c | 56 - .../malloc/scratch_buffer_grow_preserve.c | 67 - .../malloc/scratch_buffer_set_array_size.c | 64 - xcompile/verbose.mk.android | 65 - 235 files changed, 4456 insertions(+), 1622 deletions(-) rename {xcompile => cross}/lib/COPYING (100%) rename {xcompile => cross}/lib/acl-errno-valid.c (100%) rename {xcompile => cross}/lib/acl-internal.c (100%) rename {xcompile => cross}/lib/acl-internal.h (100%) rename {xcompile => cross}/lib/acl.h (100%) rename {xcompile => cross}/lib/acl_entries.c (100%) rename {xcompile => cross}/lib/af_alg.h (100%) rename {xcompile => cross}/lib/alloca.in.h (100%) rename {xcompile => cross}/lib/allocator.c (100%) rename {xcompile => cross}/lib/allocator.h (100%) rename {xcompile => cross}/lib/arg-nonnull.h (100%) rename {xcompile => cross}/lib/assert.in.h (100%) rename {xcompile => cross}/lib/at-func.c (100%) rename {xcompile => cross}/lib/attribute.h (100%) rename {xcompile => cross}/lib/binary-io.c (100%) rename {xcompile => cross}/lib/binary-io.h (100%) rename {xcompile => cross}/lib/byteswap.in.h (100%) rename {xcompile => cross}/lib/c++defs.h (100%) rename {xcompile => cross}/lib/c-ctype.c (100%) rename {xcompile => cross}/lib/c-ctype.h (100%) rename {xcompile => cross}/lib/c-strcase.h (100%) rename {xcompile => cross}/lib/c-strcasecmp.c (100%) rename {xcompile => cross}/lib/c-strncasecmp.c (100%) rename {xcompile => cross}/lib/canonicalize-lgpl.c (100%) rename {xcompile => cross}/lib/careadlinkat.c (100%) rename {xcompile => cross}/lib/careadlinkat.h (100%) rename {xcompile => cross}/lib/cdefs.h (100%) rename {xcompile => cross}/lib/cloexec.c (100%) rename {xcompile => cross}/lib/cloexec.h (100%) rename {xcompile => cross}/lib/close-stream.c (100%) rename {xcompile => cross}/lib/close-stream.h (100%) rename {xcompile => cross}/lib/copy-file-range.c (100%) rename {xcompile => cross}/lib/count-leading-zeros.c (100%) rename {xcompile => cross}/lib/count-leading-zeros.h (100%) rename {xcompile => cross}/lib/count-one-bits.c (100%) rename {xcompile => cross}/lib/count-one-bits.h (100%) rename {xcompile => cross}/lib/count-trailing-zeros.c (100%) rename {xcompile => cross}/lib/count-trailing-zeros.h (100%) rename {xcompile => cross}/lib/diffseq.h (100%) rename {xcompile => cross}/lib/dirent.in.h (100%) rename {xcompile => cross}/lib/dirfd.c (100%) rename {xcompile => cross}/lib/dtoastr.c (100%) rename {xcompile => cross}/lib/dtotimespec.c (100%) rename {xcompile => cross}/lib/dup2.c (100%) rename {xcompile => cross}/lib/dynarray.h (100%) rename {xcompile => cross}/lib/eloop-threshold.h (100%) rename {xcompile => cross}/lib/errno.in.h (100%) rename {xcompile => cross}/lib/euidaccess.c (100%) rename {xcompile => cross}/lib/execinfo.c (100%) rename {xcompile => cross}/lib/execinfo.in.h (100%) rename {xcompile => cross}/lib/explicit_bzero.c (100%) rename {xcompile => cross}/lib/faccessat.c (100%) rename {xcompile => cross}/lib/fchmodat.c (100%) rename {xcompile => cross}/lib/fcntl.c (100%) rename {xcompile => cross}/lib/fcntl.in.h (100%) rename {xcompile => cross}/lib/fdopendir.c (100%) rename {xcompile => cross}/lib/file-has-acl.c (100%) rename {xcompile => cross}/lib/filemode.c (100%) rename {xcompile => cross}/lib/filemode.h (100%) rename {xcompile => cross}/lib/filename.h (100%) rename {xcompile => cross}/lib/filevercmp.c (100%) rename {xcompile => cross}/lib/filevercmp.h (100%) rename {xcompile => cross}/lib/fingerprint.c (100%) rename {xcompile => cross}/lib/fingerprint.h (100%) rename {xcompile => cross}/lib/flexmember.h (100%) rename {xcompile => cross}/lib/fpending.c (100%) rename {xcompile => cross}/lib/fpending.h (100%) rename {xcompile => cross}/lib/free.c (100%) rename {xcompile => cross}/lib/fstatat.c (100%) rename {xcompile => cross}/lib/fsusage.c (100%) rename {xcompile => cross}/lib/fsusage.h (100%) rename {xcompile => cross}/lib/fsync.c (100%) rename {xcompile => cross}/lib/ftoastr.c (100%) rename {xcompile => cross}/lib/ftoastr.h (100%) rename {xcompile => cross}/lib/futimens.c (100%) rename {xcompile => cross}/lib/get-permissions.c (100%) rename {xcompile => cross}/lib/getdelim.c (100%) rename {xcompile => cross}/lib/getdtablesize.c (100%) rename {xcompile => cross}/lib/getgroups.c (100%) rename {xcompile => cross}/lib/getline.c (100%) rename {xcompile => cross}/lib/getloadavg.c (100%) rename {xcompile => cross}/lib/getopt-cdefs.in.h (100%) rename {xcompile => cross}/lib/getopt-core.h (100%) rename {xcompile => cross}/lib/getopt-ext.h (100%) rename {xcompile => cross}/lib/getopt-pfx-core.h (100%) rename {xcompile => cross}/lib/getopt-pfx-ext.h (100%) rename {xcompile => cross}/lib/getopt.c (100%) rename {xcompile => cross}/lib/getopt.in.h (100%) rename {xcompile => cross}/lib/getopt1.c (100%) rename {xcompile => cross}/lib/getopt_int.h (100%) rename {xcompile => cross}/lib/getrandom.c (100%) rename {xcompile => cross}/lib/gettext.h (100%) rename {xcompile => cross}/lib/gettime.c (100%) rename {xcompile => cross}/lib/gettimeofday.c (100%) rename {xcompile => cross}/lib/group-member.c (100%) rename {xcompile => cross}/lib/idx.h (100%) rename {xcompile => cross}/lib/ieee754.in.h (100%) rename {xcompile => cross}/lib/ignore-value.h (100%) rename {xcompile => cross}/lib/intprops-internal.h (100%) rename {xcompile => cross}/lib/intprops.h (100%) rename {xcompile => cross}/lib/inttypes.in.h (100%) rename {xcompile => cross}/lib/lchmod.c (100%) rename {xcompile => cross}/lib/libc-config.h (100%) rename {xcompile => cross}/lib/limits.in.h (100%) rename {xcompile => cross}/lib/lstat.c (100%) rename {xcompile => cross}/lib/malloc.c (100%) rename {xcompile => cross}/lib/malloc/dynarray-skeleton.c (100%) rename {xcompile => cross}/lib/malloc/dynarray.h (100%) rename {xcompile => cross}/lib/malloc/dynarray_at_failure.c (100%) rename {xcompile => cross}/lib/malloc/dynarray_emplace_enlarge.c (100%) rename {xcompile => cross}/lib/malloc/dynarray_finalize.c (100%) rename {xcompile => cross}/lib/malloc/dynarray_resize.c (100%) rename {xcompile => cross}/lib/malloc/dynarray_resize_clear.c (100%) rename {xcompile => cross}/lib/malloc/scratch_buffer.h (100%) rename {xcompile => cross}/lib/malloc/scratch_buffer_dupfree.c (100%) rename {xcompile => cross}/lib/malloc/scratch_buffer_grow.c (100%) rename {xcompile => cross}/lib/malloc/scratch_buffer_grow_preserve.c (100%) rename {xcompile => cross}/lib/malloc/scratch_buffer_set_array_size.c (100%) rename {xcompile => cross}/lib/md5-stream.c (100%) rename {xcompile => cross}/lib/md5.c (100%) rename {xcompile => cross}/lib/md5.h (100%) rename {xcompile => cross}/lib/memmem.c (100%) rename {xcompile => cross}/lib/mempcpy.c (100%) rename {xcompile => cross}/lib/memrchr.c (100%) rename {xcompile => cross}/lib/memset_explicit.c (100%) rename {xcompile => cross}/lib/min-max.h (100%) rename {xcompile => cross}/lib/mini-gmp-gnulib.c (100%) rename {xcompile => cross}/lib/mini-gmp.c (100%) rename {xcompile => cross}/lib/mini-gmp.h (100%) rename {xcompile => cross}/lib/minmax.h (100%) rename {xcompile => cross}/lib/mkostemp.c (100%) rename {xcompile => cross}/lib/mktime-internal.h (100%) rename {xcompile => cross}/lib/mktime.c (100%) rename {xcompile => cross}/lib/nanosleep.c (100%) rename {xcompile => cross}/lib/nproc.c (100%) rename {xcompile => cross}/lib/nproc.h (100%) rename {xcompile => cross}/lib/nstrftime.c (100%) rename {xcompile => cross}/lib/open.c (100%) rename {xcompile => cross}/lib/openat-die.c (100%) rename {xcompile => cross}/lib/openat-priv.h (100%) rename {xcompile => cross}/lib/openat-proc.c (100%) rename {xcompile => cross}/lib/openat.h (100%) rename {xcompile => cross}/lib/pathmax.h (100%) rename {xcompile => cross}/lib/pipe2.c (100%) rename {xcompile => cross}/lib/pselect.c (100%) rename {xcompile => cross}/lib/pthread_sigmask.c (100%) rename {xcompile => cross}/lib/qcopy-acl.c (100%) rename {xcompile => cross}/lib/rawmemchr.c (100%) rename {xcompile => cross}/lib/rawmemchr.valgrind (100%) rename {xcompile => cross}/lib/readlink.c (100%) rename {xcompile => cross}/lib/readlinkat.c (100%) rename {xcompile => cross}/lib/realloc.c (100%) rename {xcompile => cross}/lib/regcomp.c (100%) rename {xcompile => cross}/lib/regex.c (100%) rename {xcompile => cross}/lib/regex.h (100%) rename {xcompile => cross}/lib/regex_internal.c (100%) rename {xcompile => cross}/lib/regex_internal.h (100%) rename {xcompile => cross}/lib/regexec.c (100%) rename {xcompile => cross}/lib/root-uid.h (100%) rename {xcompile => cross}/lib/save-cwd.c (100%) rename {xcompile => cross}/lib/save-cwd.h (100%) rename {xcompile => cross}/lib/scratch_buffer.h (100%) rename {xcompile => cross}/lib/set-permissions.c (100%) rename {xcompile => cross}/lib/sha1.c (100%) rename {xcompile => cross}/lib/sha1.h (100%) rename {xcompile => cross}/lib/sha256.c (100%) rename {xcompile => cross}/lib/sha256.h (100%) rename {xcompile => cross}/lib/sha512.c (100%) rename {xcompile => cross}/lib/sha512.h (100%) rename {xcompile => cross}/lib/sig2str.c (100%) rename {xcompile => cross}/lib/sig2str.h (100%) rename {xcompile => cross}/lib/sigdescr_np.c (100%) rename {xcompile => cross}/lib/signal.in.h (100%) rename {xcompile => cross}/lib/stat-time.c (100%) rename {xcompile => cross}/lib/stat-time.h (100%) create mode 100644 cross/lib/stdalign.in.h create mode 100644 cross/lib/stdckdint.in.h create mode 100644 cross/lib/stddef.in.h create mode 100644 cross/lib/stdint.in.h create mode 100644 cross/lib/stdio-impl.h create mode 100644 cross/lib/stdio.in.h create mode 100644 cross/lib/stdlib.in.h rename {xcompile => cross}/lib/stpcpy.c (100%) rename {xcompile => cross}/lib/str-two-way.h (100%) rename {xcompile => cross}/lib/strftime.h (100%) rename {xcompile => cross}/lib/string.in.h (100%) rename {xcompile => cross}/lib/strnlen.c (100%) rename {xcompile => cross}/lib/strtoimax.c (100%) rename {xcompile => cross}/lib/strtol.c (100%) rename {xcompile => cross}/lib/strtoll.c (100%) rename {xcompile => cross}/lib/symlink.c (100%) rename {xcompile => cross}/lib/sys_random.in.h (100%) rename {xcompile => cross}/lib/sys_select.in.h (100%) rename {xcompile => cross}/lib/sys_stat.in.h (100%) rename {xcompile => cross}/lib/sys_time.in.h (100%) rename {xcompile => cross}/lib/sys_types.in.h (100%) rename {xcompile => cross}/lib/tempname.c (100%) rename {xcompile => cross}/lib/tempname.h (100%) rename {xcompile => cross}/lib/time-internal.h (100%) rename {xcompile => cross}/lib/time.in.h (100%) rename {xcompile => cross}/lib/time_r.c (100%) rename {xcompile => cross}/lib/time_rz.c (100%) rename {xcompile => cross}/lib/timegm.c (100%) rename {xcompile => cross}/lib/timespec-add.c (100%) rename {xcompile => cross}/lib/timespec-sub.c (100%) rename {xcompile => cross}/lib/timespec.c (100%) rename {xcompile => cross}/lib/timespec.h (100%) rename {xcompile => cross}/lib/u64.c (100%) rename {xcompile => cross}/lib/u64.h (100%) rename {xcompile => cross}/lib/unistd.c (100%) rename {xcompile => cross}/lib/unistd.in.h (100%) rename {xcompile => cross}/lib/unlocked-io.h (100%) rename {xcompile => cross}/lib/utimens.c (100%) rename {xcompile => cross}/lib/utimens.h (100%) rename {xcompile => cross}/lib/utimensat.c (100%) rename {xcompile => cross}/lib/verify.h (100%) rename {xcompile => cross}/lib/vla.h (100%) rename {xcompile => cross}/lib/warn-on-use.h (100%) rename {xcompile => cross}/lib/xalloc-oversized.h (100%) delete mode 100644 xcompile/Makefile.in delete mode 100644 xcompile/README delete mode 100644 xcompile/langinfo.h delete mode 100644 xcompile/malloc/dynarray-skeleton.c delete mode 100644 xcompile/malloc/dynarray.h delete mode 100644 xcompile/malloc/dynarray_at_failure.c delete mode 100644 xcompile/malloc/dynarray_emplace_enlarge.c delete mode 100644 xcompile/malloc/dynarray_finalize.c delete mode 100644 xcompile/malloc/dynarray_resize.c delete mode 100644 xcompile/malloc/dynarray_resize_clear.c delete mode 100644 xcompile/malloc/scratch_buffer.h delete mode 100644 xcompile/malloc/scratch_buffer_dupfree.c delete mode 100644 xcompile/malloc/scratch_buffer_grow.c delete mode 100644 xcompile/malloc/scratch_buffer_grow_preserve.c delete mode 100644 xcompile/malloc/scratch_buffer_set_array_size.c delete mode 100644 xcompile/verbose.mk.android diff --git a/xcompile/lib/COPYING b/cross/lib/COPYING similarity index 100% rename from xcompile/lib/COPYING rename to cross/lib/COPYING diff --git a/xcompile/lib/acl-errno-valid.c b/cross/lib/acl-errno-valid.c similarity index 100% rename from xcompile/lib/acl-errno-valid.c rename to cross/lib/acl-errno-valid.c diff --git a/xcompile/lib/acl-internal.c b/cross/lib/acl-internal.c similarity index 100% rename from xcompile/lib/acl-internal.c rename to cross/lib/acl-internal.c diff --git a/xcompile/lib/acl-internal.h b/cross/lib/acl-internal.h similarity index 100% rename from xcompile/lib/acl-internal.h rename to cross/lib/acl-internal.h diff --git a/xcompile/lib/acl.h b/cross/lib/acl.h similarity index 100% rename from xcompile/lib/acl.h rename to cross/lib/acl.h diff --git a/xcompile/lib/acl_entries.c b/cross/lib/acl_entries.c similarity index 100% rename from xcompile/lib/acl_entries.c rename to cross/lib/acl_entries.c diff --git a/xcompile/lib/af_alg.h b/cross/lib/af_alg.h similarity index 100% rename from xcompile/lib/af_alg.h rename to cross/lib/af_alg.h diff --git a/xcompile/lib/alloca.in.h b/cross/lib/alloca.in.h similarity index 100% rename from xcompile/lib/alloca.in.h rename to cross/lib/alloca.in.h diff --git a/xcompile/lib/allocator.c b/cross/lib/allocator.c similarity index 100% rename from xcompile/lib/allocator.c rename to cross/lib/allocator.c diff --git a/xcompile/lib/allocator.h b/cross/lib/allocator.h similarity index 100% rename from xcompile/lib/allocator.h rename to cross/lib/allocator.h diff --git a/xcompile/lib/arg-nonnull.h b/cross/lib/arg-nonnull.h similarity index 100% rename from xcompile/lib/arg-nonnull.h rename to cross/lib/arg-nonnull.h diff --git a/xcompile/lib/assert.in.h b/cross/lib/assert.in.h similarity index 100% rename from xcompile/lib/assert.in.h rename to cross/lib/assert.in.h diff --git a/xcompile/lib/at-func.c b/cross/lib/at-func.c similarity index 100% rename from xcompile/lib/at-func.c rename to cross/lib/at-func.c diff --git a/xcompile/lib/attribute.h b/cross/lib/attribute.h similarity index 100% rename from xcompile/lib/attribute.h rename to cross/lib/attribute.h diff --git a/xcompile/lib/binary-io.c b/cross/lib/binary-io.c similarity index 100% rename from xcompile/lib/binary-io.c rename to cross/lib/binary-io.c diff --git a/xcompile/lib/binary-io.h b/cross/lib/binary-io.h similarity index 100% rename from xcompile/lib/binary-io.h rename to cross/lib/binary-io.h diff --git a/xcompile/lib/byteswap.in.h b/cross/lib/byteswap.in.h similarity index 100% rename from xcompile/lib/byteswap.in.h rename to cross/lib/byteswap.in.h diff --git a/xcompile/lib/c++defs.h b/cross/lib/c++defs.h similarity index 100% rename from xcompile/lib/c++defs.h rename to cross/lib/c++defs.h diff --git a/xcompile/lib/c-ctype.c b/cross/lib/c-ctype.c similarity index 100% rename from xcompile/lib/c-ctype.c rename to cross/lib/c-ctype.c diff --git a/xcompile/lib/c-ctype.h b/cross/lib/c-ctype.h similarity index 100% rename from xcompile/lib/c-ctype.h rename to cross/lib/c-ctype.h diff --git a/xcompile/lib/c-strcase.h b/cross/lib/c-strcase.h similarity index 100% rename from xcompile/lib/c-strcase.h rename to cross/lib/c-strcase.h diff --git a/xcompile/lib/c-strcasecmp.c b/cross/lib/c-strcasecmp.c similarity index 100% rename from xcompile/lib/c-strcasecmp.c rename to cross/lib/c-strcasecmp.c diff --git a/xcompile/lib/c-strncasecmp.c b/cross/lib/c-strncasecmp.c similarity index 100% rename from xcompile/lib/c-strncasecmp.c rename to cross/lib/c-strncasecmp.c diff --git a/xcompile/lib/canonicalize-lgpl.c b/cross/lib/canonicalize-lgpl.c similarity index 100% rename from xcompile/lib/canonicalize-lgpl.c rename to cross/lib/canonicalize-lgpl.c diff --git a/xcompile/lib/careadlinkat.c b/cross/lib/careadlinkat.c similarity index 100% rename from xcompile/lib/careadlinkat.c rename to cross/lib/careadlinkat.c diff --git a/xcompile/lib/careadlinkat.h b/cross/lib/careadlinkat.h similarity index 100% rename from xcompile/lib/careadlinkat.h rename to cross/lib/careadlinkat.h diff --git a/xcompile/lib/cdefs.h b/cross/lib/cdefs.h similarity index 100% rename from xcompile/lib/cdefs.h rename to cross/lib/cdefs.h diff --git a/xcompile/lib/cloexec.c b/cross/lib/cloexec.c similarity index 100% rename from xcompile/lib/cloexec.c rename to cross/lib/cloexec.c diff --git a/xcompile/lib/cloexec.h b/cross/lib/cloexec.h similarity index 100% rename from xcompile/lib/cloexec.h rename to cross/lib/cloexec.h diff --git a/xcompile/lib/close-stream.c b/cross/lib/close-stream.c similarity index 100% rename from xcompile/lib/close-stream.c rename to cross/lib/close-stream.c diff --git a/xcompile/lib/close-stream.h b/cross/lib/close-stream.h similarity index 100% rename from xcompile/lib/close-stream.h rename to cross/lib/close-stream.h diff --git a/xcompile/lib/copy-file-range.c b/cross/lib/copy-file-range.c similarity index 100% rename from xcompile/lib/copy-file-range.c rename to cross/lib/copy-file-range.c diff --git a/xcompile/lib/count-leading-zeros.c b/cross/lib/count-leading-zeros.c similarity index 100% rename from xcompile/lib/count-leading-zeros.c rename to cross/lib/count-leading-zeros.c diff --git a/xcompile/lib/count-leading-zeros.h b/cross/lib/count-leading-zeros.h similarity index 100% rename from xcompile/lib/count-leading-zeros.h rename to cross/lib/count-leading-zeros.h diff --git a/xcompile/lib/count-one-bits.c b/cross/lib/count-one-bits.c similarity index 100% rename from xcompile/lib/count-one-bits.c rename to cross/lib/count-one-bits.c diff --git a/xcompile/lib/count-one-bits.h b/cross/lib/count-one-bits.h similarity index 100% rename from xcompile/lib/count-one-bits.h rename to cross/lib/count-one-bits.h diff --git a/xcompile/lib/count-trailing-zeros.c b/cross/lib/count-trailing-zeros.c similarity index 100% rename from xcompile/lib/count-trailing-zeros.c rename to cross/lib/count-trailing-zeros.c diff --git a/xcompile/lib/count-trailing-zeros.h b/cross/lib/count-trailing-zeros.h similarity index 100% rename from xcompile/lib/count-trailing-zeros.h rename to cross/lib/count-trailing-zeros.h diff --git a/xcompile/lib/diffseq.h b/cross/lib/diffseq.h similarity index 100% rename from xcompile/lib/diffseq.h rename to cross/lib/diffseq.h diff --git a/xcompile/lib/dirent.in.h b/cross/lib/dirent.in.h similarity index 100% rename from xcompile/lib/dirent.in.h rename to cross/lib/dirent.in.h diff --git a/xcompile/lib/dirfd.c b/cross/lib/dirfd.c similarity index 100% rename from xcompile/lib/dirfd.c rename to cross/lib/dirfd.c diff --git a/xcompile/lib/dtoastr.c b/cross/lib/dtoastr.c similarity index 100% rename from xcompile/lib/dtoastr.c rename to cross/lib/dtoastr.c diff --git a/xcompile/lib/dtotimespec.c b/cross/lib/dtotimespec.c similarity index 100% rename from xcompile/lib/dtotimespec.c rename to cross/lib/dtotimespec.c diff --git a/xcompile/lib/dup2.c b/cross/lib/dup2.c similarity index 100% rename from xcompile/lib/dup2.c rename to cross/lib/dup2.c diff --git a/xcompile/lib/dynarray.h b/cross/lib/dynarray.h similarity index 100% rename from xcompile/lib/dynarray.h rename to cross/lib/dynarray.h diff --git a/xcompile/lib/eloop-threshold.h b/cross/lib/eloop-threshold.h similarity index 100% rename from xcompile/lib/eloop-threshold.h rename to cross/lib/eloop-threshold.h diff --git a/xcompile/lib/errno.in.h b/cross/lib/errno.in.h similarity index 100% rename from xcompile/lib/errno.in.h rename to cross/lib/errno.in.h diff --git a/xcompile/lib/euidaccess.c b/cross/lib/euidaccess.c similarity index 100% rename from xcompile/lib/euidaccess.c rename to cross/lib/euidaccess.c diff --git a/xcompile/lib/execinfo.c b/cross/lib/execinfo.c similarity index 100% rename from xcompile/lib/execinfo.c rename to cross/lib/execinfo.c diff --git a/xcompile/lib/execinfo.in.h b/cross/lib/execinfo.in.h similarity index 100% rename from xcompile/lib/execinfo.in.h rename to cross/lib/execinfo.in.h diff --git a/xcompile/lib/explicit_bzero.c b/cross/lib/explicit_bzero.c similarity index 100% rename from xcompile/lib/explicit_bzero.c rename to cross/lib/explicit_bzero.c diff --git a/xcompile/lib/faccessat.c b/cross/lib/faccessat.c similarity index 100% rename from xcompile/lib/faccessat.c rename to cross/lib/faccessat.c diff --git a/xcompile/lib/fchmodat.c b/cross/lib/fchmodat.c similarity index 100% rename from xcompile/lib/fchmodat.c rename to cross/lib/fchmodat.c diff --git a/xcompile/lib/fcntl.c b/cross/lib/fcntl.c similarity index 100% rename from xcompile/lib/fcntl.c rename to cross/lib/fcntl.c diff --git a/xcompile/lib/fcntl.in.h b/cross/lib/fcntl.in.h similarity index 100% rename from xcompile/lib/fcntl.in.h rename to cross/lib/fcntl.in.h diff --git a/xcompile/lib/fdopendir.c b/cross/lib/fdopendir.c similarity index 100% rename from xcompile/lib/fdopendir.c rename to cross/lib/fdopendir.c diff --git a/xcompile/lib/file-has-acl.c b/cross/lib/file-has-acl.c similarity index 100% rename from xcompile/lib/file-has-acl.c rename to cross/lib/file-has-acl.c diff --git a/xcompile/lib/filemode.c b/cross/lib/filemode.c similarity index 100% rename from xcompile/lib/filemode.c rename to cross/lib/filemode.c diff --git a/xcompile/lib/filemode.h b/cross/lib/filemode.h similarity index 100% rename from xcompile/lib/filemode.h rename to cross/lib/filemode.h diff --git a/xcompile/lib/filename.h b/cross/lib/filename.h similarity index 100% rename from xcompile/lib/filename.h rename to cross/lib/filename.h diff --git a/xcompile/lib/filevercmp.c b/cross/lib/filevercmp.c similarity index 100% rename from xcompile/lib/filevercmp.c rename to cross/lib/filevercmp.c diff --git a/xcompile/lib/filevercmp.h b/cross/lib/filevercmp.h similarity index 100% rename from xcompile/lib/filevercmp.h rename to cross/lib/filevercmp.h diff --git a/xcompile/lib/fingerprint.c b/cross/lib/fingerprint.c similarity index 100% rename from xcompile/lib/fingerprint.c rename to cross/lib/fingerprint.c diff --git a/xcompile/lib/fingerprint.h b/cross/lib/fingerprint.h similarity index 100% rename from xcompile/lib/fingerprint.h rename to cross/lib/fingerprint.h diff --git a/xcompile/lib/flexmember.h b/cross/lib/flexmember.h similarity index 100% rename from xcompile/lib/flexmember.h rename to cross/lib/flexmember.h diff --git a/xcompile/lib/fpending.c b/cross/lib/fpending.c similarity index 100% rename from xcompile/lib/fpending.c rename to cross/lib/fpending.c diff --git a/xcompile/lib/fpending.h b/cross/lib/fpending.h similarity index 100% rename from xcompile/lib/fpending.h rename to cross/lib/fpending.h diff --git a/xcompile/lib/free.c b/cross/lib/free.c similarity index 100% rename from xcompile/lib/free.c rename to cross/lib/free.c diff --git a/xcompile/lib/fstatat.c b/cross/lib/fstatat.c similarity index 100% rename from xcompile/lib/fstatat.c rename to cross/lib/fstatat.c diff --git a/xcompile/lib/fsusage.c b/cross/lib/fsusage.c similarity index 100% rename from xcompile/lib/fsusage.c rename to cross/lib/fsusage.c diff --git a/xcompile/lib/fsusage.h b/cross/lib/fsusage.h similarity index 100% rename from xcompile/lib/fsusage.h rename to cross/lib/fsusage.h diff --git a/xcompile/lib/fsync.c b/cross/lib/fsync.c similarity index 100% rename from xcompile/lib/fsync.c rename to cross/lib/fsync.c diff --git a/xcompile/lib/ftoastr.c b/cross/lib/ftoastr.c similarity index 100% rename from xcompile/lib/ftoastr.c rename to cross/lib/ftoastr.c diff --git a/xcompile/lib/ftoastr.h b/cross/lib/ftoastr.h similarity index 100% rename from xcompile/lib/ftoastr.h rename to cross/lib/ftoastr.h diff --git a/xcompile/lib/futimens.c b/cross/lib/futimens.c similarity index 100% rename from xcompile/lib/futimens.c rename to cross/lib/futimens.c diff --git a/xcompile/lib/get-permissions.c b/cross/lib/get-permissions.c similarity index 100% rename from xcompile/lib/get-permissions.c rename to cross/lib/get-permissions.c diff --git a/xcompile/lib/getdelim.c b/cross/lib/getdelim.c similarity index 100% rename from xcompile/lib/getdelim.c rename to cross/lib/getdelim.c diff --git a/xcompile/lib/getdtablesize.c b/cross/lib/getdtablesize.c similarity index 100% rename from xcompile/lib/getdtablesize.c rename to cross/lib/getdtablesize.c diff --git a/xcompile/lib/getgroups.c b/cross/lib/getgroups.c similarity index 100% rename from xcompile/lib/getgroups.c rename to cross/lib/getgroups.c diff --git a/xcompile/lib/getline.c b/cross/lib/getline.c similarity index 100% rename from xcompile/lib/getline.c rename to cross/lib/getline.c diff --git a/xcompile/lib/getloadavg.c b/cross/lib/getloadavg.c similarity index 100% rename from xcompile/lib/getloadavg.c rename to cross/lib/getloadavg.c diff --git a/xcompile/lib/getopt-cdefs.in.h b/cross/lib/getopt-cdefs.in.h similarity index 100% rename from xcompile/lib/getopt-cdefs.in.h rename to cross/lib/getopt-cdefs.in.h diff --git a/xcompile/lib/getopt-core.h b/cross/lib/getopt-core.h similarity index 100% rename from xcompile/lib/getopt-core.h rename to cross/lib/getopt-core.h diff --git a/xcompile/lib/getopt-ext.h b/cross/lib/getopt-ext.h similarity index 100% rename from xcompile/lib/getopt-ext.h rename to cross/lib/getopt-ext.h diff --git a/xcompile/lib/getopt-pfx-core.h b/cross/lib/getopt-pfx-core.h similarity index 100% rename from xcompile/lib/getopt-pfx-core.h rename to cross/lib/getopt-pfx-core.h diff --git a/xcompile/lib/getopt-pfx-ext.h b/cross/lib/getopt-pfx-ext.h similarity index 100% rename from xcompile/lib/getopt-pfx-ext.h rename to cross/lib/getopt-pfx-ext.h diff --git a/xcompile/lib/getopt.c b/cross/lib/getopt.c similarity index 100% rename from xcompile/lib/getopt.c rename to cross/lib/getopt.c diff --git a/xcompile/lib/getopt.in.h b/cross/lib/getopt.in.h similarity index 100% rename from xcompile/lib/getopt.in.h rename to cross/lib/getopt.in.h diff --git a/xcompile/lib/getopt1.c b/cross/lib/getopt1.c similarity index 100% rename from xcompile/lib/getopt1.c rename to cross/lib/getopt1.c diff --git a/xcompile/lib/getopt_int.h b/cross/lib/getopt_int.h similarity index 100% rename from xcompile/lib/getopt_int.h rename to cross/lib/getopt_int.h diff --git a/xcompile/lib/getrandom.c b/cross/lib/getrandom.c similarity index 100% rename from xcompile/lib/getrandom.c rename to cross/lib/getrandom.c diff --git a/xcompile/lib/gettext.h b/cross/lib/gettext.h similarity index 100% rename from xcompile/lib/gettext.h rename to cross/lib/gettext.h diff --git a/xcompile/lib/gettime.c b/cross/lib/gettime.c similarity index 100% rename from xcompile/lib/gettime.c rename to cross/lib/gettime.c diff --git a/xcompile/lib/gettimeofday.c b/cross/lib/gettimeofday.c similarity index 100% rename from xcompile/lib/gettimeofday.c rename to cross/lib/gettimeofday.c diff --git a/xcompile/lib/group-member.c b/cross/lib/group-member.c similarity index 100% rename from xcompile/lib/group-member.c rename to cross/lib/group-member.c diff --git a/xcompile/lib/idx.h b/cross/lib/idx.h similarity index 100% rename from xcompile/lib/idx.h rename to cross/lib/idx.h diff --git a/xcompile/lib/ieee754.in.h b/cross/lib/ieee754.in.h similarity index 100% rename from xcompile/lib/ieee754.in.h rename to cross/lib/ieee754.in.h diff --git a/xcompile/lib/ignore-value.h b/cross/lib/ignore-value.h similarity index 100% rename from xcompile/lib/ignore-value.h rename to cross/lib/ignore-value.h diff --git a/xcompile/lib/intprops-internal.h b/cross/lib/intprops-internal.h similarity index 100% rename from xcompile/lib/intprops-internal.h rename to cross/lib/intprops-internal.h diff --git a/xcompile/lib/intprops.h b/cross/lib/intprops.h similarity index 100% rename from xcompile/lib/intprops.h rename to cross/lib/intprops.h diff --git a/xcompile/lib/inttypes.in.h b/cross/lib/inttypes.in.h similarity index 100% rename from xcompile/lib/inttypes.in.h rename to cross/lib/inttypes.in.h diff --git a/xcompile/lib/lchmod.c b/cross/lib/lchmod.c similarity index 100% rename from xcompile/lib/lchmod.c rename to cross/lib/lchmod.c diff --git a/xcompile/lib/libc-config.h b/cross/lib/libc-config.h similarity index 100% rename from xcompile/lib/libc-config.h rename to cross/lib/libc-config.h diff --git a/xcompile/lib/limits.in.h b/cross/lib/limits.in.h similarity index 100% rename from xcompile/lib/limits.in.h rename to cross/lib/limits.in.h diff --git a/xcompile/lib/lstat.c b/cross/lib/lstat.c similarity index 100% rename from xcompile/lib/lstat.c rename to cross/lib/lstat.c diff --git a/xcompile/lib/malloc.c b/cross/lib/malloc.c similarity index 100% rename from xcompile/lib/malloc.c rename to cross/lib/malloc.c diff --git a/xcompile/lib/malloc/dynarray-skeleton.c b/cross/lib/malloc/dynarray-skeleton.c similarity index 100% rename from xcompile/lib/malloc/dynarray-skeleton.c rename to cross/lib/malloc/dynarray-skeleton.c diff --git a/xcompile/lib/malloc/dynarray.h b/cross/lib/malloc/dynarray.h similarity index 100% rename from xcompile/lib/malloc/dynarray.h rename to cross/lib/malloc/dynarray.h diff --git a/xcompile/lib/malloc/dynarray_at_failure.c b/cross/lib/malloc/dynarray_at_failure.c similarity index 100% rename from xcompile/lib/malloc/dynarray_at_failure.c rename to cross/lib/malloc/dynarray_at_failure.c diff --git a/xcompile/lib/malloc/dynarray_emplace_enlarge.c b/cross/lib/malloc/dynarray_emplace_enlarge.c similarity index 100% rename from xcompile/lib/malloc/dynarray_emplace_enlarge.c rename to cross/lib/malloc/dynarray_emplace_enlarge.c diff --git a/xcompile/lib/malloc/dynarray_finalize.c b/cross/lib/malloc/dynarray_finalize.c similarity index 100% rename from xcompile/lib/malloc/dynarray_finalize.c rename to cross/lib/malloc/dynarray_finalize.c diff --git a/xcompile/lib/malloc/dynarray_resize.c b/cross/lib/malloc/dynarray_resize.c similarity index 100% rename from xcompile/lib/malloc/dynarray_resize.c rename to cross/lib/malloc/dynarray_resize.c diff --git a/xcompile/lib/malloc/dynarray_resize_clear.c b/cross/lib/malloc/dynarray_resize_clear.c similarity index 100% rename from xcompile/lib/malloc/dynarray_resize_clear.c rename to cross/lib/malloc/dynarray_resize_clear.c diff --git a/xcompile/lib/malloc/scratch_buffer.h b/cross/lib/malloc/scratch_buffer.h similarity index 100% rename from xcompile/lib/malloc/scratch_buffer.h rename to cross/lib/malloc/scratch_buffer.h diff --git a/xcompile/lib/malloc/scratch_buffer_dupfree.c b/cross/lib/malloc/scratch_buffer_dupfree.c similarity index 100% rename from xcompile/lib/malloc/scratch_buffer_dupfree.c rename to cross/lib/malloc/scratch_buffer_dupfree.c diff --git a/xcompile/lib/malloc/scratch_buffer_grow.c b/cross/lib/malloc/scratch_buffer_grow.c similarity index 100% rename from xcompile/lib/malloc/scratch_buffer_grow.c rename to cross/lib/malloc/scratch_buffer_grow.c diff --git a/xcompile/lib/malloc/scratch_buffer_grow_preserve.c b/cross/lib/malloc/scratch_buffer_grow_preserve.c similarity index 100% rename from xcompile/lib/malloc/scratch_buffer_grow_preserve.c rename to cross/lib/malloc/scratch_buffer_grow_preserve.c diff --git a/xcompile/lib/malloc/scratch_buffer_set_array_size.c b/cross/lib/malloc/scratch_buffer_set_array_size.c similarity index 100% rename from xcompile/lib/malloc/scratch_buffer_set_array_size.c rename to cross/lib/malloc/scratch_buffer_set_array_size.c diff --git a/xcompile/lib/md5-stream.c b/cross/lib/md5-stream.c similarity index 100% rename from xcompile/lib/md5-stream.c rename to cross/lib/md5-stream.c diff --git a/xcompile/lib/md5.c b/cross/lib/md5.c similarity index 100% rename from xcompile/lib/md5.c rename to cross/lib/md5.c diff --git a/xcompile/lib/md5.h b/cross/lib/md5.h similarity index 100% rename from xcompile/lib/md5.h rename to cross/lib/md5.h diff --git a/xcompile/lib/memmem.c b/cross/lib/memmem.c similarity index 100% rename from xcompile/lib/memmem.c rename to cross/lib/memmem.c diff --git a/xcompile/lib/mempcpy.c b/cross/lib/mempcpy.c similarity index 100% rename from xcompile/lib/mempcpy.c rename to cross/lib/mempcpy.c diff --git a/xcompile/lib/memrchr.c b/cross/lib/memrchr.c similarity index 100% rename from xcompile/lib/memrchr.c rename to cross/lib/memrchr.c diff --git a/xcompile/lib/memset_explicit.c b/cross/lib/memset_explicit.c similarity index 100% rename from xcompile/lib/memset_explicit.c rename to cross/lib/memset_explicit.c diff --git a/xcompile/lib/min-max.h b/cross/lib/min-max.h similarity index 100% rename from xcompile/lib/min-max.h rename to cross/lib/min-max.h diff --git a/xcompile/lib/mini-gmp-gnulib.c b/cross/lib/mini-gmp-gnulib.c similarity index 100% rename from xcompile/lib/mini-gmp-gnulib.c rename to cross/lib/mini-gmp-gnulib.c diff --git a/xcompile/lib/mini-gmp.c b/cross/lib/mini-gmp.c similarity index 100% rename from xcompile/lib/mini-gmp.c rename to cross/lib/mini-gmp.c diff --git a/xcompile/lib/mini-gmp.h b/cross/lib/mini-gmp.h similarity index 100% rename from xcompile/lib/mini-gmp.h rename to cross/lib/mini-gmp.h diff --git a/xcompile/lib/minmax.h b/cross/lib/minmax.h similarity index 100% rename from xcompile/lib/minmax.h rename to cross/lib/minmax.h diff --git a/xcompile/lib/mkostemp.c b/cross/lib/mkostemp.c similarity index 100% rename from xcompile/lib/mkostemp.c rename to cross/lib/mkostemp.c diff --git a/xcompile/lib/mktime-internal.h b/cross/lib/mktime-internal.h similarity index 100% rename from xcompile/lib/mktime-internal.h rename to cross/lib/mktime-internal.h diff --git a/xcompile/lib/mktime.c b/cross/lib/mktime.c similarity index 100% rename from xcompile/lib/mktime.c rename to cross/lib/mktime.c diff --git a/xcompile/lib/nanosleep.c b/cross/lib/nanosleep.c similarity index 100% rename from xcompile/lib/nanosleep.c rename to cross/lib/nanosleep.c diff --git a/xcompile/lib/nproc.c b/cross/lib/nproc.c similarity index 100% rename from xcompile/lib/nproc.c rename to cross/lib/nproc.c diff --git a/xcompile/lib/nproc.h b/cross/lib/nproc.h similarity index 100% rename from xcompile/lib/nproc.h rename to cross/lib/nproc.h diff --git a/xcompile/lib/nstrftime.c b/cross/lib/nstrftime.c similarity index 100% rename from xcompile/lib/nstrftime.c rename to cross/lib/nstrftime.c diff --git a/xcompile/lib/open.c b/cross/lib/open.c similarity index 100% rename from xcompile/lib/open.c rename to cross/lib/open.c diff --git a/xcompile/lib/openat-die.c b/cross/lib/openat-die.c similarity index 100% rename from xcompile/lib/openat-die.c rename to cross/lib/openat-die.c diff --git a/xcompile/lib/openat-priv.h b/cross/lib/openat-priv.h similarity index 100% rename from xcompile/lib/openat-priv.h rename to cross/lib/openat-priv.h diff --git a/xcompile/lib/openat-proc.c b/cross/lib/openat-proc.c similarity index 100% rename from xcompile/lib/openat-proc.c rename to cross/lib/openat-proc.c diff --git a/xcompile/lib/openat.h b/cross/lib/openat.h similarity index 100% rename from xcompile/lib/openat.h rename to cross/lib/openat.h diff --git a/xcompile/lib/pathmax.h b/cross/lib/pathmax.h similarity index 100% rename from xcompile/lib/pathmax.h rename to cross/lib/pathmax.h diff --git a/xcompile/lib/pipe2.c b/cross/lib/pipe2.c similarity index 100% rename from xcompile/lib/pipe2.c rename to cross/lib/pipe2.c diff --git a/xcompile/lib/pselect.c b/cross/lib/pselect.c similarity index 100% rename from xcompile/lib/pselect.c rename to cross/lib/pselect.c diff --git a/xcompile/lib/pthread_sigmask.c b/cross/lib/pthread_sigmask.c similarity index 100% rename from xcompile/lib/pthread_sigmask.c rename to cross/lib/pthread_sigmask.c diff --git a/xcompile/lib/qcopy-acl.c b/cross/lib/qcopy-acl.c similarity index 100% rename from xcompile/lib/qcopy-acl.c rename to cross/lib/qcopy-acl.c diff --git a/xcompile/lib/rawmemchr.c b/cross/lib/rawmemchr.c similarity index 100% rename from xcompile/lib/rawmemchr.c rename to cross/lib/rawmemchr.c diff --git a/xcompile/lib/rawmemchr.valgrind b/cross/lib/rawmemchr.valgrind similarity index 100% rename from xcompile/lib/rawmemchr.valgrind rename to cross/lib/rawmemchr.valgrind diff --git a/xcompile/lib/readlink.c b/cross/lib/readlink.c similarity index 100% rename from xcompile/lib/readlink.c rename to cross/lib/readlink.c diff --git a/xcompile/lib/readlinkat.c b/cross/lib/readlinkat.c similarity index 100% rename from xcompile/lib/readlinkat.c rename to cross/lib/readlinkat.c diff --git a/xcompile/lib/realloc.c b/cross/lib/realloc.c similarity index 100% rename from xcompile/lib/realloc.c rename to cross/lib/realloc.c diff --git a/xcompile/lib/regcomp.c b/cross/lib/regcomp.c similarity index 100% rename from xcompile/lib/regcomp.c rename to cross/lib/regcomp.c diff --git a/xcompile/lib/regex.c b/cross/lib/regex.c similarity index 100% rename from xcompile/lib/regex.c rename to cross/lib/regex.c diff --git a/xcompile/lib/regex.h b/cross/lib/regex.h similarity index 100% rename from xcompile/lib/regex.h rename to cross/lib/regex.h diff --git a/xcompile/lib/regex_internal.c b/cross/lib/regex_internal.c similarity index 100% rename from xcompile/lib/regex_internal.c rename to cross/lib/regex_internal.c diff --git a/xcompile/lib/regex_internal.h b/cross/lib/regex_internal.h similarity index 100% rename from xcompile/lib/regex_internal.h rename to cross/lib/regex_internal.h diff --git a/xcompile/lib/regexec.c b/cross/lib/regexec.c similarity index 100% rename from xcompile/lib/regexec.c rename to cross/lib/regexec.c diff --git a/xcompile/lib/root-uid.h b/cross/lib/root-uid.h similarity index 100% rename from xcompile/lib/root-uid.h rename to cross/lib/root-uid.h diff --git a/xcompile/lib/save-cwd.c b/cross/lib/save-cwd.c similarity index 100% rename from xcompile/lib/save-cwd.c rename to cross/lib/save-cwd.c diff --git a/xcompile/lib/save-cwd.h b/cross/lib/save-cwd.h similarity index 100% rename from xcompile/lib/save-cwd.h rename to cross/lib/save-cwd.h diff --git a/xcompile/lib/scratch_buffer.h b/cross/lib/scratch_buffer.h similarity index 100% rename from xcompile/lib/scratch_buffer.h rename to cross/lib/scratch_buffer.h diff --git a/xcompile/lib/set-permissions.c b/cross/lib/set-permissions.c similarity index 100% rename from xcompile/lib/set-permissions.c rename to cross/lib/set-permissions.c diff --git a/xcompile/lib/sha1.c b/cross/lib/sha1.c similarity index 100% rename from xcompile/lib/sha1.c rename to cross/lib/sha1.c diff --git a/xcompile/lib/sha1.h b/cross/lib/sha1.h similarity index 100% rename from xcompile/lib/sha1.h rename to cross/lib/sha1.h diff --git a/xcompile/lib/sha256.c b/cross/lib/sha256.c similarity index 100% rename from xcompile/lib/sha256.c rename to cross/lib/sha256.c diff --git a/xcompile/lib/sha256.h b/cross/lib/sha256.h similarity index 100% rename from xcompile/lib/sha256.h rename to cross/lib/sha256.h diff --git a/xcompile/lib/sha512.c b/cross/lib/sha512.c similarity index 100% rename from xcompile/lib/sha512.c rename to cross/lib/sha512.c diff --git a/xcompile/lib/sha512.h b/cross/lib/sha512.h similarity index 100% rename from xcompile/lib/sha512.h rename to cross/lib/sha512.h diff --git a/xcompile/lib/sig2str.c b/cross/lib/sig2str.c similarity index 100% rename from xcompile/lib/sig2str.c rename to cross/lib/sig2str.c diff --git a/xcompile/lib/sig2str.h b/cross/lib/sig2str.h similarity index 100% rename from xcompile/lib/sig2str.h rename to cross/lib/sig2str.h diff --git a/xcompile/lib/sigdescr_np.c b/cross/lib/sigdescr_np.c similarity index 100% rename from xcompile/lib/sigdescr_np.c rename to cross/lib/sigdescr_np.c diff --git a/xcompile/lib/signal.in.h b/cross/lib/signal.in.h similarity index 100% rename from xcompile/lib/signal.in.h rename to cross/lib/signal.in.h diff --git a/xcompile/lib/stat-time.c b/cross/lib/stat-time.c similarity index 100% rename from xcompile/lib/stat-time.c rename to cross/lib/stat-time.c diff --git a/xcompile/lib/stat-time.h b/cross/lib/stat-time.h similarity index 100% rename from xcompile/lib/stat-time.h rename to cross/lib/stat-time.h diff --git a/cross/lib/stdalign.in.h b/cross/lib/stdalign.in.h new file mode 100644 index 00000000000..6523546f16d --- /dev/null +++ b/cross/lib/stdalign.in.h @@ -0,0 +1,34 @@ +/* A substitute for ISO C11 . + + Copyright 2011-2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert and Bruno Haible. */ + +/* Define two obsolescent C11 macros, assuming alignas and alignof are + either keywords or alignasof-defined macros. */ + +#ifndef _GL_STDALIGN_H +#define _GL_STDALIGN_H + +#if (defined alignas \ + || (defined __STDC_VERSION__ && 202311 <= __STDC_VERSION__) \ + || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) +# define __alignas_is_defined 1 +#endif + +#define __alignof_is_defined 1 + +#endif /* _GL_STDALIGN_H */ diff --git a/cross/lib/stdckdint.in.h b/cross/lib/stdckdint.in.h new file mode 100644 index 00000000000..71bab5f0c9e --- /dev/null +++ b/cross/lib/stdckdint.in.h @@ -0,0 +1,35 @@ +/* stdckdint.h -- checked integer arithmetic + + Copyright 2022-2023 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_STDCKDINT_H +#define _GL_STDCKDINT_H + +#include "intprops-internal.h" + +/* Store into *R the low-order bits of A + B, A - B, A * B, respectively. + Return 1 if the result overflows, 0 otherwise. + A, B, and *R can have any integer type other than char, bool, a + bit-precise integer type, or an enumeration type. + + These are like the standard macros introduced in C23, except that + arguments should not have side effects. */ + +#define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) +#define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) +#define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) + +#endif /* _GL_STDCKDINT_H */ diff --git a/cross/lib/stddef.in.h b/cross/lib/stddef.in.h new file mode 100644 index 00000000000..6eadcc3d5a4 --- /dev/null +++ b/cross/lib/stddef.in.h @@ -0,0 +1,147 @@ +/* A substitute for POSIX 2008 , for platforms that have issues. + + Copyright (C) 2009-2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Eric Blake. */ + +/* + * POSIX 2008 for platforms that have issues. + * + */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_wchar_t || defined __need_size_t \ + || defined __need_ptrdiff_t || defined __need_NULL \ + || defined __need_wint_t +/* Special invocation convention inside gcc header files. In + particular, gcc provides a version of that blindly + redefines NULL even when __need_wint_t was defined, even though + wint_t is not normally provided by . Hence, we must + remember if special invocation has ever been used to obtain wint_t, + in which case we need to clean up NULL yet again. */ + +# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) +# ifdef __need_wint_t +# define _GL_STDDEF_WINT_T +# endif +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + /* On TinyCC, make sure that the macros that indicate the special invocation + convention get undefined. */ +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t +# endif + +#else +/* Normal invocation convention. */ + +# ifndef _@GUARD_PREFIX@_STDDEF_H + +/* On AIX 7.2, with xlc in 64-bit mode, defines max_align_t to a + type with alignment 4, but 'long' has alignment 8. */ +# if defined _AIX && defined __LP64__ +# if !GNULIB_defined_max_align_t +# ifdef _MAX_ALIGN_T +/* /usr/include/stddef.h has already defined max_align_t. Override it. */ +typedef long rpl_max_align_t; +# define max_align_t rpl_max_align_t +# else +/* Prevent /usr/include/stddef.h from defining max_align_t. */ +typedef long max_align_t; +# define _MAX_ALIGN_T +# endif +# define GNULIB_defined_max_align_t 1 +# endif +# endif + +/* The include_next requires a split double-inclusion guard. */ + +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + +/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ +# if (@REPLACE_NULL@ \ + && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) +# undef NULL +# ifdef __cplusplus + /* ISO C++ says that the macro NULL must expand to an integer constant + expression, hence '((void *) 0)' is not allowed in C++. */ +# if __GNUG__ >= 3 + /* GNU C++ has a __null macro that behaves like an integer ('int' or + 'long') but has the same size as a pointer. Use that, to avoid + warnings. */ +# define NULL __null +# else +# define NULL 0L +# endif +# else +# define NULL ((void *) 0) +# endif +# endif + +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H + +/* Some platforms lack wchar_t. */ +#if !@HAVE_WCHAR_T@ +# define wchar_t int +#endif + +/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. + On MSVC, max_align_t is defined only in C++ mode, after was + included. Its definition is good since it has an alignment of 8 (on x86 + and x86_64). + Similarly on OS/2 kLIBC. */ +#if (defined _MSC_VER || (defined __KLIBC__ && !defined __LIBCN__)) \ + && defined __cplusplus +# include +#else +# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__)) +# if !GNULIB_defined_max_align_t +/* On the x86, the maximum storage alignment of double, long, etc. is 4, + but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, + and the C11 standard allows this. Work around this problem by + using __alignof__ (which returns 8 for double) rather than _Alignof + (which returns 4), and align each union member accordingly. */ +# if defined __GNUC__ || (__clang_major__ >= 4) +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif +typedef union +{ + char *__p _GL_STDDEF_ALIGNAS (char *); + double __d _GL_STDDEF_ALIGNAS (double); + long double __ld _GL_STDDEF_ALIGNAS (long double); + long int __i _GL_STDDEF_ALIGNAS (long int); +} rpl_max_align_t; +# define max_align_t rpl_max_align_t +# define GNULIB_defined_max_align_t 1 +# endif +# endif +#endif + +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +#endif /* __need_XXX */ diff --git a/cross/lib/stdint.in.h b/cross/lib/stdint.in.h new file mode 100644 index 00000000000..5ddc644b8ee --- /dev/null +++ b/cross/lib/stdint.in.h @@ -0,0 +1,740 @@ +/* Copyright (C) 2001-2002, 2004-2023 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +#ifndef _@GUARD_PREFIX@_STDINT_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* When including a system file that in turn includes , + use the system , not our substitute. This avoids + problems with (for example) VMS, whose includes + . */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* On Android (Bionic libc), includes this file before + having defined 'time_t'. Therefore in this case avoid including + other system header files; just include the system's . + Ideally we should test __BIONIC__ here, but it is only defined after + has been included; hence test __ANDROID__ instead. */ +#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#else + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + + /* Some pre-C++11 implementations need this. */ +# ifdef __cplusplus +# ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS 1 +# endif +# ifndef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +# endif +# endif + + /* Other systems may have an incomplete or buggy . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _@GUARD_PREFIX@_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _@GUARD_PREFIX@_STDINT_H + +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ +#include + +/* Override WINT_MIN and WINT_MAX if gnulib's or overrides + wint_t. */ +#if @GNULIBHEADERS_OVERRIDE_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN 0x0U +# define WINT_MAX 0xffffffffU +#endif + +#if ! @HAVE_C99_STDINT_H@ + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. + Mac OS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @NEXT_STDINT_H@. */ +# if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +# endif + +# if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +# elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +# endif + +# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +# endif + +# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for an integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +/* These are separate macros, because if you try to merge these macros into + a single one, HP-UX cc rejects the resulting expression in constant + expressions. */ +# define _STDINT_UNSIGNED_MIN(bits, zero) \ + (zero) +# define _STDINT_SIGNED_MIN(bits, zero) \ + (~ _STDINT_MAX (1, bits, zero)) + +# define _STDINT_MAX(signed, bits, zero) \ + (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +#if !GNULIB_defined_stdint_types + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +# undef int8_t +# undef uint8_t +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +# define int8_t gl_int8_t +# define uint8_t gl_uint8_t + +# undef int16_t +# undef uint16_t +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +# define int16_t gl_int16_t +# define uint16_t gl_uint16_t + +# undef int32_t +# undef uint32_t +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +# define int32_t gl_int32_t +# define uint32_t gl_uint32_t + +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +# ifdef INT64_MAX +# define GL_INT64_T +# else +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +typedef long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# else +# undef int64_t +typedef long long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# endif +# endif + +# ifdef UINT64_MAX +# define GL_UINT64_T +# else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# else +# undef uint64_t +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif +# endif + +/* Avoid collision with Solaris 2.5.1 etc. */ +# define _UINT8_T +# define _UINT32_T +# define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +# undef int_least8_t +# undef uint_least8_t +# undef int_least16_t +# undef uint_least16_t +# undef int_least32_t +# undef uint_least32_t +# undef int_least64_t +# undef uint_least64_t +# define int_least8_t int8_t +# define uint_least8_t uint8_t +# define int_least16_t int16_t +# define uint_least16_t uint16_t +# define int_least32_t int32_t +# define uint_least32_t uint32_t +# ifdef GL_INT64_T +# define int_least64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_least64_t uint64_t +# endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. The following code normally + uses types consistent with glibc, as that lessens the chance of + incompatibility with older GNU hosts. */ + +# undef int_fast8_t +# undef uint_fast8_t +# undef int_fast16_t +# undef uint_fast16_t +# undef int_fast32_t +# undef uint_fast32_t +# undef int_fast64_t +# undef uint_fast64_t +typedef signed char gl_int_fast8_t; +typedef unsigned char gl_uint_fast8_t; + +# ifdef __sun +/* Define types compatible with SunOS 5.10, so that code compiled under + earlier SunOS versions works with code compiled under SunOS 5.10. */ +typedef int gl_int_fast32_t; +typedef unsigned int gl_uint_fast32_t; +# else +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +# endif +typedef gl_int_fast32_t gl_int_fast16_t; +typedef gl_uint_fast32_t gl_uint_fast16_t; + +# define int_fast8_t gl_int_fast8_t +# define uint_fast8_t gl_uint_fast8_t +# define int_fast16_t gl_int_fast16_t +# define uint_fast16_t gl_uint_fast16_t +# define int_fast32_t gl_int_fast32_t +# define uint_fast32_t gl_uint_fast32_t +# ifdef GL_INT64_T +# define int_fast64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +# endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +/* kLIBC's defines _INTPTR_T_DECLARED and needs its own + definitions of intptr_t and uintptr_t (which use int and unsigned) + to avoid clashes with declarations of system functions like sbrk. + Similarly, MinGW WSL-5.4.1 needs its own intptr_t and + uintptr_t to avoid conflicting declarations of system functions like + _findclose in . */ +# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ + || defined __MINGW32__) +# undef intptr_t +# undef uintptr_t +# ifdef _WIN64 +typedef long long int gl_intptr_t; +typedef unsigned long long int gl_uintptr_t; +# else +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +# endif +# define intptr_t gl_intptr_t +# define uintptr_t gl_uintptr_t +# endif + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +/* If the system defines INTMAX_MAX, assume that intmax_t works, and + similarly for UINTMAX_MAX and uintmax_t. This avoids problems with + assuming one type where another is used by the system. */ + +# ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if LONG_MAX >> 30 == 1 +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t +# endif +# endif + +# ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if ULONG_MAX >> 31 == 1 +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# endif +# endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) + ? 1 : -1]; + +# define GNULIB_defined_stdint_types 1 +# endif /* !GNULIB_defined_stdint_types */ + +/* 7.18.2. Limits of specified-width integer types */ + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +# undef INT8_MIN +# undef INT8_MAX +# undef UINT8_MAX +# define INT8_MIN (~ INT8_MAX) +# define INT8_MAX 127 +# define UINT8_MAX 255 + +# undef INT16_MIN +# undef INT16_MAX +# undef UINT16_MAX +# define INT16_MIN (~ INT16_MAX) +# define INT16_MAX 32767 +# define UINT16_MAX 65535 + +# undef INT32_MIN +# undef INT32_MAX +# undef UINT32_MAX +# define INT32_MIN (~ INT32_MAX) +# define INT32_MAX 2147483647 +# define UINT32_MAX 4294967295U + +# if defined GL_INT64_T && ! defined INT64_MAX +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +# endif + +# if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +# endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +# undef INT_LEAST8_MIN +# undef INT_LEAST8_MAX +# undef UINT_LEAST8_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST8_MAX UINT8_MAX + +# undef INT_LEAST16_MIN +# undef INT_LEAST16_MAX +# undef UINT_LEAST16_MAX +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST16_MAX UINT16_MAX + +# undef INT_LEAST32_MIN +# undef INT_LEAST32_MAX +# undef UINT_LEAST32_MAX +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST32_MAX INT32_MAX +# define UINT_LEAST32_MAX UINT32_MAX + +# undef INT_LEAST64_MIN +# undef INT_LEAST64_MAX +# ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +# endif + +# undef UINT_LEAST64_MAX +# ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +# endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +# undef INT_FAST8_MIN +# undef INT_FAST8_MAX +# undef UINT_FAST8_MAX +# define INT_FAST8_MIN SCHAR_MIN +# define INT_FAST8_MAX SCHAR_MAX +# define UINT_FAST8_MAX UCHAR_MAX + +# undef INT_FAST16_MIN +# undef INT_FAST16_MAX +# undef UINT_FAST16_MAX +# define INT_FAST16_MIN INT_FAST32_MIN +# define INT_FAST16_MAX INT_FAST32_MAX +# define UINT_FAST16_MAX UINT_FAST32_MAX + +# undef INT_FAST32_MIN +# undef INT_FAST32_MAX +# undef UINT_FAST32_MAX +# ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +# else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +# endif + +# undef INT_FAST64_MIN +# undef INT_FAST64_MAX +# ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +# endif + +# undef UINT_FAST64_MAX +# ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +# endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +# undef INTPTR_MIN +# undef INTPTR_MAX +# undef UINTPTR_MAX +# ifdef _WIN64 +# define INTPTR_MIN LLONG_MIN +# define INTPTR_MAX LLONG_MAX +# define UINTPTR_MAX ULLONG_MAX +# else +# define INTPTR_MIN LONG_MIN +# define INTPTR_MAX LONG_MAX +# define UINTPTR_MAX ULONG_MAX +# endif + +/* 7.18.2.5. Limits of greatest-width integer types */ + +# ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif +# endif + +# ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif +# endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +# undef PTRDIFF_MIN +# undef PTRDIFF_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif +# else +# define PTRDIFF_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# endif + +/* sig_atomic_t limits */ +# undef SIG_ATOMIC_MIN +# undef SIG_ATOMIC_MAX +# if @HAVE_SIGNED_SIG_ATOMIC_T@ +# define SIG_ATOMIC_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# else +# define SIG_ATOMIC_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# endif +# define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +# undef SIZE_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif +# else +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +# endif + +/* wchar_t limits */ +/* Get WCHAR_MIN, WCHAR_MAX. + This include is not on the top, above, because on OSF/1 4.0 we have a + sequence of nested includes + -> -> -> , and the latter includes + and assumes its types are already defined. */ +# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# endif +# undef WCHAR_MIN +# undef WCHAR_MAX +# if @HAVE_SIGNED_WCHAR_T@ +# define WCHAR_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# else +# define WCHAR_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# endif +# define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +/* If gnulib's or overrides wint_t, @WINT_T_SUFFIX@ is not + accurate, therefore use the definitions from above. */ +# if !@GNULIBHEADERS_OVERRIDE_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# if @HAVE_SIGNED_WINT_T@ +# define WINT_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# else +# define WINT_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif +# define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif + +/* 7.18.4. Macros for integer constants */ + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +# undef INT8_C +# undef UINT8_C +# define INT8_C(x) x +# define UINT8_C(x) x + +# undef INT16_C +# undef UINT16_C +# define INT16_C(x) x +# define UINT16_C(x) x + +# undef INT32_C +# undef UINT32_C +# define INT32_C(x) x +# define UINT32_C(x) x ## U + +# undef INT64_C +# undef UINT64_C +# if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +# elif defined _MSC_VER +# define INT64_C(x) x##i64 +# else +# define INT64_C(x) x##LL +# endif +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +# elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +# else +# define UINT64_C(x) x##ULL +# endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +# ifndef INTMAX_C +# if LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif +# endif + +# ifndef UINTMAX_C +# if ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif +# endif + +#endif /* !@HAVE_C99_STDINT_H@ */ + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (!defined UINTMAX_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# ifdef INT8_MAX +# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) +# endif +# ifdef UINT8_MAX +# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) +# endif +# ifdef INT16_MAX +# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) +# endif +# ifdef UINT16_MAX +# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) +# endif +# ifdef INT32_MAX +# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) +# endif +# ifdef UINT32_MAX +# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) +# endif +# ifdef INT64_MAX +# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) +# endif +# ifdef UINT64_MAX +# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) +# endif +# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) +# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) +# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) +# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) +# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) +# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) +# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) +# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) +# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) +# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) +# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) +# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) +# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) +# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) +# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) +# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) +# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) +# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) +# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) +# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) +# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) +# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) +# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) +# ifdef WINT_MAX +# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) +# endif +# ifdef SIG_ATOMIC_MAX +# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) +# endif +#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ + +#endif /* _@GUARD_PREFIX@_STDINT_H */ +#endif /* !(defined __ANDROID__ && ...) */ +#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff --git a/cross/lib/stdio-impl.h b/cross/lib/stdio-impl.h new file mode 100644 index 00000000000..46608bed198 --- /dev/null +++ b/cross/lib/stdio-impl.h @@ -0,0 +1,218 @@ +/* Implementation details of FILE streams. + Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Many stdio implementations have the same logic and therefore can share + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + +/* Glibc 2.28 made _IO_UNBUFFERED and _IO_IN_BACKUP private. For now, work + around this problem by defining them ourselves. FIXME: Do not rely on glibc + internals. */ +#if defined _IO_EOF_SEEN +# if !defined _IO_UNBUFFERED +# define _IO_UNBUFFERED 0x2 +# endif +# if !defined _IO_IN_BACKUP +# define _IO_IN_BACKUP 0x100 +# endif +#endif + +/* BSD stdio derived implementations. */ + +#if defined __NetBSD__ /* NetBSD */ +/* Get __NetBSD_Version__. */ +# include +#endif + +#include /* For detecting Plan9. */ + +#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + +# if defined __DragonFly__ /* DragonFly */ + /* See . */ +# define fp_ ((struct { struct __FILE_public pub; \ + struct { unsigned char *_base; int _size; } _bf; \ + void *cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; int _size; } _ub; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; int _size; } _lb; \ + int _blksize; \ + fpos_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) + /* See . */ +# define _p pub._p +# define _flags pub._flags +# define _r pub._r +# define _w pub._w +# elif defined __ANDROID__ /* Android */ +# ifdef __LP64__ +# define _gl_flags_file_t int +# else +# define _gl_flags_file_t short +# endif +# ifdef __LP64__ +# define _gl_file_offset_t int64_t +# else + /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ +# define _gl_file_offset_t __kernel_off_t +# endif + /* Up to this commit from 2015-10-12 + + the innards of FILE were public, and fp_ub could be defined like for OpenBSD, + see + and . + After this commit, the innards of FILE are hidden. */ +# define fp_ ((struct { unsigned char *_p; \ + int _r; \ + int _w; \ + _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ + struct { unsigned char *_base; size_t _size; } _bf; \ + int _lbfsize; \ + void *_cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; size_t _size; } _ext; \ + unsigned char *_up; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; size_t _size; } _lb; \ + int _blksize; \ + _gl_file_offset_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) +# else +# define fp_ fp +# endif + +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */ + /* See + and + and */ + struct __sfileext + { + struct __sbuf _ub; /* ungetc buffer */ + /* More fields, not relevant here. */ + }; +# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub +# elif defined __ANDROID__ /* Android */ + struct __sfileext + { + struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */ + /* More fields, not relevant here. */ + }; +# define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub +# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */ +# define fp_ub fp_->_ub +# endif + +# define HASUB(fp) (fp_ub._base != NULL) + +# if defined __ANDROID__ /* Android */ + /* Needed after this commit from 2016-01-25 + */ +# ifndef __SEOF +# define __SLBF 1 +# define __SNBF 2 +# define __SRD 4 +# define __SWR 8 +# define __SRW 0x10 +# define __SEOF 0x20 +# define __SERR 0x40 +# endif +# ifndef __SOFF +# define __SOFF 0x1000 +# endif +# endif + +#endif + + +/* SystemV derived implementations. */ + +#ifdef __TANDEM /* NonStop Kernel */ +# ifndef _IOERR +/* These values were determined by the program 'stdioext-flags' at + . */ +# define _IOERR 0x40 +# define _IOREAD 0x80 +# define _IOWRT 0x4 +# define _IORW 0x100 +# endif +#endif + +#if defined _IOERR + +# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ +# define fp_ ((struct { unsigned char *_ptr; \ + unsigned char *_base; \ + unsigned char *_end; \ + long _cnt; \ + int _file; \ + unsigned int _flag; \ + } *) fp) +# elif defined __VMS /* OpenVMS */ +# define fp_ ((struct _iobuf *) fp) +# else +# define fp_ fp +# endif + +# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__) /* OpenServer 5, OpenServer 6, UnixWare 7 */ +# define _cnt __cnt +# define _ptr __ptr +# define _base __base +# define _flag __flag +# endif + +#elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */ + +/* does not define the innards of FILE any more. */ +# define WINDOWS_OPAQUE_FILE + +struct _gl_real_FILE +{ + /* Note: Compared to older Windows and to mingw, it has the fields + _base and _cnt swapped. */ + unsigned char *_ptr; + unsigned char *_base; + int _cnt; + int _flag; + int _file; + int _charbuf; + int _bufsiz; +}; +# define fp_ ((struct _gl_real_FILE *) fp) + +/* These values were determined by a program similar to the one at + . */ +# define _IOREAD 0x1 +# define _IOWRT 0x2 +# define _IORW 0x4 +# define _IOEOF 0x8 +# define _IOERR 0x10 + +#endif diff --git a/cross/lib/stdio.in.h b/cross/lib/stdio.in.h new file mode 100644 index 00000000000..8b5ef4bd2dd --- /dev/null +++ b/cross/lib/stdio.in.h @@ -0,0 +1,1719 @@ +/* A GNU-like . + + Copyright (C) 2004, 2007-2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +/* Special invocation convention: + - Inside glibc header files. + - On OSF/1 5.1 we have a sequence of nested includes + -> -> -> -> + -> -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. */ + +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STDIO_H + +#define _GL_ALREADY_INCLUDING_STDIO_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#undef _GL_ALREADY_INCLUDING_STDIO_H + +#ifndef _@GUARD_PREFIX@_STDIO_H +#define _@GUARD_PREFIX@_STDIO_H + +/* Get va_list. Needed on many systems, including glibc 2.8. */ +#include + +#include + +/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 + and eglibc 2.11.2. + May also define off_t to a 64-bit type on native Windows. */ +#include + +/* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ + && ! defined __GLIBC__ +# include +#endif + +/* Android 4.3 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'perror' in , not in . We must include + it before we #define perror rpl_perror. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'remove' in , not in . We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in , not in . We must include + it before we #define rename rpl_rename. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + + +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if __GNUC__ >= 11 +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The __-protected variants of the attributes 'format' and 'printf' are + accepted by gcc versions 2.6.4 (effectively 2.7) and later. + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because + gnulib and libintl do '#define printf __printf__' when they override + the 'printf' function. */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__ +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +# endif +#endif + +/* An __attribute__ __format__ specifier for a function that takes a format + string and arguments, where the format string directives are the ones + standardized by ISO C99 and POSIX. + _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ +/* __gnu_printf__ is supported in GCC >= 4.4. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ +#else +# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ +#endif + +/* An __attribute__ __format__ specifier for a function that takes a format + string and arguments, where the format string directives are the ones of the + system printf(), rather than the ones standardized by ISO C99 and POSIX. + _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */ +/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to + the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates + whether this change is effective. On older mingw, it is not. */ +#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD +#else +# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__ +#endif + +/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument)) + +/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD, + except that it indicates to GCC that the supported format string directives + are the ones of the system printf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument)) + +/* _GL_ATTRIBUTE_FORMAT_SCANF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, + except that it indicates to GCC that the supported format string directives + are the ones of the system scanf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Macros for stringification. */ +#define _GL_STDIO_STRINGIZE(token) #token +#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) + +/* When also using extern inline, suppress the use of static inline in + standard headers of problematic Apple configurations, as Libc at + least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + . + Perhaps Apple will fix this some day. */ +#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ + && defined __GNUC__ && defined __STDC__) +# undef putc_unlocked +#endif + +#if @GNULIB_DPRINTF@ +# if @REPLACE_DPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dprintf rpl_dprintf +# endif +_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); +# else +# if !@HAVE_DPRINTF@ +_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); +# endif +_GL_CXXALIASWARN (dprintf); +#elif defined GNULIB_POSIXCHECK +# undef dprintf +# if HAVE_RAW_DECL_DPRINTF +_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " + "use gnulib module dprintf for portability"); +# endif +#endif + +#if @GNULIB_FCLOSE@ +/* Close STREAM and its underlying file descriptor. */ +# if @REPLACE_FCLOSE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fclose rpl_fclose +# endif +_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fclose); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fclose +/* Assume fclose is always declared. */ +_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " + "use gnulib module fclose for portable POSIX compliance"); +#endif + +#if @GNULIB_MDA_FCLOSEALL@ +/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is + not required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcloseall +# define fcloseall _fcloseall +# endif +_GL_CXXALIAS_MDA (fcloseall, int, (void)); +# else +# if @HAVE_DECL_FCLOSEALL@ +# if defined __FreeBSD__ || defined __DragonFly__ +_GL_CXXALIAS_SYS (fcloseall, void, (void)); +# else +_GL_CXXALIAS_SYS (fcloseall, int, (void)); +# endif +# endif +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@ +_GL_CXXALIASWARN (fcloseall); +# endif +#endif + +#if @GNULIB_FDOPEN@ +# if @REPLACE_FDOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen rpl_fdopen +# endif +_GL_FUNCDECL_RPL (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen _fdopen +# endif +_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); +# endif +_GL_CXXALIASWARN (fdopen); +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen +/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fdopen, FILE *, + (int fd, const char *mode) + _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef fdopen +/* Assume fdopen is always declared. */ +_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " + "use gnulib module fdopen for portability"); +# elif @GNULIB_MDA_FDOPEN@ +/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fdopen always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen _fdopen +# endif +_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); +# else +_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); +# endif +_GL_CXXALIASWARN (fdopen); +# endif +#endif + +#if @GNULIB_FFLUSH@ +/* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. + Note! LOSS OF DATA can occur if fflush is applied on an input stream + that is _not_seekable_ or on an update stream that is _not_seekable_ + and in which the most recent operation was input. Seekability can + be tested with lseek(fileno(fp),0,SEEK_CUR). */ +# if @REPLACE_FFLUSH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fflush rpl_fflush +# endif +_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); +_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); +# else +_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fflush); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fflush +/* Assume fflush is always declared. */ +_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " + "use gnulib module fflush for portable POSIX compliance"); +#endif + +#if @GNULIB_FGETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgetc +# define fgetc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fgetc); +# endif +#endif + +#if @GNULIB_FGETS@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgets +# define fgets rpl_fgets +# endif +_GL_FUNCDECL_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fgets); +# endif +#endif + +#if @GNULIB_MDA_FILENO@ +/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fileno always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fileno +# define fileno _fileno +# endif +_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (fileno); +#endif + +#if @GNULIB_FOPEN@ +# if (@GNULIB_FOPEN@ && @REPLACE_FOPEN@) \ + || (@GNULIB_FOPEN_GNU@ && @REPLACE_FOPEN_FOR_FOPEN_GNU@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fopen +# define fopen rpl_fopen +# endif +_GL_FUNCDECL_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +_GL_CXXALIAS_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +_GL_CXXALIAS_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fopen); +# endif +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen +/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef fopen +/* Assume fopen is always declared. */ +_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " + "use gnulib module fopen for portability"); +# endif +#endif + +#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ +# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ + || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fprintf rpl_fprintf +# endif +# define GNULIB_overrides_fprintf 1 +# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fprintf); +# endif +#endif +#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_fprintf +# undef fprintf +# endif +/* Assume fprintf is always declared. */ +_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " + "use gnulib module fprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_FPURGE@ +/* Discard all pending buffered I/O data on STREAM. + STREAM must not be wide-character oriented. + When discarding pending output, the file position is set back to where it + was before the write calls. When discarding pending input, the file + position is advanced to match the end of the previously read input. + Return 0 if successful. Upon error, return -1 and set errno. */ +# if @REPLACE_FPURGE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fpurge rpl_fpurge +# endif +_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); +# else +# if !@HAVE_DECL_FPURGE@ +_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); +# endif +_GL_CXXALIASWARN (fpurge); +#elif defined GNULIB_POSIXCHECK +# undef fpurge +# if HAVE_RAW_DECL_FPURGE +_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " + "use gnulib module fpurge for portability"); +# endif +#endif + +#if @GNULIB_FPUTC@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fputc +# define fputc rpl_fputc +# endif +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fputc); +# endif +#endif + +#if @GNULIB_FPUTS@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fputs +# define fputs rpl_fputs +# endif +_GL_FUNCDECL_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fputs, int, + (const char *restrict string, FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fputs); +# endif +#endif + +#if @GNULIB_FREAD@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fread +# define fread rpl_fread +# endif +_GL_FUNCDECL_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fread); +# endif +#endif + +#if @GNULIB_FREOPEN@ +# if @REPLACE_FREOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef freopen +# define freopen rpl_freopen +# endif +_GL_FUNCDECL_RPL (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (freopen); +# endif +#elif defined GNULIB_POSIXCHECK +# undef freopen +/* Assume freopen is always declared. */ +_GL_WARN_ON_USE (freopen, + "freopen on native Windows platforms is not POSIX compliant - " + "use gnulib module freopen for portability"); +#endif + +#if @GNULIB_FSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fscanf +# define fscanf rpl_fscanf +# endif +_GL_FUNCDECL_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fscanf); +# endif +#endif + + +/* Set up the following warnings, based on which modules are in use. + GNU Coding Standards discourage the use of fseek, since it imposes + an arbitrary limitation on some 32-bit hosts. Remember that the + fseek module depends on the fseeko module, so we only have three + cases to consider: + + 1. The developer is not using either module. Issue a warning under + GNULIB_POSIXCHECK for both functions, to remind them that both + functions have bugs on some systems. _GL_NO_LARGE_FILES has no + impact on this warning. + + 2. The developer is using both modules. They may be unaware of the + arbitrary limitations of fseek, so issue a warning under + GNULIB_POSIXCHECK. On the other hand, they may be using both + modules intentionally, so the developer can define + _GL_NO_LARGE_FILES in the compilation units where the use of fseek + is safe, to silence the warning. + + 3. The developer is using the fseeko module, but not fseek. Gnulib + guarantees that fseek will still work around platform bugs in that + case, but we presume that the developer is aware of the pitfalls of + fseek and was trying to avoid it, so issue a warning even when + GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be + defined to silence the warning in particular compilation units. + In C++ compilations with GNULIB_NAMESPACE, in order to avoid that + fseek gets defined as a macro, it is recommended that the developer + uses the fseek module, even if he is not calling the fseek function. + + Most gnulib clients that perform stream operations should fall into + category 3. */ + +#if @GNULIB_FSEEK@ +# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES +# define _GL_FSEEK_WARN /* Category 2, above. */ +# undef fseek +# endif +# if @REPLACE_FSEEK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fseek +# define fseek rpl_fseek +# endif +_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); +# else +_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fseek); +# endif +#endif + +#if @GNULIB_FSEEKO@ +# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES +# define _GL_FSEEK_WARN /* Category 3, above. */ +# undef fseek +# endif +# if @REPLACE_FSEEKO@ +/* Provide an fseeko function that is aware of a preceding fflush(), and which + detects pipes. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fseeko +# define fseeko rpl_fseeko +# endif +_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); +# else +# if ! @HAVE_DECL_FSEEKO@ +_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); +# endif +_GL_CXXALIASWARN (fseeko); +#elif defined GNULIB_POSIXCHECK +# define _GL_FSEEK_WARN /* Category 1, above. */ +# undef fseek +# undef fseeko +# if HAVE_RAW_DECL_FSEEKO +_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " + "use gnulib module fseeko for portability"); +# endif +#endif + +#ifdef _GL_FSEEK_WARN +# undef _GL_FSEEK_WARN +/* Here, either fseek is undefined (but C89 guarantees that it is + declared), or it is defined as rpl_fseek (declared above). */ +_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " + "on 32-bit platforms - " + "use fseeko function for handling of large files"); +#endif + + +/* ftell, ftello. See the comments on fseek/fseeko. */ + +#if @GNULIB_FTELL@ +# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES +# define _GL_FTELL_WARN /* Category 2, above. */ +# undef ftell +# endif +# if @REPLACE_FTELL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftell +# define ftell rpl_ftell +# endif +_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); +# else +_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (ftell); +# endif +#endif + +#if @GNULIB_FTELLO@ +# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES +# define _GL_FTELL_WARN /* Category 3, above. */ +# undef ftell +# endif +# if @REPLACE_FTELLO@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftello +# define ftello rpl_ftello +# endif +_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); +# else +# if ! @HAVE_DECL_FTELLO@ +_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); +# endif +_GL_CXXALIASWARN (ftello); +#elif defined GNULIB_POSIXCHECK +# define _GL_FTELL_WARN /* Category 1, above. */ +# undef ftell +# undef ftello +# if HAVE_RAW_DECL_FTELLO +_GL_WARN_ON_USE (ftello, "ftello is unportable - " + "use gnulib module ftello for portability"); +# endif +#endif + +#ifdef _GL_FTELL_WARN +# undef _GL_FTELL_WARN +/* Here, either ftell is undefined (but C89 guarantees that it is + declared), or it is defined as rpl_ftell (declared above). */ +_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " + "on 32-bit platforms - " + "use ftello function for handling of large files"); +#endif + + +#if @GNULIB_FWRITE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fwrite +# define fwrite rpl_fwrite +# endif +_GL_FUNCDECL_RPL (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 4))); +_GL_CXXALIAS_RPL (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); + +/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 + , + which sometimes causes an unwanted diagnostic for fwrite calls. + This affects only function declaration attributes under certain + versions of gcc and clang, and is not needed for C++. */ +# if (0 < __USE_FORTIFY_LEVEL \ + && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ + && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ + && !defined __cplusplus) +# undef fwrite +# undef fwrite_unlocked +extern size_t __REDIRECT (rpl_fwrite, + (const void *__restrict, size_t, size_t, + FILE *__restrict), + fwrite); +extern size_t __REDIRECT (rpl_fwrite_unlocked, + (const void *__restrict, size_t, size_t, + FILE *__restrict), + fwrite_unlocked); +# define fwrite rpl_fwrite +# define fwrite_unlocked rpl_fwrite_unlocked +# endif +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fwrite); +# endif +#endif + +#if @GNULIB_GETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getc +# define getc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getc); +# endif +#endif + +#if @GNULIB_GETCHAR@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getchar +# define getchar rpl_getchar +# endif +_GL_FUNCDECL_RPL (getchar, int, (void)); +_GL_CXXALIAS_RPL (getchar, int, (void)); +# else +_GL_CXXALIAS_SYS (getchar, int, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getchar); +# endif +#endif + +#if @GNULIB_GETDELIM@ +/* Read input, up to (and including) the next occurrence of DELIMITER, from + STREAM, store it in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +# if @REPLACE_GETDELIM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getdelim +# define getdelim rpl_getdelim +# endif +_GL_FUNCDECL_RPL (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 4))); +_GL_CXXALIAS_RPL (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); +# else +# if !@HAVE_DECL_GETDELIM@ +_GL_FUNCDECL_SYS (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 4))); +# endif +_GL_CXXALIAS_SYS (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (getdelim); +#elif defined GNULIB_POSIXCHECK +# undef getdelim +# if HAVE_RAW_DECL_GETDELIM +_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " + "use gnulib module getdelim for portability"); +# endif +#endif + +#if @GNULIB_GETLINE@ +/* Read a line, up to (and including) the next newline, from STREAM, store it + in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +# if @REPLACE_GETLINE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getline +# define getline rpl_getline +# endif +_GL_FUNCDECL_RPL (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 3))); +_GL_CXXALIAS_RPL (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); +# else +# if !@HAVE_DECL_GETLINE@ +_GL_FUNCDECL_SYS (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); +# endif +# if @HAVE_DECL_GETLINE@ +_GL_CXXALIASWARN (getline); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getline +# if HAVE_RAW_DECL_GETLINE +_GL_WARN_ON_USE (getline, "getline is unportable - " + "use gnulib module getline for portability"); +# endif +#endif + +/* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning; besides, C11 + removed it. */ +#undef gets +#if HAVE_RAW_DECL_GETS && !defined __cplusplus +_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); +#endif + +#if @GNULIB_MDA_GETW@ +/* On native Windows, map 'getw' to '_getw', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::getw always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getw +# define getw _getw +# endif +_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); +# else +# if @HAVE_DECL_GETW@ +_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); +# endif +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getw); +# endif +#endif + +#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ +struct obstack; +/* Grow an obstack with formatted output. Return the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. Upon + memory allocation error, call obstack_alloc_failed_handler. Upon + other error, return -1. */ +# if @REPLACE_OBSTACK_PRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define obstack_printf rpl_obstack_printf +# endif +_GL_FUNCDECL_RPL (obstack_printf, int, + (struct obstack *obs, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (obstack_printf, int, + (struct obstack *obs, const char *format, ...)); +# else +# if !@HAVE_DECL_OBSTACK_PRINTF@ +_GL_FUNCDECL_SYS (obstack_printf, int, + (struct obstack *obs, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (obstack_printf, int, + (struct obstack *obs, const char *format, ...)); +# endif +_GL_CXXALIASWARN (obstack_printf); +# if @REPLACE_OBSTACK_PRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define obstack_vprintf rpl_obstack_vprintf +# endif +_GL_FUNCDECL_RPL (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args)); +# else +# if !@HAVE_DECL_OBSTACK_PRINTF@ +_GL_FUNCDECL_SYS (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (obstack_vprintf); +#endif + +#if @GNULIB_PCLOSE@ +# if !@HAVE_PCLOSE@ +_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); +_GL_CXXALIASWARN (pclose); +#elif defined GNULIB_POSIXCHECK +# undef pclose +# if HAVE_RAW_DECL_PCLOSE +_GL_WARN_ON_USE (pclose, "pclose is unportable - " + "use gnulib module pclose for more portability"); +# endif +#endif + +#if @GNULIB_PERROR@ +/* Print a message to standard error, describing the value of ERRNO, + (if STRING is not NULL and not empty) prefixed with STRING and ": ", + and terminated with a newline. */ +# if @REPLACE_PERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define perror rpl_perror +# endif +_GL_FUNCDECL_RPL (perror, void, (const char *string)); +_GL_CXXALIAS_RPL (perror, void, (const char *string)); +# else +_GL_CXXALIAS_SYS (perror, void, (const char *string)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (perror); +# endif +#elif defined GNULIB_POSIXCHECK +# undef perror +/* Assume perror is always declared. */ +_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " + "use gnulib module perror for portability"); +#endif + +#if @GNULIB_POPEN@ +# if @REPLACE_POPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef popen +# define popen rpl_popen +# endif +_GL_FUNCDECL_RPL (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); +_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); +# else +# if !@HAVE_POPEN@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); +# endif +_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); +# endif +_GL_CXXALIASWARN (popen); +#else +# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen +/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ +_GL_FUNCDECL_SYS (popen, FILE *, + (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef popen +# if HAVE_RAW_DECL_POPEN +_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " + "use gnulib module popen or pipe for more portability"); +# endif +# endif +#endif + +#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ +# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ + || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if defined __GNUC__ || defined __clang__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +/* Don't break __attribute__((format(printf,M,N))). */ +# define printf __printf__ +# endif +# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define printf rpl_printf +# endif +_GL_FUNCDECL_RPL (printf, int, + (const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); +# endif +# define GNULIB_overrides_printf 1 +# else +_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (printf); +# endif +#endif +#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_printf +# undef printf +# endif +/* Assume printf is always declared. */ +_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " + "use gnulib module printf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_PUTC@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putc +# define putc rpl_fputc +# endif +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); +# else +_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (putc); +# endif +#endif + +#if @GNULIB_PUTCHAR@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putchar +# define putchar rpl_putchar +# endif +_GL_FUNCDECL_RPL (putchar, int, (int c)); +_GL_CXXALIAS_RPL (putchar, int, (int c)); +# else +_GL_CXXALIAS_SYS (putchar, int, (int c)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (putchar); +# endif +#endif + +#if @GNULIB_PUTS@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef puts +# define puts rpl_puts +# endif +_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (puts, int, (const char *string)); +# else +_GL_CXXALIAS_SYS (puts, int, (const char *string)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (puts); +# endif +#endif + +#if @GNULIB_MDA_PUTW@ +/* On native Windows, map 'putw' to '_putw', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::putw always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putw +# define putw _putw +# endif +_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); +# else +# if @HAVE_DECL_PUTW@ +_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); +# endif +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (putw); +# endif +#endif + +#if @GNULIB_REMOVE@ +# if @REPLACE_REMOVE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef remove +# define remove rpl_remove +# endif +_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (remove, int, (const char *name)); +# else +_GL_CXXALIAS_SYS (remove, int, (const char *name)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (remove); +# endif +#elif defined GNULIB_POSIXCHECK +# undef remove +/* Assume remove is always declared. */ +_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " + "use gnulib module remove for more portability"); +#endif + +#if @GNULIB_RENAME@ +# if @REPLACE_RENAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rename +# define rename rpl_rename +# endif +_GL_FUNCDECL_RPL (rename, int, + (const char *old_filename, const char *new_filename) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (rename, int, + (const char *old_filename, const char *new_filename)); +# else +_GL_CXXALIAS_SYS (rename, int, + (const char *old_filename, const char *new_filename)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (rename); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rename +/* Assume rename is always declared. */ +_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " + "use gnulib module rename for more portability"); +#endif + +#if @GNULIB_RENAMEAT@ +# if @REPLACE_RENAMEAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef renameat +# define renameat rpl_renameat +# endif +_GL_FUNCDECL_RPL (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2)); +# else +# if !@HAVE_RENAMEAT@ +_GL_FUNCDECL_SYS (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2)); +# endif +_GL_CXXALIASWARN (renameat); +#elif defined GNULIB_POSIXCHECK +# undef renameat +# if HAVE_RAW_DECL_RENAMEAT +_GL_WARN_ON_USE (renameat, "renameat is not portable - " + "use gnulib module renameat for portability"); +# endif +#endif + +#if @GNULIB_SCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if defined __GNUC__ || defined __clang__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +/* Don't break __attribute__((format(scanf,M,N))). */ +# define scanf __scanf__ +# endif +_GL_FUNCDECL_RPL_1 (__scanf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +# define scanf rpl_scanf +# endif +_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); +# endif +# else +_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (scanf); +# endif +#endif + +#if @GNULIB_SNPRINTF@ +# if @REPLACE_SNPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define snprintf rpl_snprintf +# endif +# define GNULIB_overrides_snprintf 1 +_GL_FUNCDECL_RPL (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_RPL (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...)); +# else +# if !@HAVE_DECL_SNPRINTF@ +_GL_FUNCDECL_SYS (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) + _GL_ARG_NONNULL ((3))); +# endif +_GL_CXXALIAS_SYS (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (snprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef snprintf +# if HAVE_RAW_DECL_SNPRINTF +_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " + "use gnulib module snprintf for portability"); +# endif +#endif + +/* Some people would argue that all sprintf uses should be warned about + (for example, OpenBSD issues a link warning for it), + since it can cause security holes due to buffer overruns. + However, we believe that sprintf can be used safely, and is more + efficient than snprintf in those safe cases; and as proof of our + belief, we use sprintf in several gnulib modules. So this header + intentionally avoids adding a warning to sprintf except when + GNULIB_POSIXCHECK is defined. */ + +#if @GNULIB_SPRINTF_POSIX@ +# if @REPLACE_SPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define sprintf rpl_sprintf +# endif +# define GNULIB_overrides_sprintf 1 +_GL_FUNCDECL_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (sprintf, int, + (char *restrict str, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (sprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sprintf +/* Assume sprintf is always declared. */ +_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " + "use gnulib module sprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_MDA_TEMPNAM@ +/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::tempnam always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tempnam +# define tempnam _tempnam +# endif +_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix)); +# else +_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix)); +# endif +_GL_CXXALIASWARN (tempnam); +#endif + +#if @GNULIB_TMPFILE@ +# if @REPLACE_TMPFILE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define tmpfile rpl_tmpfile +# endif +_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (tmpfile); +# endif +#else +# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile +/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ +_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) + _GL_ATTRIBUTE_DEALLOC (fclose, 1)); +# endif +# if defined GNULIB_POSIXCHECK +# undef tmpfile +# if HAVE_RAW_DECL_TMPFILE +_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " + "use gnulib module tmpfile for portability"); +# endif +# endif +#endif + +#if @GNULIB_VASPRINTF@ +/* Write formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, store the address of the string in + *RESULT and return the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, return -1. */ +# if @REPLACE_VASPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define asprintf rpl_asprintf +# endif +# define GNULIB_overrides_asprintf +_GL_FUNCDECL_RPL (asprintf, int, + (char **result, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (asprintf, int, + (char **result, const char *format, ...)); +# else +# if !@HAVE_VASPRINTF@ +_GL_FUNCDECL_SYS (asprintf, int, + (char **result, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (asprintf, int, + (char **result, const char *format, ...)); +# endif +_GL_CXXALIASWARN (asprintf); +# if @REPLACE_VASPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vasprintf rpl_vasprintf +# endif +# define GNULIB_overrides_vasprintf 1 +_GL_FUNCDECL_RPL (vasprintf, int, + (char **result, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vasprintf, int, + (char **result, const char *format, va_list args)); +# else +# if !@HAVE_VASPRINTF@ +_GL_FUNCDECL_SYS (vasprintf, int, + (char **result, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (vasprintf, int, + (char **result, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vasprintf); +#endif + +#if @GNULIB_VDPRINTF@ +# if @REPLACE_VDPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vdprintf rpl_vdprintf +# endif +_GL_FUNCDECL_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args)); +# else +# if !@HAVE_VDPRINTF@ +_GL_FUNCDECL_SYS (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((2))); +# endif +/* Need to cast, because on Solaris, the third parameter will likely be + __va_list args. */ +_GL_CXXALIAS_SYS_CAST (vdprintf, int, + (int fd, const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vdprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vdprintf +# if HAVE_RAW_DECL_VDPRINTF +_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " + "use gnulib module vdprintf for portability"); +# endif +#endif + +#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ +# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ + || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vfprintf rpl_vfprintf +# endif +# define GNULIB_overrides_vfprintf 1 +# if @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the third parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vfprintf); +# endif +#endif +#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_vfprintf +# undef vfprintf +# endif +/* Assume vfprintf is always declared. */ +_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " + "use gnulib module vfprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_VFSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfscanf +# define vfscanf rpl_vfscanf +# endif +_GL_FUNCDECL_RPL (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args)); +# else +_GL_CXXALIAS_SYS (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vfscanf); +# endif +#endif + +#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ +# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ + || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vprintf rpl_vprintf +# endif +# define GNULIB_overrides_vprintf 1 +# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) + _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the second parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vprintf, int, + (const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vprintf); +# endif +#endif +#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_vprintf +# undef vprintf +# endif +/* Assume vprintf is always declared. */ +_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " + "use gnulib module vprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_VSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vscanf +# define vscanf rpl_vscanf +# endif +_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); +# else +_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vscanf); +# endif +#endif + +#if @GNULIB_VSNPRINTF@ +# if @REPLACE_VSNPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vsnprintf rpl_vsnprintf +# endif +# define GNULIB_overrides_vsnprintf 1 +_GL_FUNCDECL_RPL (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_RPL (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args)); +# else +# if !@HAVE_DECL_VSNPRINTF@ +_GL_FUNCDECL_SYS (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) + _GL_ARG_NONNULL ((3))); +# endif +_GL_CXXALIAS_SYS (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vsnprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsnprintf +# if HAVE_RAW_DECL_VSNPRINTF +_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " + "use gnulib module vsnprintf for portability"); +# endif +#endif + +#if @GNULIB_VSPRINTF_POSIX@ +# if @REPLACE_VSPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vsprintf rpl_vsprintf +# endif +# define GNULIB_overrides_vsprintf 1 +_GL_FUNCDECL_RPL (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the third parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vsprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsprintf +/* Assume vsprintf is always declared. */ +_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " + "use gnulib module vsprintf-posix for portable " + "POSIX compliance"); +#endif + +#endif /* _@GUARD_PREFIX@_STDIO_H */ +#endif /* _@GUARD_PREFIX@_STDIO_H */ +#endif diff --git a/cross/lib/stdlib.in.h b/cross/lib/stdlib.in.h new file mode 100644 index 00000000000..b79e5f70965 --- /dev/null +++ b/cross/lib/stdlib.in.h @@ -0,0 +1,1563 @@ +/* A GNU-like . + + Copyright (C) 1995, 2001-2004, 2006-2023 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc +/* Special invocation conventions inside some gnulib header files, + and inside some glibc header files, respectively. */ + +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STDLIB_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ + +#ifndef _@GUARD_PREFIX@_STDLIB_H +#define _@GUARD_PREFIX@_STDLIB_H + +/* NetBSD 5.0 mis-defines NULL. */ +#include + +/* MirBSD 10 defines WEXITSTATUS in , not in . */ +#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS +# include +#endif + +/* Solaris declares getloadavg() in . */ +#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ +/* OpenIndiana has a bug: must be included before + . */ +# include +# include +#endif + +/* Native Windows platforms declare _mktemp() in . */ +#if defined _WIN32 && !defined __CYGWIN__ +# include +#endif + +#if @GNULIB_RANDOM_R@ + +/* OSF/1 5.1 declares 'struct random_data' in , which is included + from if _REENTRANT is defined. Include it whenever we need + 'struct random_data'. */ +# if @HAVE_RANDOM_H@ +# include +# endif + +# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ +# include +# endif + +# if !@HAVE_STRUCT_RANDOM_DATA@ +/* Define 'struct random_data'. + But allow multiple gnulib generated replacements to coexist. */ +# if !GNULIB_defined_struct_random_data +struct random_data +{ + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ +}; +# define GNULIB_defined_struct_random_data 1 +# endif +# endif +#endif + +#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) +/* On Mac OS X 10.3, only declares mkstemp. */ +/* On Mac OS X 10.5, only declares mkstemps. */ +/* On Mac OS X 10.13, only declares mkostemp and mkostemps. */ +/* On Cygwin 1.7.1, only declares getsubopt. */ +/* But avoid namespace pollution on glibc systems and native Windows. */ +# include +#endif + +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. */ +#ifndef _GL_ATTRIBUTE_DEALLOC +# if __GNUC__ >= 11 +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +# else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +# endif +#endif + +/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#ifndef _GL_ATTRIBUTE_DEALLOC_FREE +# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) +#endif + +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_MALLOC +# if __GNUC__ >= 3 || defined __clang__ +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC +# endif +#endif + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* The definition of _Noreturn is copied here. */ + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere + with proper operation of xargs. */ +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#elif EXIT_FAILURE != 1 +# undef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + + +#if @GNULIB__EXIT@ +/* Terminate the current process with the given return code, without running + the 'atexit' handlers. */ +# if !@HAVE__EXIT@ +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); +# endif +_GL_CXXALIAS_SYS (_Exit, void, (int status)); +_GL_CXXALIASWARN (_Exit); +#elif defined GNULIB_POSIXCHECK +# undef _Exit +# if HAVE_RAW_DECL__EXIT +_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " + "use gnulib module _Exit for portability"); +# endif +#endif + + +#if @GNULIB_FREE_POSIX@ +# if @REPLACE_FREE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef free +# define free rpl_free +# endif +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_FUNCDECL_RPL (free, void, (void *ptr) throw ()); +# else +_GL_FUNCDECL_RPL (free, void, (void *ptr)); +# endif +_GL_CXXALIAS_RPL (free, void, (void *ptr)); +# else +_GL_CXXALIAS_SYS (free, void, (void *ptr)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (free); +# endif +#elif defined GNULIB_POSIXCHECK +# undef free +/* Assume free is always declared. */ +_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " + "use gnulib module free for portability"); +#endif + + +/* Allocate memory with indefinite extent and specified alignment. */ +#if @GNULIB_ALIGNED_ALLOC@ +# if @REPLACE_ALIGNED_ALLOC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef aligned_alloc +# define aligned_alloc rpl_aligned_alloc +# endif +_GL_FUNCDECL_RPL (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); +# else +# if @HAVE_ALIGNED_ALLOC@ +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); +# endif +# endif +# if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@ +_GL_CXXALIASWARN (aligned_alloc); +# endif +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc +/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (aligned_alloc, void *, + (size_t alignment, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef aligned_alloc +# if HAVE_RAW_DECL_ALIGNED_ALLOC +_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " + "use gnulib module aligned_alloc for portability"); +# endif +# endif +#endif + +#if @GNULIB_ATOLL@ +/* Parse a signed decimal integer. + Returns the value of the integer. Errors are not detected. */ +# if !@HAVE_ATOLL@ +_GL_FUNCDECL_SYS (atoll, long long, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); +_GL_CXXALIASWARN (atoll); +#elif defined GNULIB_POSIXCHECK +# undef atoll +# if HAVE_RAW_DECL_ATOLL +_GL_WARN_ON_USE (atoll, "atoll is unportable - " + "use gnulib module atoll for portability"); +# endif +#endif + +#if @GNULIB_CALLOC_POSIX@ +# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ + || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef calloc +# define calloc rpl_calloc +# endif +_GL_FUNCDECL_RPL (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (calloc); +# endif +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc +/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (calloc, void *, + (size_t nmemb, size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef calloc +/* Assume calloc is always declared. */ +_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " + "use gnulib module calloc-posix for portability"); +# endif +#endif + +#if @GNULIB_CANONICALIZE_FILE_NAME@ +# if @REPLACE_CANONICALIZE_FILE_NAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define canonicalize_file_name rpl_canonicalize_file_name +# endif +_GL_FUNCDECL_RPL (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); +# else +# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); +# endif +# ifndef GNULIB_defined_canonicalize_file_name +# define GNULIB_defined_canonicalize_file_name \ + (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) +# endif +_GL_CXXALIASWARN (canonicalize_file_name); +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name +/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or + rpl_free. */ +_GL_FUNCDECL_SYS (canonicalize_file_name, char *, + (const char *name) + _GL_ARG_NONNULL ((1)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK +# undef canonicalize_file_name +# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME +_GL_WARN_ON_USE (canonicalize_file_name, + "canonicalize_file_name is unportable - " + "use gnulib module canonicalize-lgpl for portability"); +# endif +# endif +#endif + +#if @GNULIB_MDA_ECVT@ +/* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ecvt +# define ecvt _ecvt +# endif +_GL_CXXALIAS_MDA (ecvt, char *, + (double number, int ndigits, int *decptp, int *signp)); +# else +# if @HAVE_DECL_ECVT@ +_GL_CXXALIAS_SYS (ecvt, char *, + (double number, int ndigits, int *decptp, int *signp)); +# endif +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@ +_GL_CXXALIASWARN (ecvt); +# endif +#endif + +#if @GNULIB_MDA_FCVT@ +/* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcvt +# define fcvt _fcvt +# endif +_GL_CXXALIAS_MDA (fcvt, char *, + (double number, int ndigits, int *decptp, int *signp)); +# else +# if @HAVE_DECL_FCVT@ +_GL_CXXALIAS_SYS (fcvt, char *, + (double number, int ndigits, int *decptp, int *signp)); +# endif +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@ +_GL_CXXALIASWARN (fcvt); +# endif +#endif + +#if @GNULIB_MDA_GCVT@ +/* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gcvt +# define gcvt _gcvt +# endif +_GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf)); +# else +# if @HAVE_DECL_GCVT@ +_GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf)); +# endif +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@ +_GL_CXXALIASWARN (gcvt); +# endif +#endif + +#if @GNULIB_GETLOADAVG@ +/* Store max(NELEM,3) load average numbers in LOADAVG[]. + The three numbers are the load average of the last 1 minute, the last 5 + minutes, and the last 15 minutes, respectively. + LOADAVG is an array of NELEM numbers. */ +# if !@HAVE_DECL_GETLOADAVG@ +_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); +_GL_CXXALIASWARN (getloadavg); +#elif defined GNULIB_POSIXCHECK +# undef getloadavg +# if HAVE_RAW_DECL_GETLOADAVG +_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " + "use gnulib module getloadavg for portability"); +# endif +#endif + +#if @GNULIB_GETSUBOPT@ +/* Assuming *OPTIONP is a comma separated list of elements of the form + "token" or "token=value", getsubopt parses the first of these elements. + If the first element refers to a "token" that is member of the given + NULL-terminated array of tokens: + - It replaces the comma with a NUL byte, updates *OPTIONP to point past + the first option and the comma, sets *VALUEP to the value of the + element (or NULL if it doesn't contain an "=" sign), + - It returns the index of the "token" in the given array of tokens. + Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. + For more details see the POSIX specification. + https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ +# if !@HAVE_GETSUBOPT@ +_GL_FUNCDECL_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep) + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (getsubopt, int, + (char **optionp, char *const *tokens, char **valuep)); +_GL_CXXALIASWARN (getsubopt); +#elif defined GNULIB_POSIXCHECK +# undef getsubopt +# if HAVE_RAW_DECL_GETSUBOPT +_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " + "use gnulib module getsubopt for portability"); +# endif +#endif + +#if @GNULIB_GRANTPT@ +/* Change the ownership and access permission of the slave side of the + pseudo-terminal whose master side is specified by FD. */ +# if !@HAVE_GRANTPT@ +_GL_FUNCDECL_SYS (grantpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (grantpt, int, (int fd)); +_GL_CXXALIASWARN (grantpt); +#elif defined GNULIB_POSIXCHECK +# undef grantpt +# if HAVE_RAW_DECL_GRANTPT +_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " + "use gnulib module grantpt for portability"); +# endif +#endif + +/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not + rely on GNU or POSIX semantics for malloc and realloc (for example, + by never specifying a zero size), so it does not need malloc or + realloc to be redefined. */ +#if @GNULIB_MALLOC_POSIX@ +# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ + || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef malloc +# define malloc rpl_malloc +# endif +_GL_FUNCDECL_RPL (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (malloc); +# endif +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc +/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (malloc, void *, + (size_t size) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef malloc +/* Assume malloc is always declared. */ +_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " + "use gnulib module malloc-posix for portability"); +# endif +#endif + +/* Convert a multibyte character to a wide character. */ +#if @GNULIB_MBTOWC@ +# if @REPLACE_MBTOWC@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mbtowc +# define mbtowc rpl_mbtowc +# endif +_GL_FUNCDECL_RPL (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); +_GL_CXXALIAS_RPL (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); +# else +# if !@HAVE_MBTOWC@ +_GL_FUNCDECL_SYS (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); +# endif +_GL_CXXALIAS_SYS (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (mbtowc); +# endif +#elif defined GNULIB_POSIXCHECK +# undef mbtowc +# if HAVE_RAW_DECL_MBTOWC +_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " + "use gnulib module mbtowc for portability"); +# endif +#endif + +#if @GNULIB_MKDTEMP@ +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +# if !@HAVE_MKDTEMP@ +_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); +_GL_CXXALIASWARN (mkdtemp); +#elif defined GNULIB_POSIXCHECK +# undef mkdtemp +# if HAVE_RAW_DECL_MKDTEMP +_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " + "use gnulib module mkdtemp for portability"); +# endif +#endif + +#if @GNULIB_MKOSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMP@ +_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemp); +#elif defined GNULIB_POSIXCHECK +# undef mkostemp +# if HAVE_RAW_DECL_MKOSTEMP +_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " + "use gnulib module mkostemp for portability"); +# endif +#endif + +#if @GNULIB_MKOSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE before a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + The file is then created, with the specified flags, ensuring it didn't exist + before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKOSTEMPS@ +_GL_FUNCDECL_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkostemps, int, + (char * /*template*/, int /*suffixlen*/, int /*flags*/)); +_GL_CXXALIASWARN (mkostemps); +#elif defined GNULIB_POSIXCHECK +# undef mkostemps +# if HAVE_RAW_DECL_MKOSTEMPS +_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " + "use gnulib module mkostemps for portability"); +# endif +#endif + +#if @GNULIB_MKSTEMP@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if @REPLACE_MKSTEMP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mkstemp rpl_mkstemp +# endif +_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); +# else +# if ! @HAVE_MKSTEMP@ +_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); +# endif +_GL_CXXALIASWARN (mkstemp); +#elif defined GNULIB_POSIXCHECK +# undef mkstemp +# if HAVE_RAW_DECL_MKSTEMP +_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " + "use gnulib module mkstemp for portability"); +# endif +#endif + +#if @GNULIB_MKSTEMPS@ +/* Create a unique temporary file from TEMPLATE. + The last six characters of TEMPLATE prior to a suffix of length + SUFFIXLEN must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + The file is then created, ensuring it didn't exist before. + The file is created read-write (mask at least 0600 & ~umask), but it may be + world-readable and world-writable (mask 0666 & ~umask), depending on the + implementation. + Returns the open file descriptor if successful, otherwise -1 and errno + set. */ +# if !@HAVE_MKSTEMPS@ +_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); +_GL_CXXALIASWARN (mkstemps); +#elif defined GNULIB_POSIXCHECK +# undef mkstemps +# if HAVE_RAW_DECL_MKSTEMPS +_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " + "use gnulib module mkstemps for portability"); +# endif +#endif + +#if @GNULIB_MDA_MKTEMP@ +/* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::mktemp always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mktemp +# define mktemp _mktemp +# endif +_GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/)); +# else +_GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/)); +# endif +_GL_CXXALIASWARN (mktemp); +#endif + +/* Allocate memory with indefinite extent and specified alignment. */ +#if @GNULIB_POSIX_MEMALIGN@ +# if @REPLACE_POSIX_MEMALIGN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef posix_memalign +# define posix_memalign rpl_posix_memalign +# endif +_GL_FUNCDECL_RPL (posix_memalign, int, + (void **memptr, size_t alignment, size_t size) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (posix_memalign, int, + (void **memptr, size_t alignment, size_t size)); +# else +# if @HAVE_POSIX_MEMALIGN@ +_GL_CXXALIAS_SYS (posix_memalign, int, + (void **memptr, size_t alignment, size_t size)); +# endif +# endif +# if @HAVE_POSIX_MEMALIGN@ +_GL_CXXALIASWARN (posix_memalign); +# endif +#elif defined GNULIB_POSIXCHECK +# undef posix_memalign +# if HAVE_RAW_DECL_POSIX_MEMALIGN +_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " + "use gnulib module posix_memalign for portability"); +# endif +#endif + +#if @GNULIB_POSIX_OPENPT@ +/* Return an FD open to the master side of a pseudo-terminal. Flags should + include O_RDWR, and may also include O_NOCTTY. */ +# if !@HAVE_POSIX_OPENPT@ +_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); +# endif +_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); +_GL_CXXALIASWARN (posix_openpt); +#elif defined GNULIB_POSIXCHECK +# undef posix_openpt +# if HAVE_RAW_DECL_POSIX_OPENPT +_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " + "use gnulib module posix_openpt for portability"); +# endif +#endif + +#if @GNULIB_PTSNAME@ +/* Return the pathname of the pseudo-terminal slave associated with + the master FD is open on, or NULL on errors. */ +# if @REPLACE_PTSNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname +# define ptsname rpl_ptsname +# endif +_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); +_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); +# else +# if !@HAVE_PTSNAME@ +_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); +# endif +_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); +# endif +_GL_CXXALIASWARN (ptsname); +#elif defined GNULIB_POSIXCHECK +# undef ptsname +# if HAVE_RAW_DECL_PTSNAME +_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " + "use gnulib module ptsname for portability"); +# endif +#endif + +#if @GNULIB_PTSNAME_R@ +/* Set the pathname of the pseudo-terminal slave associated with + the master FD is open on and return 0, or set errno and return + non-zero on errors. */ +# if @REPLACE_PTSNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ptsname_r +# define ptsname_r rpl_ptsname_r +# endif +_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); +# else +# if !@HAVE_PTSNAME_R@ +_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); +# endif +# ifndef GNULIB_defined_ptsname_r +# define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@) +# endif +_GL_CXXALIASWARN (ptsname_r); +#elif defined GNULIB_POSIXCHECK +# undef ptsname_r +# if HAVE_RAW_DECL_PTSNAME_R +_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " + "use gnulib module ptsname_r for portability"); +# endif +#endif + +#if @GNULIB_PUTENV@ +# if @REPLACE_PUTENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putenv +# define putenv rpl_putenv +# endif +_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (putenv, int, (char *string)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putenv +# define putenv _putenv +# endif +_GL_CXXALIAS_MDA (putenv, int, (char *string)); +# else +_GL_CXXALIAS_SYS (putenv, int, (char *string)); +# endif +_GL_CXXALIASWARN (putenv); +#elif @GNULIB_MDA_PUTENV@ +/* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::putenv always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putenv +# define putenv _putenv +# endif +/* Need to cast, because on mingw, the parameter is either + 'const char *string' or 'char *string'. */ +_GL_CXXALIAS_MDA_CAST (putenv, int, (char *string)); +# else +_GL_CXXALIAS_SYS (putenv, int, (char *string)); +# endif +_GL_CXXALIASWARN (putenv); +#endif + +#if @GNULIB_QSORT_R@ +/* Sort an array of NMEMB elements, starting at address BASE, each element + occupying SIZE bytes, in ascending order according to the comparison + function COMPARE. */ +# ifdef __cplusplus +extern "C" { +# endif +# if !GNULIB_defined_qsort_r_fn_types +typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *); +# define GNULIB_defined_qsort_r_fn_types 1 +# endif +# ifdef __cplusplus +} +# endif +# if @REPLACE_QSORT_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef qsort_r +# define qsort_r rpl_qsort_r +# endif +_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, + _gl_qsort_r_compar_fn compare, + void *arg) _GL_ARG_NONNULL ((1, 4))); +_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, + _gl_qsort_r_compar_fn compare, + void *arg)); +# else +# if !@HAVE_QSORT_R@ +_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, + _gl_qsort_r_compar_fn compare, + void *arg) _GL_ARG_NONNULL ((1, 4))); +# endif +_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, + _gl_qsort_r_compar_fn compare, + void *arg)); +# endif +_GL_CXXALIASWARN (qsort_r); +#elif defined GNULIB_POSIXCHECK +# undef qsort_r +# if HAVE_RAW_DECL_QSORT_R +_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " + "use gnulib module qsort_r for portability"); +# endif +#endif + + +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ +# ifndef RAND_MAX +# define RAND_MAX 2147483647 +# endif +# endif +#endif + + +#if @GNULIB_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random +# define random rpl_random +# endif +_GL_FUNCDECL_RPL (random, long, (void)); +_GL_CXXALIAS_RPL (random, long, (void)); +# else +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (random, long, (void)); +# endif +/* Need to cast, because on Haiku, the return type is + int. */ +_GL_CXXALIAS_SYS_CAST (random, long, (void)); +# endif +_GL_CXXALIASWARN (random); +#elif defined GNULIB_POSIXCHECK +# undef random +# if HAVE_RAW_DECL_RANDOM +_GL_WARN_ON_USE (random, "random is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if @REPLACE_RANDOM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom +# define srandom rpl_srandom +# endif +_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); +_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); +# else +# if !@HAVE_RANDOM@ +_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); +# endif +/* Need to cast, because on FreeBSD, the first parameter is + unsigned long seed. */ +_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); +# endif +_GL_CXXALIASWARN (srandom); +#elif defined GNULIB_POSIXCHECK +# undef srandom +# if HAVE_RAW_DECL_SRANDOM +_GL_WARN_ON_USE (srandom, "srandom is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if @REPLACE_INITSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate +# define initstate rpl_initstate +# endif +_GL_FUNCDECL_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +# else +# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ +_GL_FUNCDECL_SYS (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size) + _GL_ARG_NONNULL ((2))); +# endif +/* Need to cast, because on FreeBSD, the first parameter is + unsigned long seed. */ +_GL_CXXALIAS_SYS_CAST (initstate, char *, + (unsigned int seed, char *buf, size_t buf_size)); +# endif +_GL_CXXALIASWARN (initstate); +#elif defined GNULIB_POSIXCHECK +# undef initstate +# if HAVE_RAW_DECL_INITSTATE +_GL_WARN_ON_USE (initstate, "initstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + +#if @GNULIB_RANDOM@ +# if @REPLACE_SETSTATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate +# define setstate rpl_setstate +# endif +_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); +# else +# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ +_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter + is const char *arg_state. */ +_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); +# endif +_GL_CXXALIASWARN (setstate); +#elif defined GNULIB_POSIXCHECK +# undef setstate +# if HAVE_RAW_DECL_SETSTATE +_GL_WARN_ON_USE (setstate, "setstate is unportable - " + "use gnulib module random for portability"); +# endif +#endif + + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef random_r +# define random_r rpl_random_r +# endif +_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); +# endif +_GL_CXXALIASWARN (random_r); +#elif defined GNULIB_POSIXCHECK +# undef random_r +# if HAVE_RAW_DECL_RANDOM_R +_GL_WARN_ON_USE (random_r, "random_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef srandom_r +# define srandom_r rpl_srandom_r +# endif +_GL_FUNCDECL_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (srandom_r, int, + (unsigned int seed, struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (srandom_r); +#elif defined GNULIB_POSIXCHECK +# undef srandom_r +# if HAVE_RAW_DECL_SRANDOM_R +_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef initstate_r +# define initstate_r rpl_initstate_r +# endif +_GL_FUNCDECL_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state) + _GL_ARG_NONNULL ((2, 4))); +# endif +/* Need to cast, because on Haiku, the third parameter is + unsigned long buf_size. */ +_GL_CXXALIAS_SYS_CAST (initstate_r, int, + (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (initstate_r); +#elif defined GNULIB_POSIXCHECK +# undef initstate_r +# if HAVE_RAW_DECL_INITSTATE_R +_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + +#if @GNULIB_RANDOM_R@ +# if @REPLACE_RANDOM_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setstate_r +# define setstate_r rpl_setstate_r +# endif +_GL_FUNCDECL_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# else +# if !@HAVE_RANDOM_R@ +_GL_FUNCDECL_SYS (setstate_r, int, + (char *arg_state, struct random_data *rand_state) + _GL_ARG_NONNULL ((1, 2))); +# endif +/* Need to cast, because on Haiku, the first parameter is + void *arg_state. */ +_GL_CXXALIAS_SYS_CAST (setstate_r, int, + (char *arg_state, struct random_data *rand_state)); +# endif +_GL_CXXALIASWARN (setstate_r); +#elif defined GNULIB_POSIXCHECK +# undef setstate_r +# if HAVE_RAW_DECL_SETSTATE_R +_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " + "use gnulib module random_r for portability"); +# endif +#endif + + +#if @GNULIB_REALLOC_POSIX@ +# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ + || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) +# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ + || _GL_USE_STDLIB_ALLOC) +# undef realloc +# define realloc rpl_realloc +# endif +_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); +_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); +# else +# if __GNUC__ >= 11 +/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (realloc); +# endif +#else +# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc +/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ +_GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size) + _GL_ATTRIBUTE_DEALLOC_FREE); +# endif +# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC +# undef realloc +/* Assume realloc is always declared. */ +_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " + "use gnulib module realloc-posix for portability"); +# endif +#endif + + +#if @GNULIB_REALLOCARRAY@ +# if @REPLACE_REALLOCARRAY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef reallocarray +# define reallocarray rpl_reallocarray +# endif +_GL_FUNCDECL_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +_GL_CXXALIAS_RPL (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# else +# if ! @HAVE_REALLOCARRAY@ +_GL_FUNCDECL_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# endif +_GL_CXXALIAS_SYS (reallocarray, void *, + (void *ptr, size_t nmemb, size_t size)); +# endif +_GL_CXXALIASWARN (reallocarray); +#elif defined GNULIB_POSIXCHECK +# undef reallocarray +# if HAVE_RAW_DECL_REALLOCARRAY +_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " + "use gnulib module reallocarray for portability"); +# endif +#endif + +#if @GNULIB_REALPATH@ +# if @REPLACE_REALPATH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define realpath rpl_realpath +# endif +_GL_FUNCDECL_RPL (realpath, char *, + (const char *restrict name, char *restrict resolved) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (realpath, char *, + (const char *restrict name, char *restrict resolved)); +# else +# if !@HAVE_REALPATH@ +_GL_FUNCDECL_SYS (realpath, char *, + (const char *restrict name, char *restrict resolved) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (realpath, char *, + (const char *restrict name, char *restrict resolved)); +# endif +_GL_CXXALIASWARN (realpath); +#elif defined GNULIB_POSIXCHECK +# undef realpath +# if HAVE_RAW_DECL_REALPATH +_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " + "canonicalize or canonicalize-lgpl for portability"); +# endif +#endif + +#if @GNULIB_RPMATCH@ +/* Test a user response to a question. + Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ +# if !@HAVE_RPMATCH@ +_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); +_GL_CXXALIASWARN (rpmatch); +#elif defined GNULIB_POSIXCHECK +# undef rpmatch +# if HAVE_RAW_DECL_RPMATCH +_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " + "use gnulib module rpmatch for portability"); +# endif +#endif + +#if @GNULIB_SECURE_GETENV@ +/* Look up NAME in the environment, returning 0 in insecure situations. */ +# if !@HAVE_SECURE_GETENV@ +_GL_FUNCDECL_SYS (secure_getenv, char *, + (char const *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); +_GL_CXXALIASWARN (secure_getenv); +#elif defined GNULIB_POSIXCHECK +# undef secure_getenv +# if HAVE_RAW_DECL_SECURE_GETENV +_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " + "use gnulib module secure_getenv for portability"); +# endif +#endif + +#if @GNULIB_SETENV@ +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +# if @REPLACE_SETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef setenv +# define setenv rpl_setenv +# endif +_GL_FUNCDECL_RPL (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (setenv, int, + (const char *name, const char *value, int replace)); +# else +# if !@HAVE_DECL_SETENV@ +_GL_FUNCDECL_SYS (setenv, int, + (const char *name, const char *value, int replace) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (setenv, int, + (const char *name, const char *value, int replace)); +# endif +# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) +_GL_CXXALIASWARN (setenv); +# endif +#elif defined GNULIB_POSIXCHECK +# undef setenv +# if HAVE_RAW_DECL_SETENV +_GL_WARN_ON_USE (setenv, "setenv is unportable - " + "use gnulib module setenv for portability"); +# endif +#endif + +#if @GNULIB_STRTOD@ + /* Parse a double from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtod rpl_strtod +# endif +# define GNULIB_defined_strtod_function 1 +_GL_FUNCDECL_RPL (strtod, double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtod, double, + (const char *restrict str, char **restrict endp)); +# else +# if !@HAVE_STRTOD@ +_GL_FUNCDECL_SYS (strtod, double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtod, double, + (const char *restrict str, char **restrict endp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strtod); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtod +# if HAVE_RAW_DECL_STRTOD +_GL_WARN_ON_USE (strtod, "strtod is unportable - " + "use gnulib module strtod for portability"); +# endif +#endif + +#if @GNULIB_STRTOLD@ + /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOLD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtold rpl_strtold +# endif +# define GNULIB_defined_strtold_function 1 +_GL_FUNCDECL_RPL (strtold, long double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtold, long double, + (const char *restrict str, char **restrict endp)); +# else +# if !@HAVE_STRTOLD@ +_GL_FUNCDECL_SYS (strtold, long double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtold, long double, + (const char *restrict str, char **restrict endp)); +# endif +_GL_CXXALIASWARN (strtold); +#elif defined GNULIB_POSIXCHECK +# undef strtold +# if HAVE_RAW_DECL_STRTOLD +_GL_WARN_ON_USE (strtold, "strtold is unportable - " + "use gnulib module strtold for portability"); +# endif +#endif + +#if @GNULIB_STRTOL@ +/* Parse a signed integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set + to ERANGE. */ +# if @REPLACE_STRTOL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtol rpl_strtol +# endif +# define GNULIB_defined_strtol_function 1 +_GL_FUNCDECL_RPL (strtol, long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtol, long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOL@ +_GL_FUNCDECL_SYS (strtol, long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtol, long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strtol); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtol +# if HAVE_RAW_DECL_STRTOL +_GL_WARN_ON_USE (strtol, "strtol is unportable - " + "use gnulib module strtol for portability"); +# endif +#endif + +#if @GNULIB_STRTOLL@ +/* Parse a signed integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set + to ERANGE. */ +# if @REPLACE_STRTOLL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoll rpl_strtoll +# endif +# define GNULIB_defined_strtoll_function 1 +_GL_FUNCDECL_RPL (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOLL@ +_GL_FUNCDECL_SYS (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoll, long long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +_GL_CXXALIASWARN (strtoll); +#elif defined GNULIB_POSIXCHECK +# undef strtoll +# if HAVE_RAW_DECL_STRTOLL +_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " + "use gnulib module strtoll for portability"); +# endif +#endif + +#if @GNULIB_STRTOUL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ +# if @REPLACE_STRTOUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoul rpl_strtoul +# endif +# define GNULIB_defined_strtoul_function 1 +_GL_FUNCDECL_RPL (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOUL@ +_GL_FUNCDECL_SYS (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoul, unsigned long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strtoul); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoul +# if HAVE_RAW_DECL_STRTOUL +_GL_WARN_ON_USE (strtoul, "strtoul is unportable - " + "use gnulib module strtoul for portability"); +# endif +#endif + +#if @GNULIB_STRTOULL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULLONG_MAX, and errno is set to + ERANGE. */ +# if @REPLACE_STRTOULL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtoull rpl_strtoull +# endif +# define GNULIB_defined_strtoull_function 1 +_GL_FUNCDECL_RPL (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base)); +# else +# if !@HAVE_STRTOULL@ +_GL_FUNCDECL_SYS (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtoull, unsigned long long, + (const char *restrict string, char **restrict endptr, + int base)); +# endif +_GL_CXXALIASWARN (strtoull); +#elif defined GNULIB_POSIXCHECK +# undef strtoull +# if HAVE_RAW_DECL_STRTOULL +_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " + "use gnulib module strtoull for portability"); +# endif +#endif + +#if @GNULIB_UNLOCKPT@ +/* Unlock the slave side of the pseudo-terminal whose master side is specified + by FD, so that it can be opened. */ +# if !@HAVE_UNLOCKPT@ +_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); +_GL_CXXALIASWARN (unlockpt); +#elif defined GNULIB_POSIXCHECK +# undef unlockpt +# if HAVE_RAW_DECL_UNLOCKPT +_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " + "use gnulib module unlockpt for portability"); +# endif +#endif + +#if @GNULIB_UNSETENV@ +/* Remove the variable NAME from the environment. */ +# if @REPLACE_UNSETENV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unsetenv +# define unsetenv rpl_unsetenv +# endif +_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); +# else +# if !@HAVE_DECL_UNSETENV@ +_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); +# endif +# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) +_GL_CXXALIASWARN (unsetenv); +# endif +#elif defined GNULIB_POSIXCHECK +# undef unsetenv +# if HAVE_RAW_DECL_UNSETENV +_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " + "use gnulib module unsetenv for portability"); +# endif +#endif + +/* Convert a wide character to a multibyte character. */ +#if @GNULIB_WCTOMB@ +# if @REPLACE_WCTOMB@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef wctomb +# define wctomb rpl_wctomb +# endif +_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); +_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); +# else +_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (wctomb); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif /* _@GUARD_PREFIX@_STDLIB_H */ +#endif diff --git a/xcompile/lib/stpcpy.c b/cross/lib/stpcpy.c similarity index 100% rename from xcompile/lib/stpcpy.c rename to cross/lib/stpcpy.c diff --git a/xcompile/lib/str-two-way.h b/cross/lib/str-two-way.h similarity index 100% rename from xcompile/lib/str-two-way.h rename to cross/lib/str-two-way.h diff --git a/xcompile/lib/strftime.h b/cross/lib/strftime.h similarity index 100% rename from xcompile/lib/strftime.h rename to cross/lib/strftime.h diff --git a/xcompile/lib/string.in.h b/cross/lib/string.in.h similarity index 100% rename from xcompile/lib/string.in.h rename to cross/lib/string.in.h diff --git a/xcompile/lib/strnlen.c b/cross/lib/strnlen.c similarity index 100% rename from xcompile/lib/strnlen.c rename to cross/lib/strnlen.c diff --git a/xcompile/lib/strtoimax.c b/cross/lib/strtoimax.c similarity index 100% rename from xcompile/lib/strtoimax.c rename to cross/lib/strtoimax.c diff --git a/xcompile/lib/strtol.c b/cross/lib/strtol.c similarity index 100% rename from xcompile/lib/strtol.c rename to cross/lib/strtol.c diff --git a/xcompile/lib/strtoll.c b/cross/lib/strtoll.c similarity index 100% rename from xcompile/lib/strtoll.c rename to cross/lib/strtoll.c diff --git a/xcompile/lib/symlink.c b/cross/lib/symlink.c similarity index 100% rename from xcompile/lib/symlink.c rename to cross/lib/symlink.c diff --git a/xcompile/lib/sys_random.in.h b/cross/lib/sys_random.in.h similarity index 100% rename from xcompile/lib/sys_random.in.h rename to cross/lib/sys_random.in.h diff --git a/xcompile/lib/sys_select.in.h b/cross/lib/sys_select.in.h similarity index 100% rename from xcompile/lib/sys_select.in.h rename to cross/lib/sys_select.in.h diff --git a/xcompile/lib/sys_stat.in.h b/cross/lib/sys_stat.in.h similarity index 100% rename from xcompile/lib/sys_stat.in.h rename to cross/lib/sys_stat.in.h diff --git a/xcompile/lib/sys_time.in.h b/cross/lib/sys_time.in.h similarity index 100% rename from xcompile/lib/sys_time.in.h rename to cross/lib/sys_time.in.h diff --git a/xcompile/lib/sys_types.in.h b/cross/lib/sys_types.in.h similarity index 100% rename from xcompile/lib/sys_types.in.h rename to cross/lib/sys_types.in.h diff --git a/xcompile/lib/tempname.c b/cross/lib/tempname.c similarity index 100% rename from xcompile/lib/tempname.c rename to cross/lib/tempname.c diff --git a/xcompile/lib/tempname.h b/cross/lib/tempname.h similarity index 100% rename from xcompile/lib/tempname.h rename to cross/lib/tempname.h diff --git a/xcompile/lib/time-internal.h b/cross/lib/time-internal.h similarity index 100% rename from xcompile/lib/time-internal.h rename to cross/lib/time-internal.h diff --git a/xcompile/lib/time.in.h b/cross/lib/time.in.h similarity index 100% rename from xcompile/lib/time.in.h rename to cross/lib/time.in.h diff --git a/xcompile/lib/time_r.c b/cross/lib/time_r.c similarity index 100% rename from xcompile/lib/time_r.c rename to cross/lib/time_r.c diff --git a/xcompile/lib/time_rz.c b/cross/lib/time_rz.c similarity index 100% rename from xcompile/lib/time_rz.c rename to cross/lib/time_rz.c diff --git a/xcompile/lib/timegm.c b/cross/lib/timegm.c similarity index 100% rename from xcompile/lib/timegm.c rename to cross/lib/timegm.c diff --git a/xcompile/lib/timespec-add.c b/cross/lib/timespec-add.c similarity index 100% rename from xcompile/lib/timespec-add.c rename to cross/lib/timespec-add.c diff --git a/xcompile/lib/timespec-sub.c b/cross/lib/timespec-sub.c similarity index 100% rename from xcompile/lib/timespec-sub.c rename to cross/lib/timespec-sub.c diff --git a/xcompile/lib/timespec.c b/cross/lib/timespec.c similarity index 100% rename from xcompile/lib/timespec.c rename to cross/lib/timespec.c diff --git a/xcompile/lib/timespec.h b/cross/lib/timespec.h similarity index 100% rename from xcompile/lib/timespec.h rename to cross/lib/timespec.h diff --git a/xcompile/lib/u64.c b/cross/lib/u64.c similarity index 100% rename from xcompile/lib/u64.c rename to cross/lib/u64.c diff --git a/xcompile/lib/u64.h b/cross/lib/u64.h similarity index 100% rename from xcompile/lib/u64.h rename to cross/lib/u64.h diff --git a/xcompile/lib/unistd.c b/cross/lib/unistd.c similarity index 100% rename from xcompile/lib/unistd.c rename to cross/lib/unistd.c diff --git a/xcompile/lib/unistd.in.h b/cross/lib/unistd.in.h similarity index 100% rename from xcompile/lib/unistd.in.h rename to cross/lib/unistd.in.h diff --git a/xcompile/lib/unlocked-io.h b/cross/lib/unlocked-io.h similarity index 100% rename from xcompile/lib/unlocked-io.h rename to cross/lib/unlocked-io.h diff --git a/xcompile/lib/utimens.c b/cross/lib/utimens.c similarity index 100% rename from xcompile/lib/utimens.c rename to cross/lib/utimens.c diff --git a/xcompile/lib/utimens.h b/cross/lib/utimens.h similarity index 100% rename from xcompile/lib/utimens.h rename to cross/lib/utimens.h diff --git a/xcompile/lib/utimensat.c b/cross/lib/utimensat.c similarity index 100% rename from xcompile/lib/utimensat.c rename to cross/lib/utimensat.c diff --git a/xcompile/lib/verify.h b/cross/lib/verify.h similarity index 100% rename from xcompile/lib/verify.h rename to cross/lib/verify.h diff --git a/xcompile/lib/vla.h b/cross/lib/vla.h similarity index 100% rename from xcompile/lib/vla.h rename to cross/lib/vla.h diff --git a/xcompile/lib/warn-on-use.h b/cross/lib/warn-on-use.h similarity index 100% rename from xcompile/lib/warn-on-use.h rename to cross/lib/warn-on-use.h diff --git a/xcompile/lib/xalloc-oversized.h b/cross/lib/xalloc-oversized.h similarity index 100% rename from xcompile/lib/xalloc-oversized.h rename to cross/lib/xalloc-oversized.h diff --git a/xcompile/Makefile.in b/xcompile/Makefile.in deleted file mode 100644 index ca3af4a9586..00000000000 --- a/xcompile/Makefile.in +++ /dev/null @@ -1,176 +0,0 @@ -### @configure_input@ - -# Copyright (C) 2023 Free Software Foundation, Inc. - -# This file is part of GNU Emacs. - -# GNU Emacs is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# GNU Emacs is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GNU Emacs. If not, see . - -top_srcdir = @top_srcdir@ -top_builddir = @top_builddir@ - -# Cross-compiling Emacs for Android. - -# The cross compiled binaries are built by having ``variant'' -# Makefiles generated at configure-time. First, -# $(top_builddir)/src/Makefile.android, -# $(top_builddir)/lib/Makefile.android, -# $(top_builddir)/lib/gnulib.mk.android and -# $(top_builddir)/lib-src/Makefile.android are copied to their usual -# locations in this directory. - -# Finally, the following commands are executed in order, to produce -# libgnu.a, various binaries in lib-src, and src/aemacs: -# make -C lib libgnu.a -# make -C lib-src src/aemacs -# make -C src aemacs - -# This is possibly the ugliest Makefile ever written! - -LIB_SRCDIR = $(realpath ./lib) -LIB_TOP_SRCDIR = $(realpath $(top_srcdir)) - -SRC_SRCDIR = $(realpath $(top_srcdir)/src) -SRC_TOP_SRCDIR = $(realpath $(top_srcdir)) - -LIB_SRC_SRCDIR = $(realpath $(top_srcdir)/lib-src) -LIB_SRC_TOP_SRCDIR = $(realpath $(top_src)) - -# This is a list of binaries to build and install in lib-src. - -LIBSRC_BINARIES = lib-src/etags lib-src/ctags lib-src/emacsclient \ - lib-src/ebrowse lib-src/hexl lib-src/movemail - -CLEAN_SUBDIRS=src lib-src - -.PHONY: all -all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES) - -# This Makefile relies on builddir and top_builddir being relative -# paths in *.android. - -# This file is used to trick lib/gnulib.mk, it is not actually useful. -config.status: - touch config.status - -src/verbose.mk: verbose.mk.android - mkdir -p src - cp -f verbose.mk.android src/verbose.mk - -# Gnulib, make-fingerprint and make-docfile must be built before -# entering any of the rules below, or they will get the Android -# versions of many headers. - -.PHONY: $(top_builddir)/lib/libgnu.a -$(top_builddir)/lib/libgnu.a: - + make -C $(top_builddir)/lib libgnu.a - -.PHONY: $(top_builddir)/lib-src/make-fingerprint -$(top_builddir)/lib-src/make-fingerprint: - make -C $(top_builddir)/lib-src make-fingerprint - -.PHONY: $(top_builddir)/lib-src/make-docfile -$(top_builddir)/lib-src/make-docfile: - make -C $(top_builddir)/lib-src make-docfile - -PRE_BUILD_DEPS=$(top_builddir)/lib/libgnu.a \ - $(top_builddir)/lib-src/make-fingerprint \ - $(top_builddir)/lib-src/make-docfile - -lib/config.h: $(top_builddir)/src/config.h.android - cp -f -p $(top_builddir)/src/config.h.android lib/config.h - -lib/gnulib.mk: $(top_builddir)/lib/gnulib.mk.android - cp -f -p $(top_builddir)/lib/gnulib.mk.android lib/gnulib.mk - sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \ - lib/gnulib.mk - -lib/Makefile: $(top_builddir)/lib/Makefile.android - cp -f -p $(top_builddir)/lib/Makefile.android lib/Makefile - sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \ - lib/Makefile - -# What is needed to build gnulib. -LIB_DEPS = lib/config.h lib/gnulib.mk lib/Makefile - -.PHONY: lib/libgnu.a -lib/libgnu.a: src/verbose.mk config.status $(LIB_DEPS) $(PRE_BUILD_DEPS) - mkdir -p lib/deps lib/deps/malloc - +make -C lib libgnu.a - -src/Makefile src/config.h &: $(top_builddir)/src/config.h.android \ - $(top_builddir)/src/Makefile.android - mkdir -p src src/deps -# Copy config.h to src/ - cp -f -p $(top_builddir)/src/config.h.android src/config.h -# And the Makefile. - cp -f -p $(top_builddir)/src/Makefile.android src/Makefile -# Next, edit srcdir and top_srcdir to the right location. - sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(SRC_SRCDIR))/g' src/Makefile - sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \ - src/Makefile -# Edit references to ../admin/unidata to read ../../admin/unidata. - sed -i 's/\.\.\/admin\/unidata/..\/..\/admin\/unidata/g' src/Makefile - sed -i 's/\.\.\/admin\/charsets/..\/..\/admin\/charsets/g' src/Makefile -# Next, edit libsrc to the location at top_srcdir! It is important -# that src/Makefile uses the binaries there, instead of any -# cross-compiled binaries at ./lib-src. - sed -i 's/libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' src/Makefile -# Edit out anything saying -I($(top_srcdir)/lib); that should be -# covered by -I$(lib) - sed -i 's/-I\$$(top_srcdir)\/lib//g' src/Makefile - -.PHONY: src/android-emacs src/libemacs.so -src/android-emacs src/libemacs.so &: src/Makefile src/config.h \ - src/verbose.mk lib/libgnu.a $(PRE_BUILD_DEPS) - +make -C src android-emacs libemacs.so - -lib-src/Makefile: $(top_builddir)/lib-src/Makefile.android - mkdir -p lib-src - cp -f -p $< $@ - sed -i 's/-I\$${srcdir}\/\.\.\/lib//g' lib-src/Makefile - -.PHONY: $(LIBSRC_BINARIES) -$(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \ - src/config.h lib-src/Makefile $(PRE_BUILD_DEPS) - mkdir -p src lib-src -# Next, edit srcdir and top_srcdir to the right location. - sed -i 's/srcdir=.*$$/srcdir = $(subst /,\/,$(LIB_SRC_SRCDIR))/g' \ - lib-src/Makefile - sed -i 's/top_srcdir=.*$$/top_srcdir = $(subst /,\/,$(LIB_SRC_TOP_SRCDIR))/g' \ - lib-src/Makefile -# Edit out SCRIPTS, it interferes with the build. - sed -i 's/^SCRIPTS=.*$$/SCRIPTS=/g' lib-src/Makefile -# Finally, go into lib-src and make everything being built - +make -C lib-src $(foreach bin,$(LIBSRC_BINARIES),$(notdir $(bin))) - -.PHONY: clean maintainer-clean distclean -clean: - rm -rf $(CLEAN_SUBDIRS) *.bak sys - if [ -e lib/Makefile ]; then \ - make -C lib clean; \ - fi - rm -rf lib/config.h - -distclean bootstrap-clean: clean - if [ -e lib/Makefile ]; then \ - make -C lib distclean; \ - fi -# Just in case. - rm -rf lib/Makefile lib/gnulib.mk - -maintainer-clean: distclean bootstrap-clean - if [ -e lib/Makefile ]; then \ - make -C lib maintainer-clean; \ - fi diff --git a/xcompile/README b/xcompile/README deleted file mode 100644 index d5282212b71..00000000000 --- a/xcompile/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory holds Makefiles and other required assets to build an -Emacs binary independently for another toolchain. It also holds -another copy of gnulib that may be modified to work on Android. diff --git a/xcompile/langinfo.h b/xcompile/langinfo.h deleted file mode 100644 index b296ba8db80..00000000000 --- a/xcompile/langinfo.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Replacement langinfo.h file for building GNU Emacs on Android. - -Copyright (C) 2023 Free Software Foundation, Inc. - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or (at -your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . */ - -#define nl_langinfo(ignore) "ASCII" diff --git a/xcompile/malloc/dynarray-skeleton.c b/xcompile/malloc/dynarray-skeleton.c deleted file mode 100644 index 580c278b7c5..00000000000 --- a/xcompile/malloc/dynarray-skeleton.c +++ /dev/null @@ -1,528 +0,0 @@ -/* Type-safe arrays which grow dynamically. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Pre-processor macros which act as parameters: - - DYNARRAY_STRUCT - The struct tag of dynamic array to be defined. - DYNARRAY_ELEMENT - The type name of the element type. Elements are copied - as if by memcpy, and can change address as the dynamic - array grows. - DYNARRAY_PREFIX - The prefix of the functions which are defined. - - The following parameters are optional: - - DYNARRAY_ELEMENT_FREE - DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the - contents of elements. E is of type DYNARRAY_ELEMENT *. - DYNARRAY_ELEMENT_INIT - DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new - element. E is of type DYNARRAY_ELEMENT *. - If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is - defined, new elements are automatically zero-initialized. - Otherwise, new elements have undefined contents. - DYNARRAY_INITIAL_SIZE - The size of the statically allocated array (default: - at least 2, more elements if they fit into 128 bytes). - Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0, - there is no statically allocated array at, and all non-empty - arrays are heap-allocated. - DYNARRAY_FINAL_TYPE - The name of the type which holds the final array. If not - defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE - must be a struct type, with members of type DYNARRAY_ELEMENT and - size_t at the start (in this order). - - These macros are undefined after this header file has been - included. - - The following types are provided (their members are private to the - dynarray implementation): - - struct DYNARRAY_STRUCT - - The following functions are provided: - - void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *); - void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *); - bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *); - void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *); - size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *); - DYNARRAY_ELEMENT *DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *); - DYNARRAY_ELEMENT *DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *); - DYNARRAY_ELEMENT *DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *, size_t); - void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *, DYNARRAY_ELEMENT); - DYNARRAY_ELEMENT *DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *); - bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *, size_t); - void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *); - void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *); - - The following functions are provided are provided if the - prerequisites are met: - - bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, - DYNARRAY_FINAL_TYPE *); - (if DYNARRAY_FINAL_TYPE is defined) - DYNARRAY_ELEMENT *DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, - size_t *); - (if DYNARRAY_FINAL_TYPE is not defined) -*/ - -#include - -#include -#include -#include - -#ifndef DYNARRAY_STRUCT -# error "DYNARRAY_STRUCT must be defined" -#endif - -#ifndef DYNARRAY_ELEMENT -# error "DYNARRAY_ELEMENT must be defined" -#endif - -#ifndef DYNARRAY_PREFIX -# error "DYNARRAY_PREFIX must be defined" -#endif - -#ifdef DYNARRAY_INITIAL_SIZE -# if DYNARRAY_INITIAL_SIZE < 0 -# error "DYNARRAY_INITIAL_SIZE must be non-negative" -# endif -# if DYNARRAY_INITIAL_SIZE > 0 -# define DYNARRAY_HAVE_SCRATCH 1 -# else -# define DYNARRAY_HAVE_SCRATCH 0 -# endif -#else -/* Provide a reasonable default which limits the size of - DYNARRAY_STRUCT. */ -# define DYNARRAY_INITIAL_SIZE \ - (sizeof (DYNARRAY_ELEMENT) > 64 ? 2 : 128 / sizeof (DYNARRAY_ELEMENT)) -# define DYNARRAY_HAVE_SCRATCH 1 -#endif - -/* Public type definitions. */ - -/* All fields of this struct are private to the implementation. */ -struct DYNARRAY_STRUCT -{ - union - { - struct dynarray_header dynarray_abstract; - struct - { - /* These fields must match struct dynarray_header. */ - size_t used; - size_t allocated; - DYNARRAY_ELEMENT *array; - } dynarray_header; - } u; - -#if DYNARRAY_HAVE_SCRATCH - /* Initial inline allocation. */ - DYNARRAY_ELEMENT scratch[DYNARRAY_INITIAL_SIZE]; -#endif -}; - -/* Internal use only: Helper macros. */ - -/* Ensure macro-expansion of DYNARRAY_PREFIX. */ -#define DYNARRAY_CONCAT0(prefix, name) prefix##name -#define DYNARRAY_CONCAT1(prefix, name) DYNARRAY_CONCAT0(prefix, name) -#define DYNARRAY_NAME(name) DYNARRAY_CONCAT1(DYNARRAY_PREFIX, name) - -/* Use DYNARRAY_FREE instead of DYNARRAY_NAME (free), - so that Gnulib does not change 'free' to 'rpl_free'. */ -#define DYNARRAY_FREE DYNARRAY_CONCAT1 (DYNARRAY_NAME (f), ree) - -/* Address of the scratch buffer if any. */ -#if DYNARRAY_HAVE_SCRATCH -# define DYNARRAY_SCRATCH(list) (list)->scratch -#else -# define DYNARRAY_SCRATCH(list) NULL -#endif - -/* Internal use only: Helper functions. */ - -/* Internal function. Call DYNARRAY_ELEMENT_FREE with the array - elements. Name mangling needed due to the DYNARRAY_ELEMENT_FREE - macro expansion. */ -static inline void -DYNARRAY_NAME (free__elements__) (DYNARRAY_ELEMENT *__dynarray_array, - size_t __dynarray_used) -{ -#ifdef DYNARRAY_ELEMENT_FREE - for (size_t __dynarray_i = 0; __dynarray_i < __dynarray_used; ++__dynarray_i) - DYNARRAY_ELEMENT_FREE (&__dynarray_array[__dynarray_i]); -#endif /* DYNARRAY_ELEMENT_FREE */ -} - -/* Internal function. Free the non-scratch array allocation. */ -static inline void -DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list) -{ -#if DYNARRAY_HAVE_SCRATCH - if (list->u.dynarray_header.array != list->scratch) - free (list->u.dynarray_header.array); -#else - free (list->u.dynarray_header.array); -#endif -} - -/* Public functions. */ - -/* Initialize a dynamic array object. This must be called before any - use of the object. */ -__attribute_nonnull__ ((1)) -static void -DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) -{ - list->u.dynarray_header.used = 0; - list->u.dynarray_header.allocated = DYNARRAY_INITIAL_SIZE; - list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); -} - -/* Deallocate the dynamic array and its elements. */ -__attribute_maybe_unused__ __attribute_nonnull__ ((1)) -static void -DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) -{ - DYNARRAY_NAME (free__elements__) - (list->u.dynarray_header.array, list->u.dynarray_header.used); - DYNARRAY_NAME (free__array__) (list); - DYNARRAY_NAME (init) (list); -} - -/* Return true if the dynamic array is in an error state. */ -__attribute_nonnull__ ((1)) -static inline bool -DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) -{ - return list->u.dynarray_header.allocated == __dynarray_error_marker (); -} - -/* Mark the dynamic array as failed. All elements are deallocated as - a side effect. */ -__attribute_nonnull__ ((1)) -static void -DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) -{ - DYNARRAY_NAME (free__elements__) - (list->u.dynarray_header.array, list->u.dynarray_header.used); - DYNARRAY_NAME (free__array__) (list); - list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); - list->u.dynarray_header.used = 0; - list->u.dynarray_header.allocated = __dynarray_error_marker (); -} - -/* Return the number of elements which have been added to the dynamic - array. */ -__attribute_nonnull__ ((1)) -static inline size_t -DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) -{ - return list->u.dynarray_header.used; -} - -/* Return a pointer to the array element at INDEX. Terminate the - process if INDEX is out of bounds. */ -__attribute_nonnull__ ((1)) -static inline DYNARRAY_ELEMENT * -DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) -{ - if (__glibc_unlikely (index >= DYNARRAY_NAME (size) (list))) - __libc_dynarray_at_failure (DYNARRAY_NAME (size) (list), index); - return list->u.dynarray_header.array + index; -} - -/* Return a pointer to the first array element, if any. For a - zero-length array, the pointer can be NULL even though the dynamic - array has not entered the failure state. */ -__attribute_nonnull__ ((1)) -static inline DYNARRAY_ELEMENT * -DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) -{ - return list->u.dynarray_header.array; -} - -/* Return a pointer one element past the last array element. For a - zero-length array, the pointer can be NULL even though the dynamic - array has not entered the failure state. */ -__attribute_nonnull__ ((1)) -static inline DYNARRAY_ELEMENT * -DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) -{ - return list->u.dynarray_header.array + list->u.dynarray_header.used; -} - -/* Internal function. Slow path for the add function below. */ -static void -DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) -{ - if (__glibc_unlikely - (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, - DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT)))) - { - DYNARRAY_NAME (mark_failed) (list); - return; - } - - /* Copy the new element and increase the array length. */ - list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; -} - -/* Add ITEM at the end of the array, enlarging it by one element. - Mark *LIST as failed if the dynamic array allocation size cannot be - increased. */ -__attribute_nonnull__ ((1)) -static inline void -DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) -{ - /* Do nothing in case of previous error. */ - if (DYNARRAY_NAME (has_failed) (list)) - return; - - /* Enlarge the array if necessary. */ - if (__glibc_unlikely (list->u.dynarray_header.used - == list->u.dynarray_header.allocated)) - { - DYNARRAY_NAME (add__) (list, item); - return; - } - - /* Copy the new element and increase the array length. */ - list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; -} - -/* Internal function. Building block for the emplace functions below. - Assumes space for one more element in *LIST. */ -static inline DYNARRAY_ELEMENT * -DYNARRAY_NAME (emplace__tail__) (struct DYNARRAY_STRUCT *list) -{ - DYNARRAY_ELEMENT *result - = &list->u.dynarray_header.array[list->u.dynarray_header.used]; - ++list->u.dynarray_header.used; -#if defined (DYNARRAY_ELEMENT_INIT) - DYNARRAY_ELEMENT_INIT (result); -#elif defined (DYNARRAY_ELEMENT_FREE) - memset (result, 0, sizeof (*result)); -#endif - return result; -} - -/* Internal function. Slow path for the emplace function below. */ -static DYNARRAY_ELEMENT * -DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list) -{ - if (__glibc_unlikely - (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, - DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT)))) - { - DYNARRAY_NAME (mark_failed) (list); - return NULL; - } - return DYNARRAY_NAME (emplace__tail__) (list); -} - -/* Allocate a place for a new element in *LIST and return a pointer to - it. The pointer can be NULL if the dynamic array cannot be - enlarged due to a memory allocation failure. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ -__attribute_nonnull__ ((1)) -static -/* Avoid inlining with the larger initialization code. */ -#if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) -inline -#endif -DYNARRAY_ELEMENT * -DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list) -{ - /* Do nothing in case of previous error. */ - if (DYNARRAY_NAME (has_failed) (list)) - return NULL; - - /* Enlarge the array if necessary. */ - if (__glibc_unlikely (list->u.dynarray_header.used - == list->u.dynarray_header.allocated)) - return (DYNARRAY_NAME (emplace__) (list)); - return DYNARRAY_NAME (emplace__tail__) (list); -} - -/* Change the size of *LIST to SIZE. If SIZE is larger than the - existing size, new elements are added (which can be initialized). - Otherwise, the list is truncated, and elements are freed. Return - false on memory allocation failure (and mark *LIST as failed). */ -__attribute_maybe_unused__ __attribute_nonnull__ ((1)) -static bool -DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) -{ - if (size > list->u.dynarray_header.used) - { - bool ok; -#if defined (DYNARRAY_ELEMENT_INIT) - /* The new elements have to be initialized. */ - size_t old_size = list->u.dynarray_header.used; - ok = __libc_dynarray_resize (&list->u.dynarray_abstract, - size, DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT)); - if (ok) - for (size_t i = old_size; i < size; ++i) - { - DYNARRAY_ELEMENT_INIT (&list->u.dynarray_header.array[i]); - } -#elif defined (DYNARRAY_ELEMENT_FREE) - /* Zero initialization is needed so that the elements can be - safely freed. */ - ok = __libc_dynarray_resize_clear - (&list->u.dynarray_abstract, size, - DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)); -#else - ok = __libc_dynarray_resize (&list->u.dynarray_abstract, - size, DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT)); -#endif - if (__glibc_unlikely (!ok)) - DYNARRAY_NAME (mark_failed) (list); - return ok; - } - else - { - /* The list has shrunk in size. Free the removed elements. */ - DYNARRAY_NAME (free__elements__) - (list->u.dynarray_header.array + size, - list->u.dynarray_header.used - size); - list->u.dynarray_header.used = size; - return true; - } -} - -/* Remove the last element of LIST if it is present. */ -__attribute_maybe_unused__ __attribute_nonnull__ ((1)) -static void -DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) -{ - /* used > 0 implies that the array is the non-failed state. */ - if (list->u.dynarray_header.used > 0) - { - size_t new_length = list->u.dynarray_header.used - 1; -#ifdef DYNARRAY_ELEMENT_FREE - DYNARRAY_ELEMENT_FREE (&list->u.dynarray_header.array[new_length]); -#endif - list->u.dynarray_header.used = new_length; - } -} - -/* Remove all elements from the list. The elements are freed, but the - list itself is not. */ -__attribute_maybe_unused__ __attribute_nonnull__ ((1)) -static void -DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) -{ - /* free__elements__ does nothing if the list is in the failed - state. */ - DYNARRAY_NAME (free__elements__) - (list->u.dynarray_header.array, list->u.dynarray_header.used); - list->u.dynarray_header.used = 0; -} - -#ifdef DYNARRAY_FINAL_TYPE -/* Transfer the dynamic array to a permanent location at *RESULT. - Returns true on success on false on allocation failure. In either - case, *LIST is re-initialized and can be reused. A NULL pointer is - stored in *RESULT if LIST refers to an empty list. On success, the - pointer in *RESULT is heap-allocated and must be deallocated using - free. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ -__attribute_nonnull__ ((1, 2)) -static bool -DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, - DYNARRAY_FINAL_TYPE *result) -{ - struct dynarray_finalize_result res; - if (__libc_dynarray_finalize (&list->u.dynarray_abstract, - DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT), &res)) - { - /* On success, the result owns all the data. */ - DYNARRAY_NAME (init) (list); - *result = (DYNARRAY_FINAL_TYPE) { res.array, res.length }; - return true; - } - else - { - /* On error, we need to free all data. */ - DYNARRAY_FREE (list); - errno = ENOMEM; - return false; - } -} -#else /* !DYNARRAY_FINAL_TYPE */ -/* Transfer the dynamic array to a heap-allocated array and return a - pointer to it. The pointer is NULL if memory allocation fails, or - if the array is empty, so this function should be used only for - arrays which are known not be empty (usually because they always - have a sentinel at the end). If LENGTHP is not NULL, the array - length is written to *LENGTHP. *LIST is re-initialized and can be - reused. */ -__attribute_maybe_unused__ __attribute_warn_unused_result__ -__attribute_nonnull__ ((1)) -static DYNARRAY_ELEMENT * -DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) -{ - struct dynarray_finalize_result res; - if (__libc_dynarray_finalize (&list->u.dynarray_abstract, - DYNARRAY_SCRATCH (list), - sizeof (DYNARRAY_ELEMENT), &res)) - { - /* On success, the result owns all the data. */ - DYNARRAY_NAME (init) (list); - if (lengthp != NULL) - *lengthp = res.length; - return res.array; - } - else - { - /* On error, we need to free all data. */ - DYNARRAY_FREE (list); - errno = ENOMEM; - return NULL; - } -} -#endif /* !DYNARRAY_FINAL_TYPE */ - -/* Undo macro definitions. */ - -#undef DYNARRAY_CONCAT0 -#undef DYNARRAY_CONCAT1 -#undef DYNARRAY_NAME -#undef DYNARRAY_SCRATCH -#undef DYNARRAY_HAVE_SCRATCH - -#undef DYNARRAY_STRUCT -#undef DYNARRAY_ELEMENT -#undef DYNARRAY_PREFIX -#undef DYNARRAY_ELEMENT_FREE -#undef DYNARRAY_ELEMENT_INIT -#undef DYNARRAY_INITIAL_SIZE -#undef DYNARRAY_FINAL_TYPE diff --git a/xcompile/malloc/dynarray.h b/xcompile/malloc/dynarray.h deleted file mode 100644 index a9a3b0859c1..00000000000 --- a/xcompile/malloc/dynarray.h +++ /dev/null @@ -1,177 +0,0 @@ -/* Type-safe arrays which grow dynamically. Shared definitions. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* To use the dynarray facility, you need to include - and define the parameter macros - documented in that file. - - A minimal example which provides a growing list of integers can be - defined like this: - - struct int_array - { - // Pointer to result array followed by its length, - // as required by DYNARRAY_FINAL_TYPE. - int *array; - size_t length; - }; - - #define DYNARRAY_STRUCT dynarray_int - #define DYNARRAY_ELEMENT int - #define DYNARRAY_PREFIX dynarray_int_ - #define DYNARRAY_FINAL_TYPE struct int_array - #include - - To create a three-element array with elements 1, 2, 3, use this - code: - - struct dynarray_int dyn; - dynarray_int_init (&dyn); - for (int i = 1; i <= 3; ++i) - { - int *place = dynarray_int_emplace (&dyn); - assert (place != NULL); - *place = i; - } - struct int_array result; - bool ok = dynarray_int_finalize (&dyn, &result); - assert (ok); - assert (result.length == 3); - assert (result.array[0] == 1); - assert (result.array[1] == 2); - assert (result.array[2] == 3); - free (result.array); - - If the elements contain resources which must be freed, define - DYNARRAY_ELEMENT_FREE appropriately, like this: - - struct str_array - { - char **array; - size_t length; - }; - - #define DYNARRAY_STRUCT dynarray_str - #define DYNARRAY_ELEMENT char * - #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr) - #define DYNARRAY_PREFIX dynarray_str_ - #define DYNARRAY_FINAL_TYPE struct str_array - #include - - Compared to scratch buffers, dynamic arrays have the following - features: - - - They have an element type, and are not just an untyped buffer of - bytes. - - - When growing, previously stored elements are preserved. (It is - expected that scratch_buffer_grow_preserve and - scratch_buffer_set_array_size eventually go away because all - current users are moved to dynamic arrays.) - - - Scratch buffers have a more aggressive growth policy because - growing them typically means a retry of an operation (across an - NSS service module boundary), which is expensive. - - - For the same reason, scratch buffers have a much larger initial - stack allocation. */ - -#ifndef _DYNARRAY_H -#define _DYNARRAY_H - -#include -#include - -struct dynarray_header -{ - size_t used; - size_t allocated; - void *array; -}; - -/* Marker used in the allocated member to indicate that an error was - encountered. */ -static inline size_t -__dynarray_error_marker (void) -{ - return -1; -} - -/* Internal function. See the has_failed function in - dynarray-skeleton.c. */ -static inline bool -__dynarray_error (struct dynarray_header *list) -{ - return list->allocated == __dynarray_error_marker (); -} - -/* Internal function. Enlarge the dynamically allocated area of the - array to make room for one more element. SCRATCH is a pointer to - the scratch area (which is not heap-allocated and must not be - freed). ELEMENT_SIZE is the size, in bytes, of one element. - Return false on failure, true on success. */ -bool __libc_dynarray_emplace_enlarge (struct dynarray_header *, - void *scratch, size_t element_size); - -/* Internal function. Enlarge the dynamically allocated area of the - array to make room for at least SIZE elements (which must be larger - than the existing used part of the dynamic array). SCRATCH is a - pointer to the scratch area (which is not heap-allocated and must - not be freed). ELEMENT_SIZE is the size, in bytes, of one element. - Return false on failure, true on success. */ -bool __libc_dynarray_resize (struct dynarray_header *, size_t size, - void *scratch, size_t element_size); - -/* Internal function. Like __libc_dynarray_resize, but clear the new - part of the dynamic array. */ -bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size, - void *scratch, size_t element_size); - -/* Internal type. */ -struct dynarray_finalize_result -{ - void *array; - size_t length; -}; - -/* Internal function. Copy the dynamically-allocated area to an - explicitly-sized heap allocation. SCRATCH is a pointer to the - embedded scratch space. ELEMENT_SIZE is the size, in bytes, of the - element type. On success, true is returned, and pointer and length - are written to *RESULT. On failure, false is returned. The caller - has to take care of some of the memory management; this function is - expected to be called from dynarray-skeleton.c. */ -bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch, - size_t element_size, - struct dynarray_finalize_result *result); - - -/* Internal function. Terminate the process after an index error. - SIZE is the number of elements of the dynamic array. INDEX is the - lookup index which triggered the failure. */ -_Noreturn void __libc_dynarray_at_failure (size_t size, size_t index); - -#ifndef _ISOMAC -libc_hidden_proto (__libc_dynarray_emplace_enlarge) -libc_hidden_proto (__libc_dynarray_resize) -libc_hidden_proto (__libc_dynarray_resize_clear) -libc_hidden_proto (__libc_dynarray_finalize) -libc_hidden_proto (__libc_dynarray_at_failure) -#endif - -#endif /* _DYNARRAY_H */ diff --git a/xcompile/malloc/dynarray_at_failure.c b/xcompile/malloc/dynarray_at_failure.c deleted file mode 100644 index ebc9310982c..00000000000 --- a/xcompile/malloc/dynarray_at_failure.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Report an dynamic array index out of bounds condition. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -# include -#endif - -#include -#include - -void -__libc_dynarray_at_failure (size_t size, size_t index) -{ -#ifdef _LIBC - char buf[200]; - __snprintf (buf, sizeof (buf), "Fatal glibc error: " - "array index %zu not less than array length %zu\n", - index, size); - __libc_fatal (buf); -#else - abort (); -#endif -} -libc_hidden_def (__libc_dynarray_at_failure) diff --git a/xcompile/malloc/dynarray_emplace_enlarge.c b/xcompile/malloc/dynarray_emplace_enlarge.c deleted file mode 100644 index 7da539316c1..00000000000 --- a/xcompile/malloc/dynarray_emplace_enlarge.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Increase the size of a dynamic array in preparation of an emplace operation. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include -#include -#include -#include - -bool -__libc_dynarray_emplace_enlarge (struct dynarray_header *list, - void *scratch, size_t element_size) -{ - size_t new_allocated; - if (list->allocated == 0) - { - /* No scratch buffer provided. Choose a reasonable default - size. */ - if (element_size < 4) - new_allocated = 16; - else if (element_size < 8) - new_allocated = 8; - else - new_allocated = 4; - } - else - /* Increase the allocated size, using an exponential growth - policy. */ - { - new_allocated = list->allocated + list->allocated / 2 + 1; - if (new_allocated <= list->allocated) - { - /* Overflow. */ - __set_errno (ENOMEM); - return false; - } - } - - size_t new_size; - if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size)) - return false; - void *new_array; - if (list->array == scratch) - { - /* The previous array was not heap-allocated. */ - new_array = malloc (new_size); - if (new_array != NULL && list->array != NULL) - memcpy (new_array, list->array, list->used * element_size); - } - else - new_array = realloc (list->array, new_size); - if (new_array == NULL) - return false; - list->array = new_array; - list->allocated = new_allocated; - return true; -} -libc_hidden_def (__libc_dynarray_emplace_enlarge) diff --git a/xcompile/malloc/dynarray_finalize.c b/xcompile/malloc/dynarray_finalize.c deleted file mode 100644 index 673595a5fad..00000000000 --- a/xcompile/malloc/dynarray_finalize.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copy the dynamically-allocated area to an explicitly-sized heap allocation. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include -#include - -bool -__libc_dynarray_finalize (struct dynarray_header *list, - void *scratch, size_t element_size, - struct dynarray_finalize_result *result) -{ - if (__dynarray_error (list)) - /* The caller will reported the deferred error. */ - return false; - - size_t used = list->used; - - /* Empty list. */ - if (used == 0) - { - /* An empty list could still be backed by a heap-allocated - array. Free it if necessary. */ - if (list->array != scratch) - free (list->array); - *result = (struct dynarray_finalize_result) { NULL, 0 }; - return true; - } - - size_t allocation_size = used * element_size; - void *heap_array = malloc (allocation_size); - if (heap_array != NULL) - { - /* The new array takes ownership of the strings. */ - if (list->array != NULL) - memcpy (heap_array, list->array, allocation_size); - if (list->array != scratch) - free (list->array); - *result = (struct dynarray_finalize_result) - { .array = heap_array, .length = used }; - return true; - } - else - /* The caller will perform the freeing operation. */ - return false; -} -libc_hidden_def (__libc_dynarray_finalize) diff --git a/xcompile/malloc/dynarray_resize.c b/xcompile/malloc/dynarray_resize.c deleted file mode 100644 index 7ecd4de63b9..00000000000 --- a/xcompile/malloc/dynarray_resize.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Increase the size of a dynamic array. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include -#include -#include -#include - -bool -__libc_dynarray_resize (struct dynarray_header *list, size_t size, - void *scratch, size_t element_size) -{ - /* The existing allocation provides sufficient room. */ - if (size <= list->allocated) - { - list->used = size; - return true; - } - - /* Otherwise, use size as the new allocation size. The caller is - expected to provide the final size of the array, so there is no - over-allocation here. */ - - size_t new_size_bytes; - if (INT_MULTIPLY_WRAPV (size, element_size, &new_size_bytes)) - { - /* Overflow. */ - __set_errno (ENOMEM); - return false; - } - void *new_array; - if (list->array == scratch) - { - /* The previous array was not heap-allocated. */ - new_array = malloc (new_size_bytes); - if (new_array != NULL && list->array != NULL) - memcpy (new_array, list->array, list->used * element_size); - } - else - new_array = realloc (list->array, new_size_bytes); - if (new_array == NULL) - return false; - list->array = new_array; - list->allocated = size; - list->used = size; - return true; -} -libc_hidden_def (__libc_dynarray_resize) diff --git a/xcompile/malloc/dynarray_resize_clear.c b/xcompile/malloc/dynarray_resize_clear.c deleted file mode 100644 index bb23c522a14..00000000000 --- a/xcompile/malloc/dynarray_resize_clear.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Increase the size of a dynamic array and clear the new part. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -bool -__libc_dynarray_resize_clear (struct dynarray_header *list, size_t size, - void *scratch, size_t element_size) -{ - size_t old_size = list->used; - if (!__libc_dynarray_resize (list, size, scratch, element_size)) - return false; - /* __libc_dynarray_resize already checked for overflow. */ - char *array = list->array; - memset (array + (old_size * element_size), 0, - (size - old_size) * element_size); - return true; -} -libc_hidden_def (__libc_dynarray_resize_clear) diff --git a/xcompile/malloc/scratch_buffer.h b/xcompile/malloc/scratch_buffer.h deleted file mode 100644 index 33fd2b29cd5..00000000000 --- a/xcompile/malloc/scratch_buffer.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2015-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SCRATCH_BUFFER_H -#define _SCRATCH_BUFFER_H - -/* Scratch buffers with a default stack allocation and fallback to - heap allocation. It is expected that this function is used in this - way: - - struct scratch_buffer tmpbuf; - scratch_buffer_init (&tmpbuf); - - while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) - if (!scratch_buffer_grow (&tmpbuf)) - return -1; - - scratch_buffer_free (&tmpbuf); - return 0; - - The allocation functions (scratch_buffer_grow, - scratch_buffer_grow_preserve, scratch_buffer_set_array_size) make - sure that the heap allocation, if any, is freed, so that the code - above does not have a memory leak. The buffer still remains in a - state that can be deallocated using scratch_buffer_free, so a loop - like this is valid as well: - - struct scratch_buffer tmpbuf; - scratch_buffer_init (&tmpbuf); - - while (!function_that_uses_buffer (tmpbuf.data, tmpbuf.length)) - if (!scratch_buffer_grow (&tmpbuf)) - break; - - scratch_buffer_free (&tmpbuf); - - scratch_buffer_grow and scratch_buffer_grow_preserve are guaranteed - to grow the buffer by at least 512 bytes. This means that when - using the scratch buffer as a backing store for a non-character - array whose element size, in bytes, is 512 or smaller, the scratch - buffer only has to grow once to make room for at least one more - element. -*/ - -#include -#include -#include - -/* Scratch buffer. Must be initialized with scratch_buffer_init - before its use. */ -struct scratch_buffer { - void *data; /* Pointer to the beginning of the scratch area. */ - size_t length; /* Allocated space at the data pointer, in bytes. */ - union { max_align_t __align; char __c[1024]; } __space; -}; - -/* Initializes *BUFFER so that BUFFER->data points to BUFFER->__space - and BUFFER->length reflects the available space. */ -static inline void -scratch_buffer_init (struct scratch_buffer *buffer) -{ - buffer->data = buffer->__space.__c; - buffer->length = sizeof (buffer->__space); -} - -/* Deallocates *BUFFER (if it was heap-allocated). */ -static inline void -scratch_buffer_free (struct scratch_buffer *buffer) -{ - if (buffer->data != buffer->__space.__c) - free (buffer->data); -} - -/* Grow *BUFFER by some arbitrary amount. The buffer contents is NOT - preserved. Return true on success, false on allocation failure (in - which case the old buffer is freed). On success, the new buffer is - larger than the previous size. On failure, *BUFFER is deallocated, - but remains in a free-able state, and errno is set. */ -bool __libc_scratch_buffer_grow (struct scratch_buffer *buffer); -libc_hidden_proto (__libc_scratch_buffer_grow) - -/* Alias for __libc_scratch_buffer_grow. */ -static __always_inline bool -scratch_buffer_grow (struct scratch_buffer *buffer) -{ - return __glibc_likely (__libc_scratch_buffer_grow (buffer)); -} - -/* Like __libc_scratch_buffer_grow, but preserve the old buffer - contents on success, as a prefix of the new buffer. */ -bool __libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer); -libc_hidden_proto (__libc_scratch_buffer_grow_preserve) - -/* Alias for __libc_scratch_buffer_grow_preserve. */ -static __always_inline bool -scratch_buffer_grow_preserve (struct scratch_buffer *buffer) -{ - return __glibc_likely (__libc_scratch_buffer_grow_preserve (buffer)); -} - -/* Grow *BUFFER so that it can store at least NELEM elements of SIZE - bytes. The buffer contents are NOT preserved. Both NELEM and SIZE - can be zero. Return true on success, false on allocation failure - (in which case the old buffer is freed, but *BUFFER remains in a - free-able state, and errno is set). It is unspecified whether this - function can reduce the array size. */ -bool __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer, - size_t nelem, size_t size); -libc_hidden_proto (__libc_scratch_buffer_set_array_size) - -/* Alias for __libc_scratch_set_array_size. */ -static __always_inline bool -scratch_buffer_set_array_size (struct scratch_buffer *buffer, - size_t nelem, size_t size) -{ - return __glibc_likely (__libc_scratch_buffer_set_array_size - (buffer, nelem, size)); -} - -#endif /* _SCRATCH_BUFFER_H */ diff --git a/xcompile/malloc/scratch_buffer_dupfree.c b/xcompile/malloc/scratch_buffer_dupfree.c deleted file mode 100644 index 2f60fbb54e8..00000000000 --- a/xcompile/malloc/scratch_buffer_dupfree.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2020-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -void * -__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *data = buffer->data; - if (data == buffer->__space.__c) - { - void *copy = malloc (size); - return copy != NULL ? memcpy (copy, data, size) : NULL; - } - else - { - void *copy = realloc (data, size); - return copy != NULL ? copy : data; - } -} -libc_hidden_def (__libc_scratch_buffer_dupfree) diff --git a/xcompile/malloc/scratch_buffer_grow.c b/xcompile/malloc/scratch_buffer_grow.c deleted file mode 100644 index a5e8f2f7230..00000000000 --- a/xcompile/malloc/scratch_buffer_grow.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2015-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -bool -__libc_scratch_buffer_grow (struct scratch_buffer *buffer) -{ - void *new_ptr; - size_t new_length = buffer->length * 2; - - /* Discard old buffer. */ - scratch_buffer_free (buffer); - - /* Check for overflow. */ - if (__glibc_likely (new_length >= buffer->length)) - new_ptr = malloc (new_length); - else - { - __set_errno (ENOMEM); - new_ptr = NULL; - } - - if (__glibc_unlikely (new_ptr == NULL)) - { - /* Buffer must remain valid to free. */ - scratch_buffer_init (buffer); - return false; - } - - /* Install new heap-based buffer. */ - buffer->data = new_ptr; - buffer->length = new_length; - return true; -} -libc_hidden_def (__libc_scratch_buffer_grow) diff --git a/xcompile/malloc/scratch_buffer_grow_preserve.c b/xcompile/malloc/scratch_buffer_grow_preserve.c deleted file mode 100644 index c0b5d87b7e4..00000000000 --- a/xcompile/malloc/scratch_buffer_grow_preserve.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2015-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include -#include - -bool -__libc_scratch_buffer_grow_preserve (struct scratch_buffer *buffer) -{ - size_t new_length = 2 * buffer->length; - void *new_ptr; - - if (buffer->data == buffer->__space.__c) - { - /* Move buffer to the heap. No overflow is possible because - buffer->length describes a small buffer on the stack. */ - new_ptr = malloc (new_length); - if (new_ptr == NULL) - return false; - memcpy (new_ptr, buffer->__space.__c, buffer->length); - } - else - { - /* Buffer was already on the heap. Check for overflow. */ - if (__glibc_likely (new_length >= buffer->length)) - new_ptr = realloc (buffer->data, new_length); - else - { - __set_errno (ENOMEM); - new_ptr = NULL; - } - - if (__glibc_unlikely (new_ptr == NULL)) - { - /* Deallocate, but buffer must remain valid to free. */ - free (buffer->data); - scratch_buffer_init (buffer); - return false; - } - } - - /* Install new heap-based buffer. */ - buffer->data = new_ptr; - buffer->length = new_length; - return true; -} -libc_hidden_def (__libc_scratch_buffer_grow_preserve) diff --git a/xcompile/malloc/scratch_buffer_set_array_size.c b/xcompile/malloc/scratch_buffer_set_array_size.c deleted file mode 100644 index 24c39350ade..00000000000 --- a/xcompile/malloc/scratch_buffer_set_array_size.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2015-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include -#include - -bool -__libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer, - size_t nelem, size_t size) -{ - size_t new_length = nelem * size; - - /* Avoid overflow check if both values are small. */ - if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0 - && nelem != 0 && size != new_length / nelem) - { - /* Overflow. Discard the old buffer, but it must remain valid - to free. */ - scratch_buffer_free (buffer); - scratch_buffer_init (buffer); - __set_errno (ENOMEM); - return false; - } - - if (new_length <= buffer->length) - return true; - - /* Discard old buffer. */ - scratch_buffer_free (buffer); - - char *new_ptr = malloc (new_length); - if (new_ptr == NULL) - { - /* Buffer must remain valid to free. */ - scratch_buffer_init (buffer); - return false; - } - - /* Install new heap-based buffer. */ - buffer->data = new_ptr; - buffer->length = new_length; - return true; -} -libc_hidden_def (__libc_scratch_buffer_set_array_size) diff --git a/xcompile/verbose.mk.android b/xcompile/verbose.mk.android deleted file mode 100644 index 7d07b978de2..00000000000 --- a/xcompile/verbose.mk.android +++ /dev/null @@ -1,65 +0,0 @@ -### verbose.mk --- Makefile fragment for GNU Emacs during -### cross-compilation. - -## Copyright (C) 2023 Free Software Foundation, Inc. - -## This file is part of GNU Emacs. - -## GNU Emacs is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## GNU Emacs is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with GNU Emacs. If not, see . - -# 'make' verbosity. -V = 0 -ifeq (${V},1) -AM_V_AR = -AM_V_at = -AM_V_CC = -AM_V_CXX = -AM_V_CCLD = -AM_V_CXXLD = -AM_V_ELC = -AM_V_ELN = -AM_V_GEN = -AM_V_GLOBALS = -AM_V_NO_PD = -AM_V_RC = -AM_V_JAVAC = -AM_V_DX = -AM_V_AAPT = -AM_V_ZIPALIGN = -else - -# Whether $(info ...) works. This is to work around a bug in GNU Make -# 4.3 and earlier, which implements $(info MSG) via two system calls -# { write (..., "MSG", 3); write (..., "\n", 1); } -# which looks bad when make -j interleaves two of these at about the same time. -# -# Later versions of GNU Make have the 'notintermediate' feature, -# so assume that $(info ...) works if this feature is present. -# -have_working_info = $(filter notintermediate,$(value .FEATURES)) -# -# The workaround is to use the shell and 'echo' rather than $(info ...). -# The workaround is done only for AM_V_ELC and AM_V_ELN, -# since the bug is not annoying elsewhere. - -AM_V_AR = @$(info $ AR $@) -AM_V_at = @ -AM_V_CC = @$(info $ ANDROID_CC $@) -AM_V_CXX = @$(info $ ANDROID_CXX $@) -AM_V_CCLD = @$(info $ CCLD $@) -AM_V_CXXLD = @$(info $ CXXLD $@) - -AM_V_GEN = @$(info $ GEN $@) -AM_V_NO_PD = --no-print-directory -endif -- 2.39.5