summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Lemmer-Webber <cwebber@dustycloud.org>2021-10-10 20:59:04 -0400
committerChristine Lemmer-Webber <cwebber@dustycloud.org>2021-10-10 20:59:04 -0400
commit204cb986469b2751a3c3347a34a8013c1a0b6954 (patch)
treee91534db67add400e5213ec3becb6ab48544b470
parentb03b359b5b16c040c485a565f3ce92481ea43f41 (diff)
parente60469c8b6936575c079faaffa40a340e1d49f3c (diff)
downloadguile-204cb986469b2751a3c3347a34a8013c1a0b6954.tar.gz
Merge branch 'main' into compile-to-js-merge
-rw-r--r--am/bootstrap.am2
-rwxr-xr-xbuild-aux/announce-gen49
-rwxr-xr-xbuild-aux/gendocs.sh6
-rwxr-xr-xbuild-aux/git-version-gen8
-rwxr-xr-xbuild-aux/gnupload17
-rwxr-xr-xbuild-aux/useless-if-before-free18
-rw-r--r--doc/ref/api-data.texi136
-rw-r--r--doc/ref/api-procedures.texi4
-rw-r--r--doc/ref/srfi-modules.texi8
-rw-r--r--doc/ref/sxml.texi4
-rw-r--r--guile-readline/readline.c22
-rw-r--r--lib/Makefile.am986
-rw-r--r--lib/_Noreturn.h2
-rw-r--r--lib/accept.c10
-rw-r--r--lib/accept4.c14
-rw-r--r--lib/alignof.h12
-rw-r--r--lib/alloca.c4
-rw-r--r--lib/alloca.in.h20
-rw-r--r--lib/arpa_inet.in.h12
-rw-r--r--lib/asnprintf.c14
-rw-r--r--lib/assure.h10
-rw-r--r--lib/attribute.h16
-rw-r--r--lib/basename-lgpl.c10
-rw-r--r--lib/basename-lgpl.h26
-rw-r--r--lib/binary-io.c10
-rw-r--r--lib/binary-io.h10
-rw-r--r--lib/bind.c10
-rw-r--r--lib/btowc.c10
-rw-r--r--lib/byteswap.in.h10
-rw-r--r--lib/c-ctype.c18
-rw-r--r--lib/c-ctype.h24
-rw-r--r--lib/c-strcase.h12
-rw-r--r--lib/c-strcasecmp.c12
-rw-r--r--lib/c-strcaseeq.h14
-rw-r--r--lib/c-strncasecmp.c12
-rw-r--r--lib/canonicalize-lgpl.c3
-rw-r--r--lib/cdefs.h43
-rw-r--r--lib/ceil.c10
-rw-r--r--lib/cloexec.c14
-rw-r--r--lib/cloexec.h14
-rw-r--r--lib/close.c10
-rw-r--r--lib/connect.c10
-rw-r--r--lib/copysign.c10
-rw-r--r--lib/dirent.in.h111
-rw-r--r--lib/dirfd.c10
-rw-r--r--lib/dirname-lgpl.c10
-rw-r--r--lib/dirname.h39
-rw-r--r--lib/dup2.c10
-rw-r--r--lib/duplocale.c10
-rw-r--r--lib/dynarray.h20
-rw-r--r--lib/errno.in.h12
-rw-r--r--lib/fcntl.c10
-rw-r--r--lib/fcntl.in.h10
-rw-r--r--lib/fd-hook.c14
-rw-r--r--lib/fd-hook.h14
-rw-r--r--lib/float+.h12
-rw-r--r--lib/float.c10
-rw-r--r--lib/float.in.h10
-rw-r--r--lib/floor.c10
-rw-r--r--lib/free.c10
-rw-r--r--lib/frexp.c10
-rw-r--r--lib/fstat.c10
-rw-r--r--lib/fsync.c14
-rw-r--r--lib/full-read.c10
-rw-r--r--lib/full-read.h10
-rw-r--r--lib/full-write.c10
-rw-r--r--lib/full-write.h10
-rw-r--r--lib/gai_strerror.c12
-rw-r--r--lib/getaddrinfo.c12
-rw-r--r--lib/getdtablesize.c10
-rw-r--r--lib/getlogin.c10
-rw-r--r--lib/getpeername.c10
-rw-r--r--lib/getrandom.c16
-rw-r--r--lib/getsockname.c10
-rw-r--r--lib/getsockopt.c10
-rw-r--r--lib/gettext.h14
-rw-r--r--lib/hard-locale.c10
-rw-r--r--lib/hard-locale.h10
-rw-r--r--lib/iconv.c14
-rw-r--r--lib/iconv.in.h12
-rw-r--r--lib/iconv_close.c14
-rw-r--r--lib/iconv_open-aix.gperf14
-rw-r--r--lib/iconv_open-hpux.gperf14
-rw-r--r--lib/iconv_open-irix.gperf14
-rw-r--r--lib/iconv_open-osf.gperf14
-rw-r--r--lib/iconv_open-solaris.gperf14
-rw-r--r--lib/iconv_open-zos.gperf14
-rw-r--r--lib/iconv_open.c14
-rw-r--r--lib/iconveh.h10
-rw-r--r--lib/inet_ntop.c12
-rw-r--r--lib/inet_pton.c10
-rw-r--r--lib/inttypes.in.h10
-rw-r--r--lib/isfinite.c14
-rw-r--r--lib/isinf.c14
-rw-r--r--lib/isnan.c10
-rw-r--r--lib/isnand-nolibm.h10
-rw-r--r--lib/isnand.c10
-rw-r--r--lib/isnanf-nolibm.h10
-rw-r--r--lib/isnanf.c10
-rw-r--r--lib/isnanl-nolibm.h10
-rw-r--r--lib/isnanl.c10
-rw-r--r--lib/itold.c10
-rw-r--r--lib/langinfo.in.h12
-rw-r--r--lib/lc-charset-dispatch.c10
-rw-r--r--lib/lc-charset-dispatch.h10
-rw-r--r--lib/libc-config.h20
-rw-r--r--lib/libunistring.valgrind22
-rw-r--r--lib/limits.in.h28
-rw-r--r--lib/link.c12
-rw-r--r--lib/listen.c10
-rw-r--r--lib/localcharset.c14
-rw-r--r--lib/localcharset.h14
-rw-r--r--lib/locale.in.h10
-rw-r--r--lib/localeconv.c10
-rw-r--r--lib/log.c10
-rw-r--r--lib/log1p.c10
-rw-r--r--lib/lstat.c10
-rw-r--r--lib/malloc.c47
-rw-r--r--lib/malloc/dynarray_at_failure.c3
-rw-r--r--lib/malloca.c36
-rw-r--r--lib/malloca.h36
-rw-r--r--lib/math.c18
-rw-r--r--lib/math.in.h10
-rw-r--r--lib/mbrtowc-impl-utf8.h10
-rw-r--r--lib/mbrtowc-impl.h10
-rw-r--r--lib/mbrtowc.c10
-rw-r--r--lib/mbsinit.c10
-rw-r--r--lib/mbtowc-impl.h10
-rw-r--r--lib/mbtowc-lock.c10
-rw-r--r--lib/mbtowc-lock.h10
-rw-r--r--lib/mbtowc.c10
-rw-r--r--lib/memchr.c24
-rw-r--r--lib/memchr.valgrind10
-rw-r--r--lib/mempcpy.c12
-rw-r--r--lib/minmax.h12
-rw-r--r--lib/mkdir.c10
-rw-r--r--lib/mkostemp.c10
-rw-r--r--lib/msvc-inval.c14
-rw-r--r--lib/msvc-inval.h14
-rw-r--r--lib/msvc-nothrow.c14
-rw-r--r--lib/msvc-nothrow.h14
-rw-r--r--lib/netdb.in.h12
-rw-r--r--lib/netinet_in.in.h12
-rw-r--r--lib/nl_langinfo-lock.c10
-rw-r--r--lib/nl_langinfo.c10
-rw-r--r--lib/nproc.c12
-rw-r--r--lib/nproc.h12
-rw-r--r--lib/nstrftime.c19
-rw-r--r--lib/open.c10
-rw-r--r--lib/pathmax.h12
-rw-r--r--lib/pipe.c14
-rw-r--r--lib/pipe2.c14
-rw-r--r--lib/poll.c14
-rw-r--r--lib/poll.in.h14
-rw-r--r--lib/printf-args.c14
-rw-r--r--lib/printf-args.h14
-rw-r--r--lib/printf-parse.c25
-rw-r--r--lib/printf-parse.h14
-rw-r--r--lib/putenv.c10
-rw-r--r--lib/raise.c10
-rw-r--r--lib/rawmemchr.c10
-rw-r--r--lib/rawmemchr.valgrind10
-rw-r--r--lib/read.c10
-rw-r--r--lib/readlink.c10
-rw-r--r--lib/realloc.c68
-rw-r--r--lib/recv.c10
-rw-r--r--lib/recvfrom.c10
-rw-r--r--lib/regex_internal.c9
-rw-r--r--lib/regexec.c12
-rw-r--r--lib/rename.c10
-rw-r--r--lib/rmdir.c10
-rw-r--r--lib/round.c14
-rw-r--r--lib/safe-read.c10
-rw-r--r--lib/safe-read.h10
-rw-r--r--lib/safe-write.c10
-rw-r--r--lib/safe-write.h10
-rw-r--r--lib/same-inode.h10
-rw-r--r--lib/scratch_buffer.h20
-rw-r--r--lib/select.c23
-rw-r--r--lib/send.c10
-rw-r--r--lib/sendto.c10
-rw-r--r--lib/setenv.c10
-rw-r--r--lib/setlocale-lock.c10
-rw-r--r--lib/setlocale_null.c10
-rw-r--r--lib/setlocale_null.h10
-rw-r--r--lib/setsockopt.c10
-rw-r--r--lib/shutdown.c10
-rw-r--r--lib/signal.in.h10
-rw-r--r--lib/signbitd.c10
-rw-r--r--lib/signbitf.c10
-rw-r--r--lib/signbitl.c10
-rw-r--r--lib/size_max.h12
-rw-r--r--lib/snprintf.c14
-rw-r--r--lib/socket.c10
-rw-r--r--lib/sockets.c10
-rw-r--r--lib/sockets.h10
-rw-r--r--lib/stat-time.c18
-rw-r--r--lib/stat-time.h10
-rw-r--r--lib/stat-w32.c10
-rw-r--r--lib/stat-w32.h10
-rw-r--r--lib/stat.c10
-rw-r--r--lib/stdalign.in.h12
-rw-r--r--lib/stdbool.in.h12
-rw-r--r--lib/stddef.in.h12
-rw-r--r--lib/stdint.in.h16
-rw-r--r--lib/stdio.in.h126
-rw-r--r--lib/stdlib.in.h185
-rw-r--r--lib/strdup.c14
-rw-r--r--lib/streq.h14
-rw-r--r--lib/strftime.h10
-rw-r--r--lib/striconveh.c10
-rw-r--r--lib/striconveh.h18
-rw-r--r--lib/string.in.h68
-rw-r--r--lib/stripslash.c10
-rw-r--r--lib/sys-limits.h12
-rw-r--r--lib/sys_file.in.h12
-rw-r--r--lib/sys_random.in.h12
-rw-r--r--lib/sys_select.in.h12
-rw-r--r--lib/sys_socket.c18
-rw-r--r--lib/sys_socket.in.h12
-rw-r--r--lib/sys_stat.in.h12
-rw-r--r--lib/sys_time.in.h12
-rw-r--r--lib/sys_times.in.h12
-rw-r--r--lib/sys_types.in.h12
-rw-r--r--lib/sys_uio.in.h12
-rw-r--r--lib/tempname.h10
-rw-r--r--lib/time-internal.h14
-rw-r--r--lib/time.in.h12
-rw-r--r--lib/time_r.c14
-rw-r--r--lib/time_rz.c14
-rw-r--r--lib/times.c12
-rw-r--r--lib/trunc.c10
-rw-r--r--lib/tzset.c12
-rw-r--r--lib/unistd.c18
-rw-r--r--lib/unistd.in.h25
-rw-r--r--lib/unsetenv.c10
-rw-r--r--lib/vasnprintf.c50
-rw-r--r--lib/vasnprintf.h14
-rw-r--r--lib/verify.h14
-rw-r--r--lib/vsnprintf.c14
-rw-r--r--lib/w32sock.h10
-rw-r--r--lib/wchar.in.h63
-rw-r--r--lib/wcrtomb.c10
-rw-r--r--lib/wctype-h.c19
-rw-r--r--lib/wctype.in.h22
-rw-r--r--lib/windows-initguard.h12
-rw-r--r--lib/write.c10
-rw-r--r--lib/xalloc-oversized.h47
-rw-r--r--lib/xsize.c18
-rw-r--r--lib/xsize.h12
-rw-r--r--libguile.h1
-rw-r--r--libguile/Makefile.am4
-rw-r--r--libguile/array-handle.h10
-rw-r--r--libguile/array-map.c3
-rw-r--r--libguile/arrays.c872
-rw-r--r--libguile/arrays.h60
-rw-r--r--libguile/bytevectors.c42
-rw-r--r--libguile/deprecated.c76
-rw-r--r--libguile/deprecated.h4
-rw-r--r--libguile/eq.c2
-rw-r--r--libguile/frames.c11
-rw-r--r--libguile/generalized-arrays.c410
-rw-r--r--libguile/generalized-arrays.h73
-rw-r--r--libguile/init.c2
-rw-r--r--libguile/loader.h2
-rw-r--r--libguile/print.h2
-rw-r--r--libguile/random.c1
-rw-r--r--libguile/sort.c1
-rw-r--r--libguile/srfi-4.h277
-rw-r--r--libguile/vectors.c356
-rw-r--r--libguile/vectors.h13
-rw-r--r--m4/arpa_inet_h.m431
-rw-r--r--m4/dirent_h.m445
-rw-r--r--m4/environ.m45
-rw-r--r--m4/fcntl_h.m439
-rw-r--r--m4/flock.m44
-rw-r--r--m4/fstat.m44
-rw-r--r--m4/getaddrinfo.m410
-rw-r--r--m4/gnulib-common.m4140
-rw-r--r--m4/gnulib-comp.m4140
-rw-r--r--m4/hostent.m44
-rw-r--r--m4/iconv_h.m427
-rw-r--r--m4/inttypes.m431
-rw-r--r--m4/langinfo_h.m425
-rw-r--r--m4/largefile.m428
-rw-r--r--m4/limits-h.m43
-rw-r--r--m4/locale_h.m437
-rw-r--r--m4/malloc.m4152
-rw-r--r--m4/math_h.m4227
-rw-r--r--m4/memchr.m44
-rw-r--r--m4/mempcpy.m44
-rw-r--r--m4/mktime.m44
-rw-r--r--m4/netdb_h.m425
-rw-r--r--m4/poll_h.m429
-rw-r--r--m4/printf.m45
-rw-r--r--m4/rawmemchr.m44
-rw-r--r--m4/realloc.m447
-rw-r--r--m4/regex.m444
-rw-r--r--m4/select.m44
-rw-r--r--m4/servent.m44
-rw-r--r--m4/signal_h.m433
-rw-r--r--m4/sockpfaf.m46
-rw-r--r--m4/stat.m44
-rw-r--r--m4/stddef_h.m423
-rw-r--r--m4/stdint.m46
-rw-r--r--m4/stdio_h.m4168
-rw-r--r--m4/stdlib_h.m4116
-rw-r--r--m4/strdup.m46
-rw-r--r--m4/string_h.m4124
-rw-r--r--m4/sys_file_h.m429
-rw-r--r--m4/sys_random_h.m425
-rw-r--r--m4/sys_select_h.m429
-rw-r--r--m4/sys_socket_h.m453
-rw-r--r--m4/sys_stat_h.m465
-rw-r--r--m4/sys_time_h.m434
-rw-r--r--m4/sys_times_h.m425
-rw-r--r--m4/sys_types_h.m416
-rw-r--r--m4/sys_uio_h.m423
-rw-r--r--m4/threadlib.m464
-rw-r--r--m4/time_h.m462
-rw-r--r--m4/time_r.m42
-rw-r--r--m4/time_rz.m42
-rw-r--r--m4/timegm.m44
-rw-r--r--m4/tzset.m44
-rw-r--r--m4/unistd_h.m4194
-rw-r--r--m4/visibility.m46
-rw-r--r--m4/wchar_h.m4109
-rw-r--r--m4/wctype_h.m439
-rw-r--r--m4/wint_t.m410
-rw-r--r--m4/year2038.m4124
-rw-r--r--maint.mk3
-rw-r--r--module/Makefile.am3
-rw-r--r--module/ice-9/boot-9.scm16
-rw-r--r--module/ice-9/ftw.scm8
-rw-r--r--module/ice-9/match.upstream.scm69
-rw-r--r--module/ice-9/psyntax.scm1
-rw-r--r--module/ice-9/read.scm7
-rw-r--r--module/language/cps/cse.scm8
-rw-r--r--module/language/cps/dump.scm317
-rw-r--r--module/language/cps/effects-analysis.scm81
-rw-r--r--module/language/cps/graphs.scm88
-rw-r--r--module/language/cps/slot-allocation.scm214
-rw-r--r--module/language/cps/types.scm2
-rw-r--r--module/language/cps/utils.scm174
-rw-r--r--module/language/tree-il/compile-bytecode.scm6
-rw-r--r--module/language/tree-il/compile-cps.scm11
-rw-r--r--module/language/tree-il/inlinable-exports.scm869
-rw-r--r--module/language/tree-il/letrectify.scm20
-rw-r--r--module/language/tree-il/optimize.scm11
-rw-r--r--module/language/tree-il/peval.scm192
-rw-r--r--module/language/tree-il/primitives.scm3
-rw-r--r--module/language/tree-il/resolve-free-vars.scm282
-rw-r--r--module/scheme/base.scm49
-rw-r--r--module/srfi/srfi-1.scm4
-rw-r--r--module/srfi/srfi-43.scm43
-rw-r--r--module/system/base/optimize.scm7
-rw-r--r--module/system/foreign-library.scm2
-rw-r--r--module/system/repl/command.scm17
-rw-r--r--module/system/repl/common.scm26
-rw-r--r--module/system/vm/assembler.scm7
-rw-r--r--module/system/vm/trace.scm2
-rw-r--r--test-suite/tests/arrays.test2
-rw-r--r--test-suite/tests/bytevectors.test14
-rw-r--r--test-suite/tests/compiler.test130
-rw-r--r--test-suite/tests/match.test13
-rw-r--r--test-suite/tests/match.test.upstream16
-rw-r--r--test-suite/tests/numbers.test13
-rw-r--r--test-suite/tests/reader.test5
-rw-r--r--test-suite/tests/syntax.test10
-rw-r--r--test-suite/tests/vectors.test11
370 files changed, 7636 insertions, 4786 deletions
diff --git a/am/bootstrap.am b/am/bootstrap.am
index 1ba52dd37..eb6880ea8 100644
--- a/am/bootstrap.am
+++ b/am/bootstrap.am
@@ -63,10 +63,12 @@ SOURCES = \
language/tree-il/effects.scm \
language/tree-il/eta-expand.scm \
language/tree-il/fix-letrec.scm \
+ language/tree-il/inlinable-exports.scm \
language/tree-il/letrectify.scm \
language/tree-il/optimize.scm \
language/tree-il/peval.scm \
language/tree-il/primitives.scm \
+ language/tree-il/resolve-free-vars.scm \
language/tree-il/spec.scm \
\
language/scheme/spec.scm \
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index 84d2d6378..f3b5461ae 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -35,12 +35,14 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2020-05-10 16:13'; # UTC
+my $VERSION = '2021-08-04 09:17'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
+my $copyright_year = '2021';
+
use strict;
use Getopt::Long;
use POSIX qw(strftime);
@@ -49,12 +51,6 @@ use POSIX qw(strftime);
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
my @archive_suffixes = qw (tar.gz tar.bz2 tar.lz tar.lzma tar.xz);
-my %digest_classes =
- (
- 'md5' => (eval { require Digest::MD5; } and 'Digest::MD5'),
- 'sha1' => ((eval { require Digest::SHA; } and 'Digest::SHA')
- or (eval { require Digest::SHA1; } and 'Digest::SHA1'))
- );
my $srcdir = '.';
sub usage ($)
@@ -94,7 +90,7 @@ The following are optional:
VERSION is the result of running git describe
in the gnulib source directory.
required if gnulib is in TOOL_LIST.
- --no-print-checksums do not emit MD5 or SHA1 checksums
+ --no-print-checksums do not emit SHA1 or SHA256 checksums
--archive-suffix=SUF add SUF to the list of archive suffixes
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
To: x\@example.com Cc: y-announce\@example.com,...
@@ -161,7 +157,7 @@ sub print_locations ($\@\%@)
=item C<print_checksums (@file)
-Print the MD5 and SHA1 signature section for each C<@file>.
+Print the SHA1 and SHA256 signature section for each C<@file>.
=cut
@@ -169,23 +165,18 @@ sub print_checksums (@)
{
my (@file) = @_;
- print "Here are the MD5 and SHA1 checksums:\n";
+ print "Here are the SHA1 and SHA256 checksums:\n";
print "\n";
- foreach my $meth (qw (md5 sha1))
+ use Digest::file qw(digest_file_hex digest_file_base64);
+
+ foreach my $f (@file)
{
- my $class = $digest_classes{$meth} or next;
- foreach my $f (@file)
- {
- open IN, '<', $f
- or die "$ME: $f: cannot open for reading: $!\n";
- binmode IN;
- my $dig = $class->new->addfile(*IN)->hexdigest;
- close IN;
- print "$dig $f\n";
- }
+ print digest_file_hex($f, "SHA-1"), " $f\n";
+ print digest_file_base64($f, "SHA-256"), " $f\n";
}
- print "\n";
+ print "\nThe SHA256 checksum is base64 encoded, instead of the\n";
+ print "hexadecimal encoding that most checksum tools default to.\n\n";
}
=item C<print_news_deltas ($news_file, $prev_version, $curr_version)
@@ -413,7 +404,19 @@ sub get_tool_versions ($$)
'archive-suffix=s' => \@archive_suffixes,
help => sub { usage 0 },
- version => sub { print "$ME version $VERSION\n"; exit },
+ version =>
+ sub
+ {
+ print "$ME version $VERSION\n";
+ print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+ print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+ . "This is free software: you are free to change and redistribute it.\n"
+ . "There is NO WARRANTY, to the extent permitted by law.\n";
+ print "\n";
+ my $author = "Jim Meyering";
+ print "Written by $author.\n";
+ exit
+ },
) or usage 1;
my $fail = 0;
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index 1872de9d5..1241ee35a 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2021-01-01.00
+scriptversion=2021-07-19.18
# Copyright 2003-2021 Free Software Foundation, Inc.
#
@@ -58,7 +58,7 @@ EMAIL=webmasters@gnu.org # please override with --email
commonarg= # passed to all makeinfo/texi2html invcations.
dirargs= # passed to all tools (-I dir).
dirs= # -I directories.
-htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
+htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
default_htmlarg=true
infoarg=--no-split
generate_ascii=true
@@ -202,7 +202,7 @@ base=$PACKAGE
if $default_htmlarg && test -n "$use_texi2html"; then
# The legacy texi2html doesn't support TOP_NODE_UP_URL
- htmlarg="--css-ref=/software/gnulib/manual.css"
+ htmlarg="--css-ref=https://www.gnu.org/software/gnulib/manual.css"
fi
if test -n "$srcfile"; then
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index be0fc2088..5e42afb2c 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -75,10 +75,10 @@ me=$0
year=`expr "$scriptversion" : '\([^-]*\)'`
version="git-version-gen $scriptversion
-Copyright $year Free Software Foundation, Inc.
-There is NO warranty. You may redistribute this software
-under the terms of the GNU General Public License.
-For more information about these matters, see the files named COPYING."
+Copyright (C) ${year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
usage="\
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
diff --git a/build-aux/gnupload b/build-aux/gnupload
index 434741d1e..e7822aed7 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,13 +1,13 @@
#!/bin/sh
# Sign files and upload them.
-scriptversion=2018-05-19.18; # UTC
+scriptversion=2021-04-11.09; # UTC
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
#
# This program 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, or (at your option)
+# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -27,8 +27,8 @@ set -e
GPG=gpg
# Choose the proper version of gpg, so as to avoid a
# "gpg-agent is not available in this session" error
-# when gpg-agent is version 3 but gpg is still version 1.
-# FIXME-2020: remove, once all major distros ship gpg version 3 as /usr/bin/gpg
+# when gpg-agent is version 2 but gpg is still version 1.
+# FIXME-2020: remove, once all major distros ship gpg version 2 as /usr/bin/gpg
gpg_agent_version=`(gpg-agent --version) 2>/dev/null | sed -e '2,$d' -e 's/^[^0-9]*//'`
case "$gpg_agent_version" in
2.*)
@@ -145,6 +145,12 @@ the build-aux/ directory of the gnulib package
Send patches and bug reports to <bug-gnulib@gnu.org>."
+copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
+License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
# Read local configuration file
if test -r "$conffile"; then
echo "$0: Reading configuration file $conffile"
@@ -209,7 +215,8 @@ while test -n "$1"; do
;;
--version)
echo "gnupload $scriptversion"
- exit $?
+ echo "$copyright"
+ exit 0
;;
--)
shift
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 784d80b3e..5bbbc44c5 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -36,12 +36,14 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
-my $VERSION = '2020-04-04 15:07'; # UTC
+my $VERSION = '2021-04-11 10:11'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
+my $copyright_year = '2021';
+
use strict;
use warnings;
use Getopt::Long;
@@ -118,7 +120,19 @@ sub is_NULL ($)
GetOptions
(
help => sub { usage 0 },
- version => sub { print "$ME version $VERSION\n"; exit },
+ version =>
+ sub
+ {
+ print "$ME version $VERSION\n";
+ print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
+ print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
+ . "This is free software: you are free to change and redistribute it.\n"
+ . "There is NO WARRANTY, to the extent permitted by law.\n";
+ print "\n";
+ my $author = "Jim Meyering";
+ print "Written by $author.\n";
+ exit
+ },
list => \$list,
'name=s@' => \@name,
) or usage 1;
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 2ad13f5a5..f695b1934 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -3424,6 +3424,7 @@ Like @code{scm_string_set_x}, but the index is given as a @code{size_t}.
@end deftypefn
@rnindex string-fill!
+@anchor{x-string-fill!}
@deffn {Scheme Procedure} string-fill! str chr [start [end]]
@deffnx {C Function} scm_substring_fill_x (str, chr, start, end)
@deffnx {C Function} scm_string_fill_x (str, chr)
@@ -6214,12 +6215,12 @@ accessed element in the list.
Vectors can contain any kind of Scheme object; it is even possible to
have different types of objects in the same vector. For vectors
-containing vectors, you may wish to use arrays, instead. Note, too,
-that vectors are the special case of one dimensional non-uniform arrays
-and that most array procedures operate happily on vectors
-(@pxref{Arrays}).
+containing vectors, you may wish to use @ref{Arrays,arrays} instead.
+Note, too, that vectors are a special case of one dimensional
+non-uniform arrays and that array procedures operate happily on vectors.
-Also see @ref{SRFI-43}, for a comprehensive vector library.
+Also see @ref{SRFI-43}, @ref{R6RS Support}, or @ref{R7RS Support}, for
+more comprehensive vector libraries.
@menu
* Vector Syntax:: Read syntax for vectors.
@@ -6349,6 +6350,7 @@ Return the contents of position @var{k} of @var{vec}.
@end lisp
@end deffn
+@anchor{x-scm_c_vector_ref}
@deftypefn {C Function} SCM scm_c_vector_ref (SCM vec, size_t k)
Return the contents of position @var{k} (a @code{size_t}) of
@var{vec}.
@@ -6376,20 +6378,45 @@ The value returned by @samp{vector-set!} is unspecified.
@end lisp
@end deffn
+@anchor{x-scm_c_vector_set_x}
@deftypefn {C Function} void scm_c_vector_set_x (SCM vec, size_t k, SCM obj)
Store @var{obj} in position @var{k} (a @code{size_t}) of @var{vec}.
@end deftypefn
@rnindex vector-fill!
-@deffn {Scheme Procedure} vector-fill! vec fill
+@anchor{x-vector-fill!}
+@deffn {Scheme Procedure} vector-fill! vec fill [start [end]]
@deffnx {C Function} scm_vector_fill_x (vec, fill)
-Store @var{fill} in every position of @var{vec}. The value
-returned by @code{vector-fill!} is unspecified.
+Store @var{fill} in every position of @var{vec} in the range
+[@var{start} ... @var{end}). @var{start} defaults to 0 and @var{end}
+defaults to the length of @var{vec}.
+
+The value returned by @code{vector-fill!} is unspecified.
@end deffn
-@deffn {Scheme Procedure} vector-copy vec
+@rnindex vector-copy
+@deffn {Scheme Procedure} vector-copy vec [start [end]]
@deffnx {C Function} scm_vector_copy (vec)
-Return a copy of @var{vec}.
+Returns a freshly allocated vector containing the elements of @var{vec}
+in the range [@var{start} ... @var{end}). @var{start} defaults to 0 and
+@var{end} defaults to the length of @var{vec}.
+@end deffn
+
+@rnindex vector-copy!
+@deffn {Scheme Procedure} vector-copy! dst at src [start [end]]
+Copy the block of elements from vector @var{src} in the range
+[@var{start} ... @var{end}) into vector @var{dst}, starting at position
+@var{at}. @var{at} and @var{start} default to 0 and @var{end} defaults
+to the length of @var{src}.
+
+It is an error for @var{dst} to have a length less than @var{at} +
+(@var{end} - @var{start}).
+
+The order in which elements are copied is unspecified, except that if the
+source and destination overlap, copying takes place as if the source is
+first copied into a temporary vector and then into the destination.
+
+The value returned by @code{vector-copy!} is unspecified.
@end deffn
@deffn {Scheme Procedure} vector-move-left! vec1 start1 end1 vec2 start2
@@ -6402,6 +6429,8 @@ to @var{vec2} starting at position @var{start2}. @var{start1} and
Therefore, in the case where @var{vec1} and @var{vec2} refer to the
same vector, @code{vector-move-left!} is usually appropriate when
@var{start1} is greater than @var{start2}.
+
+The value returned by @code{vector-move-left!} is unspecified.
@end deffn
@deffn {Scheme Procedure} vector-move-right! vec1 start1 end1 vec2 start2
@@ -6414,64 +6443,56 @@ to @var{vec2} starting at position @var{start2}. @var{start1} and
Therefore, in the case where @var{vec1} and @var{vec2} refer to the
same vector, @code{vector-move-right!} is usually appropriate when
@var{start1} is less than @var{start2}.
+
+The value returned by @code{vector-move-right!} is unspecified.
@end deffn
@node Vector Accessing from C
@subsubsection Vector Accessing from C
A vector can be read and modified from C with the functions
-@code{scm_c_vector_ref} and @code{scm_c_vector_set_x}, for example. In
-addition to these functions, there are two more ways to access vectors
-from C that might be more efficient in certain situations: you can
-restrict yourself to @dfn{simple vectors} and then use the very fast
-@emph{simple vector macros}; or you can use the very general framework
-for accessing all kinds of arrays (@pxref{Accessing Arrays from C}),
-which is more verbose, but can deal efficiently with all kinds of
-vectors (and arrays). For vectors, you can use the
-@code{scm_vector_elements} and @code{scm_vector_writable_elements}
-functions as shortcuts.
-
-@deftypefn {C Function} int scm_is_simple_vector (SCM obj)
-Return non-zero if @var{obj} is a simple vector, else return zero. A
-simple vector is a vector that can be used with the @code{SCM_SIMPLE_*}
-macros below.
-
-The following functions are guaranteed to return simple vectors:
-@code{scm_make_vector}, @code{scm_c_make_vector}, @code{scm_vector},
-@code{scm_list_to_vector}.
-@end deftypefn
+@ref{x-scm_c_vector_ref,@code{scm_c_vector_ref}} and
+@ref{x-scm_c_vector_set_x,@code{scm_c_vector_set_x}}. In addition to
+these functions, there are two other ways to access vectors from C that
+might be more efficient in certain situations: you can use the unsafe
+@emph{vector macros}; or you can use the general framework for accessing
+all kinds of arrays (@pxref{Accessing Arrays from C}), which is more
+verbose, but can deal efficiently with all kinds of vectors (and
+arrays). For arrays of rank 1 whose backing store is a vector, you can
+use the @code{scm_vector_elements} and
+@code{scm_vector_writable_elements} functions as shortcuts.
@deftypefn {C Macro} size_t SCM_SIMPLE_VECTOR_LENGTH (SCM vec)
-Evaluates to the length of the simple vector @var{vec}. No type
+Evaluates to the length of the vector @var{vec}. No type
checking is done.
@end deftypefn
@deftypefn {C Macro} SCM SCM_SIMPLE_VECTOR_REF (SCM vec, size_t idx)
-Evaluates to the element at position @var{idx} in the simple vector
-@var{vec}. No type or range checking is done.
+Evaluates to the element at position @var{idx} in the vector @var{vec}.
+No type or range checking is done.
@end deftypefn
@deftypefn {C Macro} void SCM_SIMPLE_VECTOR_SET (SCM vec, size_t idx, SCM val)
-Sets the element at position @var{idx} in the simple vector
-@var{vec} to @var{val}. No type or range checking is done.
+Sets the element at position @var{idx} in the vector @var{vec} to
+@var{val}. No type or range checking is done.
@end deftypefn
-@deftypefn {C Function} {const SCM *} scm_vector_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
-Acquire a handle for the vector @var{vec} and return a pointer to the
-elements of it. This pointer can only be used to read the elements of
-@var{vec}. When @var{vec} is not a vector, an error is signaled. The
-handle must eventually be released with
-@code{scm_array_handle_release}.
+@deftypefn {C Function} {const SCM *} scm_vector_elements (SCM array, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+Acquire a @ref{Accessing Arrays from C,handle} for @var{array} and
+return a read-only pointer to its elements. @var{array} must be either
+a vector, or an array of rank 1 whose backing store is a vector;
+otherwise an error is signaled. The handle must eventually be released
+with @ref{x-scm_array_handle_release,@code{scm_array_handle_release}}.
The variables pointed to by @var{lenp} and @var{incp} are filled with
-the number of elements of the vector and the increment (number of
+the number of elements of the array and the increment (number of
elements) between successive elements, respectively. Successive
-elements of @var{vec} need not be contiguous in their underlying
+elements of @var{array} need not be contiguous in their underlying
``root vector'' returned here; hence the increment is not necessarily
equal to 1 and may well be negative too (@pxref{Shared Arrays}).
The following example shows the typical way to use this function. It
-creates a list of all elements of @var{vec} (in reverse order).
+creates a list of all elements of @var{array} (in reverse order).
@example
scm_t_array_handle handle;
@@ -6480,7 +6501,7 @@ ssize_t inc;
const SCM *elt;
SCM list;
-elt = scm_vector_elements (vec, &handle, &len, &inc);
+elt = scm_vector_elements (array, &handle, &len, &inc);
list = SCM_EOL;
for (i = 0; i < len; i++, elt += inc)
list = scm_cons (*elt, list);
@@ -6489,12 +6510,12 @@ scm_array_handle_release (&handle);
@end deftypefn
-@deftypefn {C Function} {SCM *} scm_vector_writable_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+@deftypefn {C Function} {SCM *} scm_vector_writable_elements (SCM array, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
Like @code{scm_vector_elements} but the pointer can be used to modify
-the vector.
+the array.
The following example shows the typical way to use this function. It
-fills a vector with @code{#t}.
+fills an array with @code{#t}.
@example
scm_t_array_handle handle;
@@ -6502,7 +6523,7 @@ size_t i, len;
ssize_t inc;
SCM *elt;
-elt = scm_vector_writable_elements (vec, &handle, &len, &inc);
+elt = scm_vector_writable_elements (array, &handle, &len, &inc);
for (i = 0; i < len; i++, elt += inc)
*elt = SCM_BOOL_T;
scm_array_handle_release (&handle);
@@ -6802,17 +6823,25 @@ Return is @var{bv1} equals to @var{bv2}---i.e., if they have the same
length and contents.
@end deffn
-@deffn {Scheme Procedure} bytevector-fill! bv fill
+@deffn {Scheme Procedure} bytevector-fill! bv fill [start [end]]
@deffnx {C Function} scm_bytevector_fill_x (bv, fill)
-Fill bytevector @var{bv} with @var{fill}, a byte.
+Fill positions [@var{start} ... @var{end}) of bytevector @var{bv} with
+byte @var{fill}. @var{start} defaults to 0 and @var{end} defaults to the
+length of @var{bv}.@footnote{R6RS defines @code{(bytevector-fill! bv
+fill)}. Arguments @var{start} and @var{end} are a Guile extension
+(cf. @ref{x-vector-fill!,@code{vector-fill!}},
+@ref{x-string-fill!,@code{string-fill!}}).}
@end deffn
@deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
@deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
Copy @var{len} bytes from @var{source} into @var{target}, starting
reading from @var{source-start} (a positive index within @var{source})
-and start writing at @var{target-start}. It is permitted for the
-@var{source} and @var{target} regions to overlap.
+and writing at @var{target-start}.
+
+It is permitted for the @var{source} and @var{target} regions to
+overlap. In that case, copying takes place as if the source is first
+copied into a temporary bytevector and then into the destination.
@end deffn
@deffn {Scheme Procedure} bytevector-copy bv
@@ -7997,6 +8026,7 @@ by @var{handle} does not need to be initialized before calling this
function.
@end deftypefn
+@anchor{x-scm_array_handle_release}
@deftypefn {C Function} void scm_array_handle_release (scm_t_array_handle *handle)
End the array reservation represented by @var{handle}. After a call to
this function, @var{handle} might be used for another reservation.
diff --git a/doc/ref/api-procedures.texi b/doc/ref/api-procedures.texi
index 81d2cfc2d..8c533692c 100644
--- a/doc/ref/api-procedures.texi
+++ b/doc/ref/api-procedures.texi
@@ -67,8 +67,8 @@ called, the arguments will be stored into the newly created location for
the formal variables.
@item @var{variable}
The procedure takes any number of arguments; when the procedure is
-called, the sequence of actual arguments will converted into a list and
-stored into the newly created location for the formal variable.
+called, the sequence of actual arguments will be converted into a list
+and stored into the newly created location for the formal variable.
@item (@var{variable1} @dots{} @var{variablen} . @var{variablen+1})
If a space-delimited period precedes the last variable, then the
procedure takes @var{n} or more variables where @var{n} is the number
diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi
index 2e66bafb9..d32560a24 100644
--- a/doc/ref/srfi-modules.texi
+++ b/doc/ref/srfi-modules.texi
@@ -1734,9 +1734,9 @@ indicated kind.
@deftypefnx {C Function} {double *} scm_f64vector_writable_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
@deftypefnx {C Function} {float *} scm_c32vector_writable_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
@deftypefnx {C Function} {double *} scm_c64vector_writable_elements (SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
-Like @code{scm_vector_writable_elements} (@pxref{Vector Accessing from
-C}), but returns a pointer to the elements of a uniform numeric vector
-of the indicated kind.
+Like @code{scm_vector_writable_elements} (@pxref{Vector Accessing from C}),
+but returns a pointer to the elements of a uniform numeric vector of the
+indicated kind.
@end deftypefn
@node SRFI-4 and Bytevectors
@@ -5280,7 +5280,7 @@ By default, @var{equal-proc} is @code{equal?}. It can be any
two-argument procedure, and should answer whether two keys are the
same for this table's purposes.
-My default @var{hash-proc} assumes that @code{equal-proc} is no
+By default @var{hash-proc} assumes that @code{equal-proc} is no
coarser than @code{equal?} unless it is literally @code{string-ci=?}.
If provided, @var{hash-proc} should be a two-argument procedure that
takes a key and the current table size, and answers a reasonably good
diff --git a/doc/ref/sxml.texi b/doc/ref/sxml.texi
index 5f827916e..7e3ca65e3 100644
--- a/doc/ref/sxml.texi
+++ b/doc/ref/sxml.texi
@@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
-@c Copyright (C) 2013, 2017 Free Software Foundation, Inc.
+@c Copyright (C) 2013, 2017, 2021 Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@c SXPath documentation based on SXPath.scm by Oleg Kiselyov,
@@ -26,7 +26,7 @@ may be represented with the following SXML:
SXML is very general, and is capable of representing all of XML.
Formally, this means that SXML is a conforming implementation of the
-@uref{XML Information Set,http://www.w3.org/TR/xml-infoset/} standard.
+@uref{http://www.w3.org/TR/xml-infoset/,XML Information Set} standard.
Guile includes several facilities for working with XML and SXML:
parsers, serializers, and transformers.
diff --git a/guile-readline/readline.c b/guile-readline/readline.c
index 5c4a32689..2dc8f08e6 100644
--- a/guile-readline/readline.c
+++ b/guile-readline/readline.c
@@ -379,16 +379,17 @@ SCM_DEFINE (scm_filename_completion_function, "filename-completion-function", 2,
#define FUNC_NAME s_scm_filename_completion_function
{
char *s;
- SCM ans;
char *c_text = scm_to_locale_string (text);
#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
s = rl_filename_completion_function (c_text, scm_is_true (continuep));
#else
s = filename_completion_function (c_text, scm_is_true (continuep));
#endif
- ans = scm_take_locale_string (s);
free (c_text);
- return ans;
+ if (!s)
+ return SCM_BOOL_F;
+
+ return scm_take_locale_string (s);
}
#undef FUNC_NAME
@@ -430,12 +431,19 @@ static void init_bouncing_parens ();
static void
init_bouncing_parens ()
{
- if (strncmp (rl_get_keymap_name (rl_get_keymap ()), "vi", 2))
+ Keymap km = rl_get_keymap ();
+ if (km)
{
- rl_bind_key (')', match_paren);
- rl_bind_key (']', match_paren);
- rl_bind_key ('}', match_paren);
+ if (strncmp (rl_get_keymap_name (km), "vi", 2))
+ {
+ rl_bind_key (')', match_paren);
+ rl_bind_key (']', match_paren);
+ rl_bind_key ('}', match_paren);
+ }
}
+ else
+ scm_error (scm_misc_error_key, "", "readline has not been properly initialized",
+ SCM_EOL, SCM_EOL);
}
static int
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 02480f6e9..cb29c3136 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -288,8 +288,8 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
- -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
- -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
+ -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \
+ -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
@@ -470,14 +470,14 @@ dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
- -e 's/@''GNULIB_OPENDIR''@/$(GNULIB_OPENDIR)/g' \
- -e 's/@''GNULIB_READDIR''@/$(GNULIB_READDIR)/g' \
- -e 's/@''GNULIB_REWINDDIR''@/$(GNULIB_REWINDDIR)/g' \
- -e 's/@''GNULIB_CLOSEDIR''@/$(GNULIB_CLOSEDIR)/g' \
- -e 's/@''GNULIB_DIRFD''@/$(GNULIB_DIRFD)/g' \
- -e 's/@''GNULIB_FDOPENDIR''@/$(GNULIB_FDOPENDIR)/g' \
- -e 's/@''GNULIB_SCANDIR''@/$(GNULIB_SCANDIR)/g' \
- -e 's/@''GNULIB_ALPHASORT''@/$(GNULIB_ALPHASORT)/g' \
+ -e 's/@''GNULIB_OPENDIR''@/$(GL_GNULIB_OPENDIR)/g' \
+ -e 's/@''GNULIB_READDIR''@/$(GL_GNULIB_READDIR)/g' \
+ -e 's/@''GNULIB_REWINDDIR''@/$(GL_GNULIB_REWINDDIR)/g' \
+ -e 's/@''GNULIB_CLOSEDIR''@/$(GL_GNULIB_CLOSEDIR)/g' \
+ -e 's/@''GNULIB_DIRFD''@/$(GL_GNULIB_DIRFD)/g' \
+ -e 's/@''GNULIB_FDOPENDIR''@/$(GL_GNULIB_FDOPENDIR)/g' \
+ -e 's/@''GNULIB_SCANDIR''@/$(GL_GNULIB_SCANDIR)/g' \
+ -e 's/@''GNULIB_ALPHASORT''@/$(GL_GNULIB_ALPHASORT)/g' \
-e 's/@''HAVE_OPENDIR''@/$(HAVE_OPENDIR)/g' \
-e 's/@''HAVE_READDIR''@/$(HAVE_READDIR)/g' \
-e 's/@''HAVE_REWINDDIR''@/$(HAVE_REWINDDIR)/g' \
@@ -543,6 +543,32 @@ EXTRA_libgnu_la_SOURCES += duplocale.c
## begin gnulib module dynarray
if gl_GNULIB_ENABLED_dynarray
+BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h
+
+malloc/dynarray.gl.h: malloc/dynarray.h
+ $(AM_V_at)$(MKDIR_P) malloc
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t
+
+malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c
+ $(AM_V_at)$(MKDIR_P) malloc
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|<malloc/dynarray\.h>|<malloc/dynarray.gl.h>|g' \
+ -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \
+ -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \
+ -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \
+ -e 's|__glibc_likely|_GL_LIKELY|g' \
+ -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \
+ < $(srcdir)/malloc/dynarray-skeleton.c; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t
+
libgnu_la_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c
endif
@@ -620,13 +646,13 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
- -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \
- -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \
- -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \
- -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \
- -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \
- -e 's/@''GNULIB_MDA_CREAT''@/$(GNULIB_MDA_CREAT)/g' \
- -e 's/@''GNULIB_MDA_OPEN''@/$(GNULIB_MDA_OPEN)/g' \
+ -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \
+ -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \
+ -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \
+ -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \
+ -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \
+ -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \
-e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
-e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
-e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \
@@ -930,7 +956,7 @@ iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \
- -e 's/@''GNULIB_ICONV''@/$(GNULIB_ICONV)/g' \
+ -e 's/@''GNULIB_ICONV''@/$(GL_GNULIB_ICONV)/g' \
-e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \
-e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
-e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
@@ -984,10 +1010,8 @@ EXTRA_libgnu_la_SOURCES += iconv.c iconv_close.c iconv_open.c
## begin gnulib module idx
-if gl_GNULIB_ENABLED_idx
libgnu_la_SOURCES += idx.h
-endif
## end gnulib module idx
## begin gnulib module inet_ntop
@@ -1031,10 +1055,10 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
-e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
-e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
-e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
- -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
- -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
- -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
- -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
+ -e 's/@''GNULIB_IMAXABS''@/$(GL_GNULIB_IMAXABS)/g' \
+ -e 's/@''GNULIB_IMAXDIV''@/$(GL_GNULIB_IMAXDIV)/g' \
+ -e 's/@''GNULIB_STRTOIMAX''@/$(GL_GNULIB_STRTOIMAX)/g' \
+ -e 's/@''GNULIB_STRTOUMAX''@/$(GL_GNULIB_STRTOUMAX)/g' \
-e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
-e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
-e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
@@ -1151,7 +1175,7 @@ langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
- -e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \
+ -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \
-e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
-e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
-e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \
@@ -1264,11 +1288,11 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
- -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \
- -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \
- -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GNULIB_SETLOCALE_NULL)/g' \
- -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \
- -e 's/@''GNULIB_LOCALENAME''@/$(GNULIB_LOCALENAME)/g' \
+ -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \
+ -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \
+ -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \
+ -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \
+ -e 's/@''GNULIB_LOCALENAME''@/$(GL_GNULIB_LOCALENAME)/g' \
-e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \
-e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
-e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \
@@ -1379,108 +1403,108 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
- -e 's/@''GNULIB_ACOSF''@/$(GNULIB_ACOSF)/g' \
- -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \
- -e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \
- -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \
- -e 's/@''GNULIB_ATANF''@/$(GNULIB_ATANF)/g' \
- -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
- -e 's/@''GNULIB_ATAN2F''@/$(GNULIB_ATAN2F)/g' \
- -e 's/@''GNULIB_CBRT''@/$(GNULIB_CBRT)/g' \
- -e 's/@''GNULIB_CBRTF''@/$(GNULIB_CBRTF)/g' \
- -e 's/@''GNULIB_CBRTL''@/$(GNULIB_CBRTL)/g' \
- -e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
- -e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \
- -e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \
- -e 's/@''GNULIB_COPYSIGN''@/$(GNULIB_COPYSIGN)/g' \
- -e 's/@''GNULIB_COPYSIGNF''@/$(GNULIB_COPYSIGNF)/g' \
- -e 's/@''GNULIB_COPYSIGNL''@/$(GNULIB_COPYSIGNL)/g' \
- -e 's/@''GNULIB_COSF''@/$(GNULIB_COSF)/g' \
- -e 's/@''GNULIB_COSL''@/$(GNULIB_COSL)/g' \
- -e 's/@''GNULIB_COSHF''@/$(GNULIB_COSHF)/g' \
- -e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
- -e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
- -e 's/@''GNULIB_EXP2''@/$(GNULIB_EXP2)/g' \
- -e 's/@''GNULIB_EXP2F''@/$(GNULIB_EXP2F)/g' \
- -e 's/@''GNULIB_EXP2L''@/$(GNULIB_EXP2L)/g' \
- -e 's/@''GNULIB_EXPM1''@/$(GNULIB_EXPM1)/g' \
- -e 's/@''GNULIB_EXPM1F''@/$(GNULIB_EXPM1F)/g' \
- -e 's/@''GNULIB_EXPM1L''@/$(GNULIB_EXPM1L)/g' \
- -e 's/@''GNULIB_FABSF''@/$(GNULIB_FABSF)/g' \
- -e 's/@''GNULIB_FABSL''@/$(GNULIB_FABSL)/g' \
- -e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
- -e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
- -e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
- -e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
- -e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
- -e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
- -e 's/@''GNULIB_FMOD''@/$(GNULIB_FMOD)/g' \
- -e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
- -e 's/@''GNULIB_FMODL''@/$(GNULIB_FMODL)/g' \
- -e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
- -e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
- -e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
- -e 's/@''GNULIB_HYPOT''@/$(GNULIB_HYPOT)/g' \
- -e 's/@''GNULIB_HYPOTF''@/$(GNULIB_HYPOTF)/g' \
- -e 's/@''GNULIB_HYPOTL''@/$(GNULIB_HYPOTL)/g' \
+ -e 's/@''GNULIB_ACOSF''@/$(GL_GNULIB_ACOSF)/g' \
+ -e 's/@''GNULIB_ACOSL''@/$(GL_GNULIB_ACOSL)/g' \
+ -e 's/@''GNULIB_ASINF''@/$(GL_GNULIB_ASINF)/g' \
+ -e 's/@''GNULIB_ASINL''@/$(GL_GNULIB_ASINL)/g' \
+ -e 's/@''GNULIB_ATANF''@/$(GL_GNULIB_ATANF)/g' \
+ -e 's/@''GNULIB_ATANL''@/$(GL_GNULIB_ATANL)/g' \
+ -e 's/@''GNULIB_ATAN2F''@/$(GL_GNULIB_ATAN2F)/g' \
+ -e 's/@''GNULIB_CBRT''@/$(GL_GNULIB_CBRT)/g' \
+ -e 's/@''GNULIB_CBRTF''@/$(GL_GNULIB_CBRTF)/g' \
+ -e 's/@''GNULIB_CBRTL''@/$(GL_GNULIB_CBRTL)/g' \
+ -e 's/@''GNULIB_CEIL''@/$(GL_GNULIB_CEIL)/g' \
+ -e 's/@''GNULIB_CEILF''@/$(GL_GNULIB_CEILF)/g' \
+ -e 's/@''GNULIB_CEILL''@/$(GL_GNULIB_CEILL)/g' \
+ -e 's/@''GNULIB_COPYSIGN''@/$(GL_GNULIB_COPYSIGN)/g' \
+ -e 's/@''GNULIB_COPYSIGNF''@/$(GL_GNULIB_COPYSIGNF)/g' \
+ -e 's/@''GNULIB_COPYSIGNL''@/$(GL_GNULIB_COPYSIGNL)/g' \
+ -e 's/@''GNULIB_COSF''@/$(GL_GNULIB_COSF)/g' \
+ -e 's/@''GNULIB_COSL''@/$(GL_GNULIB_COSL)/g' \
+ -e 's/@''GNULIB_COSHF''@/$(GL_GNULIB_COSHF)/g' \
+ -e 's/@''GNULIB_EXPF''@/$(GL_GNULIB_EXPF)/g' \
+ -e 's/@''GNULIB_EXPL''@/$(GL_GNULIB_EXPL)/g' \
+ -e 's/@''GNULIB_EXP2''@/$(GL_GNULIB_EXP2)/g' \
+ -e 's/@''GNULIB_EXP2F''@/$(GL_GNULIB_EXP2F)/g' \
+ -e 's/@''GNULIB_EXP2L''@/$(GL_GNULIB_EXP2L)/g' \
+ -e 's/@''GNULIB_EXPM1''@/$(GL_GNULIB_EXPM1)/g' \
+ -e 's/@''GNULIB_EXPM1F''@/$(GL_GNULIB_EXPM1F)/g' \
+ -e 's/@''GNULIB_EXPM1L''@/$(GL_GNULIB_EXPM1L)/g' \
+ -e 's/@''GNULIB_FABSF''@/$(GL_GNULIB_FABSF)/g' \
+ -e 's/@''GNULIB_FABSL''@/$(GL_GNULIB_FABSL)/g' \
+ -e 's/@''GNULIB_FLOOR''@/$(GL_GNULIB_FLOOR)/g' \
+ -e 's/@''GNULIB_FLOORF''@/$(GL_GNULIB_FLOORF)/g' \
+ -e 's/@''GNULIB_FLOORL''@/$(GL_GNULIB_FLOORL)/g' \
+ -e 's/@''GNULIB_FMA''@/$(GL_GNULIB_FMA)/g' \
+ -e 's/@''GNULIB_FMAF''@/$(GL_GNULIB_FMAF)/g' \
+ -e 's/@''GNULIB_FMAL''@/$(GL_GNULIB_FMAL)/g' \
+ -e 's/@''GNULIB_FMOD''@/$(GL_GNULIB_FMOD)/g' \
+ -e 's/@''GNULIB_FMODF''@/$(GL_GNULIB_FMODF)/g' \
+ -e 's/@''GNULIB_FMODL''@/$(GL_GNULIB_FMODL)/g' \
+ -e 's/@''GNULIB_FREXPF''@/$(GL_GNULIB_FREXPF)/g' \
+ -e 's/@''GNULIB_FREXP''@/$(GL_GNULIB_FREXP)/g' \
+ -e 's/@''GNULIB_FREXPL''@/$(GL_GNULIB_FREXPL)/g' \
+ -e 's/@''GNULIB_HYPOT''@/$(GL_GNULIB_HYPOT)/g' \
+ -e 's/@''GNULIB_HYPOTF''@/$(GL_GNULIB_HYPOTF)/g' \
+ -e 's/@''GNULIB_HYPOTL''@/$(GL_GNULIB_HYPOTL)/g' \
< $(srcdir)/math.in.h | \
- sed -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
- -e 's/@''GNULIB_ILOGBF''@/$(GNULIB_ILOGBF)/g' \
- -e 's/@''GNULIB_ILOGBL''@/$(GNULIB_ILOGBL)/g' \
- -e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
- -e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \
- -e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \
- -e 's/@''GNULIB_ISNANF''@/$(GNULIB_ISNANF)/g' \
- -e 's/@''GNULIB_ISNAND''@/$(GNULIB_ISNAND)/g' \
- -e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \
- -e 's/@''GNULIB_LDEXPF''@/$(GNULIB_LDEXPF)/g' \
- -e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
- -e 's/@''GNULIB_LOG''@/$(GNULIB_LOG)/g' \
- -e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
- -e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
- -e 's/@''GNULIB_LOG10''@/$(GNULIB_LOG10)/g' \
- -e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
- -e 's/@''GNULIB_LOG10L''@/$(GNULIB_LOG10L)/g' \
- -e 's/@''GNULIB_LOG1P''@/$(GNULIB_LOG1P)/g' \
- -e 's/@''GNULIB_LOG1PF''@/$(GNULIB_LOG1PF)/g' \
- -e 's/@''GNULIB_LOG1PL''@/$(GNULIB_LOG1PL)/g' \
- -e 's/@''GNULIB_LOG2''@/$(GNULIB_LOG2)/g' \
- -e 's/@''GNULIB_LOG2F''@/$(GNULIB_LOG2F)/g' \
- -e 's/@''GNULIB_LOG2L''@/$(GNULIB_LOG2L)/g' \
- -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
- -e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
- -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
- -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
- -e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
- -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
- -e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
- -e 's/@''GNULIB_REMAINDER''@/$(GNULIB_REMAINDER)/g' \
- -e 's/@''GNULIB_REMAINDERF''@/$(GNULIB_REMAINDERF)/g' \
- -e 's/@''GNULIB_REMAINDERL''@/$(GNULIB_REMAINDERL)/g' \
- -e 's/@''GNULIB_RINT''@/$(GNULIB_RINT)/g' \
- -e 's/@''GNULIB_RINTF''@/$(GNULIB_RINTF)/g' \
- -e 's/@''GNULIB_RINTL''@/$(GNULIB_RINTL)/g' \
- -e 's/@''GNULIB_ROUND''@/$(GNULIB_ROUND)/g' \
- -e 's/@''GNULIB_ROUNDF''@/$(GNULIB_ROUNDF)/g' \
- -e 's/@''GNULIB_ROUNDL''@/$(GNULIB_ROUNDL)/g' \
- -e 's/@''GNULIB_SIGNBIT''@/$(GNULIB_SIGNBIT)/g' \
- -e 's/@''GNULIB_SINF''@/$(GNULIB_SINF)/g' \
- -e 's/@''GNULIB_SINL''@/$(GNULIB_SINL)/g' \
- -e 's/@''GNULIB_SINHF''@/$(GNULIB_SINHF)/g' \
- -e 's/@''GNULIB_SQRTF''@/$(GNULIB_SQRTF)/g' \
- -e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
- -e 's/@''GNULIB_TANF''@/$(GNULIB_TANF)/g' \
- -e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
- -e 's/@''GNULIB_TANHF''@/$(GNULIB_TANHF)/g' \
- -e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
- -e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
- -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
- -e 's/@''GNULIB_MDA_J0''@/$(GNULIB_MDA_J0)/g' \
- -e 's/@''GNULIB_MDA_J1''@/$(GNULIB_MDA_J1)/g' \
- -e 's/@''GNULIB_MDA_JN''@/$(GNULIB_MDA_JN)/g' \
- -e 's/@''GNULIB_MDA_Y0''@/$(GNULIB_MDA_Y0)/g' \
- -e 's/@''GNULIB_MDA_Y1''@/$(GNULIB_MDA_Y1)/g' \
- -e 's/@''GNULIB_MDA_YN''@/$(GNULIB_MDA_YN)/g' \
+ sed -e 's/@''GNULIB_ILOGB''@/$(GL_GNULIB_ILOGB)/g' \
+ -e 's/@''GNULIB_ILOGBF''@/$(GL_GNULIB_ILOGBF)/g' \
+ -e 's/@''GNULIB_ILOGBL''@/$(GL_GNULIB_ILOGBL)/g' \
+ -e 's/@''GNULIB_ISFINITE''@/$(GL_GNULIB_ISFINITE)/g' \
+ -e 's/@''GNULIB_ISINF''@/$(GL_GNULIB_ISINF)/g' \
+ -e 's/@''GNULIB_ISNAN''@/$(GL_GNULIB_ISNAN)/g' \
+ -e 's/@''GNULIB_ISNANF''@/$(GL_GNULIB_ISNANF)/g' \
+ -e 's/@''GNULIB_ISNAND''@/$(GL_GNULIB_ISNAND)/g' \
+ -e 's/@''GNULIB_ISNANL''@/$(GL_GNULIB_ISNANL)/g' \
+ -e 's/@''GNULIB_LDEXPF''@/$(GL_GNULIB_LDEXPF)/g' \
+ -e 's/@''GNULIB_LDEXPL''@/$(GL_GNULIB_LDEXPL)/g' \
+ -e 's/@''GNULIB_LOG''@/$(GL_GNULIB_LOG)/g' \
+ -e 's/@''GNULIB_LOGF''@/$(GL_GNULIB_LOGF)/g' \
+ -e 's/@''GNULIB_LOGL''@/$(GL_GNULIB_LOGL)/g' \
+ -e 's/@''GNULIB_LOG10''@/$(GL_GNULIB_LOG10)/g' \
+ -e 's/@''GNULIB_LOG10F''@/$(GL_GNULIB_LOG10F)/g' \
+ -e 's/@''GNULIB_LOG10L''@/$(GL_GNULIB_LOG10L)/g' \
+ -e 's/@''GNULIB_LOG1P''@/$(GL_GNULIB_LOG1P)/g' \
+ -e 's/@''GNULIB_LOG1PF''@/$(GL_GNULIB_LOG1PF)/g' \
+ -e 's/@''GNULIB_LOG1PL''@/$(GL_GNULIB_LOG1PL)/g' \
+ -e 's/@''GNULIB_LOG2''@/$(GL_GNULIB_LOG2)/g' \
+ -e 's/@''GNULIB_LOG2F''@/$(GL_GNULIB_LOG2F)/g' \
+ -e 's/@''GNULIB_LOG2L''@/$(GL_GNULIB_LOG2L)/g' \
+ -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \
+ -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \
+ -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \
+ -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \
+ -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \
+ -e 's/@''GNULIB_MODFL''@/$(GL_GNULIB_MODFL)/g' \
+ -e 's/@''GNULIB_POWF''@/$(GL_GNULIB_POWF)/g' \
+ -e 's/@''GNULIB_REMAINDER''@/$(GL_GNULIB_REMAINDER)/g' \
+ -e 's/@''GNULIB_REMAINDERF''@/$(GL_GNULIB_REMAINDERF)/g' \
+ -e 's/@''GNULIB_REMAINDERL''@/$(GL_GNULIB_REMAINDERL)/g' \
+ -e 's/@''GNULIB_RINT''@/$(GL_GNULIB_RINT)/g' \
+ -e 's/@''GNULIB_RINTF''@/$(GL_GNULIB_RINTF)/g' \
+ -e 's/@''GNULIB_RINTL''@/$(GL_GNULIB_RINTL)/g' \
+ -e 's/@''GNULIB_ROUND''@/$(GL_GNULIB_ROUND)/g' \
+ -e 's/@''GNULIB_ROUNDF''@/$(GL_GNULIB_ROUNDF)/g' \
+ -e 's/@''GNULIB_ROUNDL''@/$(GL_GNULIB_ROUNDL)/g' \
+ -e 's/@''GNULIB_SIGNBIT''@/$(GL_GNULIB_SIGNBIT)/g' \
+ -e 's/@''GNULIB_SINF''@/$(GL_GNULIB_SINF)/g' \
+ -e 's/@''GNULIB_SINL''@/$(GL_GNULIB_SINL)/g' \
+ -e 's/@''GNULIB_SINHF''@/$(GL_GNULIB_SINHF)/g' \
+ -e 's/@''GNULIB_SQRTF''@/$(GL_GNULIB_SQRTF)/g' \
+ -e 's/@''GNULIB_SQRTL''@/$(GL_GNULIB_SQRTL)/g' \
+ -e 's/@''GNULIB_TANF''@/$(GL_GNULIB_TANF)/g' \
+ -e 's/@''GNULIB_TANL''@/$(GL_GNULIB_TANL)/g' \
+ -e 's/@''GNULIB_TANHF''@/$(GL_GNULIB_TANHF)/g' \
+ -e 's/@''GNULIB_TRUNC''@/$(GL_GNULIB_TRUNC)/g' \
+ -e 's/@''GNULIB_TRUNCF''@/$(GL_GNULIB_TRUNCF)/g' \
+ -e 's/@''GNULIB_TRUNCL''@/$(GL_GNULIB_TRUNCL)/g' \
+ -e 's/@''GNULIB_MDA_J0''@/$(GL_GNULIB_MDA_J0)/g' \
+ -e 's/@''GNULIB_MDA_J1''@/$(GL_GNULIB_MDA_J1)/g' \
+ -e 's/@''GNULIB_MDA_JN''@/$(GL_GNULIB_MDA_JN)/g' \
+ -e 's/@''GNULIB_MDA_Y0''@/$(GL_GNULIB_MDA_Y0)/g' \
+ -e 's/@''GNULIB_MDA_Y1''@/$(GL_GNULIB_MDA_Y1)/g' \
+ -e 's/@''GNULIB_MDA_YN''@/$(GL_GNULIB_MDA_YN)/g' \
| \
sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
@@ -1804,7 +1828,7 @@ netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
- -e 's/@''GNULIB_GETADDRINFO''@/$(GNULIB_GETADDRINFO)/g' \
+ -e 's/@''GNULIB_GETADDRINFO''@/$(GL_GNULIB_GETADDRINFO)/g' \
-e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
-e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
-e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
@@ -1937,7 +1961,7 @@ poll.h: poll.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_POLL_H''@|$(NEXT_POLL_H)|g' \
- -e 's/@''GNULIB_POLL''@/$(GNULIB_POLL)/g' \
+ -e 's/@''GNULIB_POLL''@/$(GL_GNULIB_POLL)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_POLL''@|$(HAVE_POLL)|g' \
-e 's|@''REPLACE_POLL''@|$(REPLACE_POLL)|g' \
@@ -2098,6 +2122,21 @@ EXTRA_DIST += same-inode.h
## begin gnulib module scratch_buffer
if gl_GNULIB_ENABLED_scratch_buffer
+BUILT_SOURCES += malloc/scratch_buffer.gl.h
+
+malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h
+ $(AM_V_at)$(MKDIR_P) malloc
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \
+ -e 's|__glibc_likely|_GL_LIKELY|g' \
+ -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \
+ -e '/libc_hidden_proto/d' \
+ < $(srcdir)/malloc/scratch_buffer.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t
+
libgnu_la_SOURCES += malloc/scratch_buffer_dupfree.c malloc/scratch_buffer_grow.c malloc/scratch_buffer_grow_preserve.c malloc/scratch_buffer_set_array_size.c
endif
@@ -2185,11 +2224,11 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
- -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GNULIB_PTHREAD_SIGMASK)/g' \
- -e 's/@''GNULIB_RAISE''@/$(GNULIB_RAISE)/g' \
- -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
- -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
+ -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \
+ -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \
+ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \
+ -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \
-e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
-e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
-e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
@@ -2442,7 +2481,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status
-e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
-e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \
< $(srcdir)/stdint.in.h; \
} > $@-t && \
mv $@-t $@
@@ -2470,65 +2509,65 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
- -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
- -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
- -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
- -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
- -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
- -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
- -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \
- -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \
- -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \
- -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \
- -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \
- -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \
- -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \
- -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \
- -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \
- -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \
- -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \
- -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \
- -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \
- -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
- -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
- -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
- -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
- -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
- -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
- -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
- -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
- -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
- -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
- -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \
- -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \
- -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \
- -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \
- -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \
- -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \
- -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \
- -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \
- -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \
- -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \
- -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \
- -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \
- -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \
- -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \
- -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
- -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \
- -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \
- -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
- -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
- -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GNULIB_MDA_FCLOSEALL)/g' \
- -e 's/@''GNULIB_MDA_FDOPEN''@/$(GNULIB_MDA_FDOPEN)/g' \
- -e 's/@''GNULIB_MDA_FILENO''@/$(GNULIB_MDA_FILENO)/g' \
- -e 's/@''GNULIB_MDA_GETW''@/$(GNULIB_MDA_GETW)/g' \
- -e 's/@''GNULIB_MDA_PUTW''@/$(GNULIB_MDA_PUTW)/g' \
- -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GNULIB_MDA_TEMPNAM)/g' \
+ -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \
+ -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \
+ -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \
+ -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \
+ -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \
+ -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \
+ -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \
+ -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \
+ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \
+ -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \
+ -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \
+ -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \
+ -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \
+ -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \
+ -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \
+ -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \
+ -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \
+ -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \
+ -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \
+ -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \
+ -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \
+ -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \
+ -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \
+ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \
+ -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \
+ -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \
+ -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \
+ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \
+ -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \
+ -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \
+ -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \
+ -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \
+ -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \
+ -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \
+ -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \
+ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \
+ -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
+ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
+ -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \
+ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \
+ -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \
+ -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \
+ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \
+ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \
+ -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \
+ -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \
+ -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \
+ -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \
+ -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \
+ -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \
< $(srcdir)/stdio.in.h | \
sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \
-e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
@@ -2606,51 +2645,51 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
- -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
- -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GNULIB_ALIGNED_ALLOC)/g' \
- -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
- -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
- -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
- -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \
- -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
- -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
- -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
- -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
- -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
- -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
- -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
- -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
- -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
- -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
- -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GNULIB_POSIX_MEMALIGN)/g' \
- -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
- -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
- -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
- -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
- -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
- -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
- -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
- -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
- -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \
- -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
- -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
- -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
- -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
- -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
- -e 's/@''GNULIB_STRTOL''@/$(GNULIB_STRTOL)/g' \
- -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \
- -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
- -e 's/@''GNULIB_STRTOUL''@/$(GNULIB_STRTOUL)/g' \
- -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
- -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
- -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
- -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
- -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
- -e 's/@''GNULIB_MDA_ECVT''@/$(GNULIB_MDA_ECVT)/g' \
- -e 's/@''GNULIB_MDA_FCVT''@/$(GNULIB_MDA_FCVT)/g' \
- -e 's/@''GNULIB_MDA_GCVT''@/$(GNULIB_MDA_GCVT)/g' \
- -e 's/@''GNULIB_MDA_MKTEMP''@/$(GNULIB_MDA_MKTEMP)/g' \
- -e 's/@''GNULIB_MDA_PUTENV''@/$(GNULIB_MDA_PUTENV)/g' \
+ -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \
+ -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \
+ -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \
+ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \
+ -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \
+ -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \
+ -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \
+ -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \
+ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \
+ -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \
+ -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \
+ -e 's/@''GNULIB_MKOSTEMPS''@/$(GL_GNULIB_MKOSTEMPS)/g' \
+ -e 's/@''GNULIB_MKSTEMP''@/$(GL_GNULIB_MKSTEMP)/g' \
+ -e 's/@''GNULIB_MKSTEMPS''@/$(GL_GNULIB_MKSTEMPS)/g' \
+ -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GL_GNULIB_POSIX_MEMALIGN)/g' \
+ -e 's/@''GNULIB_POSIX_OPENPT''@/$(GL_GNULIB_POSIX_OPENPT)/g' \
+ -e 's/@''GNULIB_PTSNAME''@/$(GL_GNULIB_PTSNAME)/g' \
+ -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \
+ -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \
+ -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \
+ -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \
+ -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \
+ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \
+ -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \
+ -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \
+ -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \
+ -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \
+ -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \
+ -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \
+ -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \
+ -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \
+ -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \
+ -e 's/@''GNULIB_STRTOUL''@/$(GL_GNULIB_STRTOUL)/g' \
+ -e 's/@''GNULIB_STRTOULL''@/$(GL_GNULIB_STRTOULL)/g' \
+ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GL_GNULIB_SYSTEM_POSIX)/g' \
+ -e 's/@''GNULIB_UNLOCKPT''@/$(GL_GNULIB_UNLOCKPT)/g' \
+ -e 's/@''GNULIB_UNSETENV''@/$(GL_GNULIB_UNSETENV)/g' \
+ -e 's/@''GNULIB_WCTOMB''@/$(GL_GNULIB_WCTOMB)/g' \
+ -e 's/@''GNULIB_MDA_ECVT''@/$(GL_GNULIB_MDA_ECVT)/g' \
+ -e 's/@''GNULIB_MDA_FCVT''@/$(GL_GNULIB_MDA_FCVT)/g' \
+ -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \
+ -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \
+ -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \
< $(srcdir)/stdlib.in.h | \
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
-e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \
@@ -2711,6 +2750,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
+ -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
-e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \
@@ -2779,49 +2819,49 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
- -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \
- -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
- -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
- -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
- -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
- -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
- -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
- -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
- -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
- -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
- -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
- -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
- -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
- -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
- -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
- -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
- -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
- -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
- -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
- -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
- -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
- -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
- -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
- -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
- -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
- -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
- -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
- -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
- -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
- -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
- -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
- -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
- -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
- -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
- -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
- -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
- -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GNULIB_STRERRORNAME_NP)/g' \
- -e 's/@''GNULIB_SIGABBREV_NP''@/$(GNULIB_SIGABBREV_NP)/g' \
- -e 's/@''GNULIB_SIGDESCR_NP''@/$(GNULIB_SIGDESCR_NP)/g' \
- -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
- -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
- -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GNULIB_MDA_MEMCCPY)/g' \
- -e 's/@''GNULIB_MDA_STRDUP''@/$(GNULIB_MDA_STRDUP)/g' \
+ -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \
+ -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \
+ -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \
+ -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \
+ -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \
+ -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \
+ -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \
+ -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \
+ -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \
+ -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \
+ -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \
+ -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \
+ -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \
+ -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \
+ -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \
+ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \
+ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \
+ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
+ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
+ -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
+ -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \
+ -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \
+ -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \
+ -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
+ -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \
+ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \
+ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \
+ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \
+ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \
+ -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \
+ -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \
+ -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \
+ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \
+ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \
+ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
+ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
+ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
+ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
+ -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \
+ -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \
+ -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \
+ -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \
+ -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \
< $(srcdir)/string.in.h | \
sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \
-e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
@@ -2893,7 +2933,7 @@ sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H)
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
-e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
- -e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
+ -e 's/@''GNULIB_FLOCK''@/$(GL_GNULIB_FLOCK)/g' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/sys_file.in.h; \
} > $@-t && \
@@ -2922,7 +2962,7 @@ sys/random.h: sys_random.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_RANDOM_H''@|$(NEXT_SYS_RANDOM_H)|g' \
-e 's|@''HAVE_SYS_RANDOM_H''@|$(HAVE_SYS_RANDOM_H)|g' \
- -e 's/@''GNULIB_GETRANDOM''@/$(GNULIB_GETRANDOM)/g' \
+ -e 's/@''GNULIB_GETRANDOM''@/$(GL_GNULIB_GETRANDOM)/g' \
-e 's/@''HAVE_GETRANDOM''@/$(HAVE_GETRANDOM)/g' \
-e 's/@''REPLACE_GETRANDOM''@/$(REPLACE_GETRANDOM)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -2955,8 +2995,8 @@ sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
- -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
- -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
+ -e 's/@''GNULIB_PSELECT''@/$(GL_GNULIB_PSELECT)/g' \
+ -e 's/@''GNULIB_SELECT''@/$(GL_GNULIB_SELECT)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
-e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
@@ -2990,22 +3030,22 @@ sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
- -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
- -e 's/@''GNULIB_SOCKET''@/$(GNULIB_SOCKET)/g' \
- -e 's/@''GNULIB_CONNECT''@/$(GNULIB_CONNECT)/g' \
- -e 's/@''GNULIB_ACCEPT''@/$(GNULIB_ACCEPT)/g' \
- -e 's/@''GNULIB_BIND''@/$(GNULIB_BIND)/g' \
- -e 's/@''GNULIB_GETPEERNAME''@/$(GNULIB_GETPEERNAME)/g' \
- -e 's/@''GNULIB_GETSOCKNAME''@/$(GNULIB_GETSOCKNAME)/g' \
- -e 's/@''GNULIB_GETSOCKOPT''@/$(GNULIB_GETSOCKOPT)/g' \
- -e 's/@''GNULIB_LISTEN''@/$(GNULIB_LISTEN)/g' \
- -e 's/@''GNULIB_RECV''@/$(GNULIB_RECV)/g' \
- -e 's/@''GNULIB_SEND''@/$(GNULIB_SEND)/g' \
- -e 's/@''GNULIB_RECVFROM''@/$(GNULIB_RECVFROM)/g' \
- -e 's/@''GNULIB_SENDTO''@/$(GNULIB_SENDTO)/g' \
- -e 's/@''GNULIB_SETSOCKOPT''@/$(GNULIB_SETSOCKOPT)/g' \
- -e 's/@''GNULIB_SHUTDOWN''@/$(GNULIB_SHUTDOWN)/g' \
- -e 's/@''GNULIB_ACCEPT4''@/$(GNULIB_ACCEPT4)/g' \
+ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \
+ -e 's/@''GNULIB_SOCKET''@/$(GL_GNULIB_SOCKET)/g' \
+ -e 's/@''GNULIB_CONNECT''@/$(GL_GNULIB_CONNECT)/g' \
+ -e 's/@''GNULIB_ACCEPT''@/$(GL_GNULIB_ACCEPT)/g' \
+ -e 's/@''GNULIB_BIND''@/$(GL_GNULIB_BIND)/g' \
+ -e 's/@''GNULIB_GETPEERNAME''@/$(GL_GNULIB_GETPEERNAME)/g' \
+ -e 's/@''GNULIB_GETSOCKNAME''@/$(GL_GNULIB_GETSOCKNAME)/g' \
+ -e 's/@''GNULIB_GETSOCKOPT''@/$(GL_GNULIB_GETSOCKOPT)/g' \
+ -e 's/@''GNULIB_LISTEN''@/$(GL_GNULIB_LISTEN)/g' \
+ -e 's/@''GNULIB_RECV''@/$(GL_GNULIB_RECV)/g' \
+ -e 's/@''GNULIB_SEND''@/$(GL_GNULIB_SEND)/g' \
+ -e 's/@''GNULIB_RECVFROM''@/$(GL_GNULIB_RECVFROM)/g' \
+ -e 's/@''GNULIB_SENDTO''@/$(GL_GNULIB_SENDTO)/g' \
+ -e 's/@''GNULIB_SETSOCKOPT''@/$(GL_GNULIB_SETSOCKOPT)/g' \
+ -e 's/@''GNULIB_SHUTDOWN''@/$(GL_GNULIB_SHUTDOWN)/g' \
+ -e 's/@''GNULIB_ACCEPT4''@/$(GL_GNULIB_ACCEPT4)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
@@ -3042,25 +3082,25 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
-e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \
- -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
- -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
- -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
- -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
- -e 's/@''GNULIB_GETUMASK''@/$(GNULIB_GETUMASK)/g' \
- -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
- -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
- -e 's/@''GNULIB_MKDIR''@/$(GNULIB_MKDIR)/g' \
- -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
- -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \
- -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \
- -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \
- -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \
- -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \
- -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \
- -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \
- -e 's/@''GNULIB_MDA_CHMOD''@/$(GNULIB_MDA_CHMOD)/g' \
- -e 's/@''GNULIB_MDA_MKDIR''@/$(GNULIB_MDA_MKDIR)/g' \
- -e 's/@''GNULIB_MDA_UMASK''@/$(GNULIB_MDA_UMASK)/g' \
+ -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \
+ -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \
+ -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \
+ -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \
+ -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \
+ -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \
+ -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \
+ -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \
+ -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \
+ -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \
+ -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \
+ -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \
+ -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \
+ -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \
+ -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \
+ -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \
+ -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \
+ -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \
+ -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
@@ -3114,7 +3154,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
- -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GL_GNULIB_GETTIMEOFDAY)/g' \
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
@@ -3148,7 +3188,7 @@ sys/times.h: sys_times.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TIMES_H''@|$(NEXT_SYS_TIMES_H)|g' \
- -e 's/@''GNULIB_TIMES''@/$(GNULIB_TIMES)/g' \
+ -e 's/@''GNULIB_TIMES''@/$(GL_GNULIB_TIMES)/g' \
-e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
-e 's|@''HAVE_TIMES''@|$(HAVE_TIMES)|g' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -3239,18 +3279,18 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
- -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \
- -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \
- -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
- -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
- -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \
- -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
- -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
- -e 's/@''GNULIB_TIMESPEC_GET''@/$(GNULIB_TIMESPEC_GET)/g' \
- -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
- -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \
- -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \
- -e 's/@''GNULIB_MDA_TZSET''@/$(GNULIB_MDA_TZSET)/g' \
+ -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \
+ -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \
+ -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \
+ -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \
+ -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \
+ -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \
+ -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \
+ -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \
+ -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \
+ -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \
+ -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \
+ -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \
-e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
-e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
@@ -3360,89 +3400,89 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
- -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \
- -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
- -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
- -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
- -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \
- -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \
- -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
- -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
- -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
- -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \
- -e 's/@''GNULIB_EXECL''@/$(GNULIB_EXECL)/g' \
- -e 's/@''GNULIB_EXECLE''@/$(GNULIB_EXECLE)/g' \
- -e 's/@''GNULIB_EXECLP''@/$(GNULIB_EXECLP)/g' \
- -e 's/@''GNULIB_EXECV''@/$(GNULIB_EXECV)/g' \
- -e 's/@''GNULIB_EXECVE''@/$(GNULIB_EXECVE)/g' \
- -e 's/@''GNULIB_EXECVP''@/$(GNULIB_EXECVP)/g' \
- -e 's/@''GNULIB_EXECVPE''@/$(GNULIB_EXECVPE)/g' \
- -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
- -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
- -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
- -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \
- -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
- -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
- -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
- -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
- -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
- -e 's/@''GNULIB_GETENTROPY''@/$(GNULIB_GETENTROPY)/g' \
- -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
- -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
- -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
- -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \
- -e 's/@''GNULIB_GETOPT_POSIX''@/$(GNULIB_GETOPT_POSIX)/g' \
- -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
- -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \
- -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
- -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
- -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
- -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
- -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
- -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
- -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \
- -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \
- -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \
- -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \
- -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \
- -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \
- -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
- -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
- -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
- -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
- -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
- -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
- -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
- -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \
- -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
- -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
- -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
- -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
- -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
- -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \
- -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \
- -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \
- -e 's/@''GNULIB_MDA_ACCESS''@/$(GNULIB_MDA_ACCESS)/g' \
- -e 's/@''GNULIB_MDA_CHDIR''@/$(GNULIB_MDA_CHDIR)/g' \
- -e 's/@''GNULIB_MDA_CLOSE''@/$(GNULIB_MDA_CLOSE)/g' \
- -e 's/@''GNULIB_MDA_DUP''@/$(GNULIB_MDA_DUP)/g' \
- -e 's/@''GNULIB_MDA_DUP2''@/$(GNULIB_MDA_DUP2)/g' \
- -e 's/@''GNULIB_MDA_EXECL''@/$(GNULIB_MDA_EXECL)/g' \
- -e 's/@''GNULIB_MDA_EXECLE''@/$(GNULIB_MDA_EXECLE)/g' \
- -e 's/@''GNULIB_MDA_EXECLP''@/$(GNULIB_MDA_EXECLP)/g' \
- -e 's/@''GNULIB_MDA_EXECV''@/$(GNULIB_MDA_EXECV)/g' \
- -e 's/@''GNULIB_MDA_EXECVE''@/$(GNULIB_MDA_EXECVE)/g' \
- -e 's/@''GNULIB_MDA_EXECVP''@/$(GNULIB_MDA_EXECVP)/g' \
- -e 's/@''GNULIB_MDA_EXECVPE''@/$(GNULIB_MDA_EXECVPE)/g' \
- -e 's/@''GNULIB_MDA_GETCWD''@/$(GNULIB_MDA_GETCWD)/g' \
- -e 's/@''GNULIB_MDA_GETPID''@/$(GNULIB_MDA_GETPID)/g' \
- -e 's/@''GNULIB_MDA_ISATTY''@/$(GNULIB_MDA_ISATTY)/g' \
- -e 's/@''GNULIB_MDA_LSEEK''@/$(GNULIB_MDA_LSEEK)/g' \
- -e 's/@''GNULIB_MDA_READ''@/$(GNULIB_MDA_READ)/g' \
- -e 's/@''GNULIB_MDA_RMDIR''@/$(GNULIB_MDA_RMDIR)/g' \
- -e 's/@''GNULIB_MDA_SWAB''@/$(GNULIB_MDA_SWAB)/g' \
- -e 's/@''GNULIB_MDA_UNLINK''@/$(GNULIB_MDA_UNLINK)/g' \
- -e 's/@''GNULIB_MDA_WRITE''@/$(GNULIB_MDA_WRITE)/g' \
+ -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \
+ -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \
+ -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \
+ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \
+ -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \
+ -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \
+ -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \
+ -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \
+ -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \
+ -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \
+ -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \
+ -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \
+ -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \
+ -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \
+ -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \
+ -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \
+ -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \
+ -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \
+ -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \
+ -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \
+ -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \
+ -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \
+ -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \
+ -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \
+ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \
+ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \
+ -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \
+ -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \
+ -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \
+ -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \
+ -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \
+ -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \
+ -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \
+ -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \
+ -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \
+ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \
+ -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \
+ -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \
+ -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \
+ -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \
+ -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \
+ -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \
+ -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \
+ -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \
+ -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \
+ -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \
+ -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \
+ -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \
+ -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \
+ -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \
+ -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \
+ -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \
+ -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \
+ -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \
+ -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \
+ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_UNISTD_H_GETOPT)/g' \
+ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \
+ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \
+ -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \
+ -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \
+ -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \
+ -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \
+ -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \
+ -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \
+ -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \
+ -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \
+ -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \
+ -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \
+ -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \
+ -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \
+ -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \
+ -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \
+ -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \
+ -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \
+ -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \
+ -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \
+ -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \
+ -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \
+ -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \
+ -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \
+ -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \
+ -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \
+ -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \
< $(srcdir)/unistd.in.h | \
sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
-e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \
@@ -3617,49 +3657,49 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
-e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \
- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
- -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \
- -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \
- -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \
- -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \
- -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \
- -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \
- -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \
- -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \
- -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \
- -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \
- -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \
- -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \
- -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \
- -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \
- -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \
- -e 's/@''GNULIB_WMEMPCPY''@/$(GNULIB_WMEMPCPY)/g' \
- -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \
- -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \
- -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \
- -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \
- -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \
- -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \
- -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \
- -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \
- -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \
- -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \
- -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \
- -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \
- -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \
- -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \
- -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \
- -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \
- -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \
- -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \
- -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \
- -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \
- -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \
- -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \
- -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \
- -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \
- -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \
- -e 's/@''GNULIB_MDA_WCSDUP''@/$(GNULIB_MDA_WCSDUP)/g' \
+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \
+ -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \
+ -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \
+ -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \
+ -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \
+ -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \
+ -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \
+ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \
+ -e 's/@''GNULIB_WCRTOMB''@/$(GL_GNULIB_WCRTOMB)/g' \
+ -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \
+ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \
+ -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \
+ -e 's/@''GNULIB_WMEMCHR''@/$(GL_GNULIB_WMEMCHR)/g' \
+ -e 's/@''GNULIB_WMEMCMP''@/$(GL_GNULIB_WMEMCMP)/g' \
+ -e 's/@''GNULIB_WMEMCPY''@/$(GL_GNULIB_WMEMCPY)/g' \
+ -e 's/@''GNULIB_WMEMMOVE''@/$(GL_GNULIB_WMEMMOVE)/g' \
+ -e 's/@''GNULIB_WMEMPCPY''@/$(GL_GNULIB_WMEMPCPY)/g' \
+ -e 's/@''GNULIB_WMEMSET''@/$(GL_GNULIB_WMEMSET)/g' \
+ -e 's/@''GNULIB_WCSLEN''@/$(GL_GNULIB_WCSLEN)/g' \
+ -e 's/@''GNULIB_WCSNLEN''@/$(GL_GNULIB_WCSNLEN)/g' \
+ -e 's/@''GNULIB_WCSCPY''@/$(GL_GNULIB_WCSCPY)/g' \
+ -e 's/@''GNULIB_WCPCPY''@/$(GL_GNULIB_WCPCPY)/g' \
+ -e 's/@''GNULIB_WCSNCPY''@/$(GL_GNULIB_WCSNCPY)/g' \
+ -e 's/@''GNULIB_WCPNCPY''@/$(GL_GNULIB_WCPNCPY)/g' \
+ -e 's/@''GNULIB_WCSCAT''@/$(GL_GNULIB_WCSCAT)/g' \
+ -e 's/@''GNULIB_WCSNCAT''@/$(GL_GNULIB_WCSNCAT)/g' \
+ -e 's/@''GNULIB_WCSCMP''@/$(GL_GNULIB_WCSCMP)/g' \
+ -e 's/@''GNULIB_WCSNCMP''@/$(GL_GNULIB_WCSNCMP)/g' \
+ -e 's/@''GNULIB_WCSCASECMP''@/$(GL_GNULIB_WCSCASECMP)/g' \
+ -e 's/@''GNULIB_WCSNCASECMP''@/$(GL_GNULIB_WCSNCASECMP)/g' \
+ -e 's/@''GNULIB_WCSCOLL''@/$(GL_GNULIB_WCSCOLL)/g' \
+ -e 's/@''GNULIB_WCSXFRM''@/$(GL_GNULIB_WCSXFRM)/g' \
+ -e 's/@''GNULIB_WCSDUP''@/$(GL_GNULIB_WCSDUP)/g' \
+ -e 's/@''GNULIB_WCSCHR''@/$(GL_GNULIB_WCSCHR)/g' \
+ -e 's/@''GNULIB_WCSRCHR''@/$(GL_GNULIB_WCSRCHR)/g' \
+ -e 's/@''GNULIB_WCSCSPN''@/$(GL_GNULIB_WCSCSPN)/g' \
+ -e 's/@''GNULIB_WCSSPN''@/$(GL_GNULIB_WCSSPN)/g' \
+ -e 's/@''GNULIB_WCSPBRK''@/$(GL_GNULIB_WCSPBRK)/g' \
+ -e 's/@''GNULIB_WCSSTR''@/$(GL_GNULIB_WCSSTR)/g' \
+ -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \
+ -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \
+ -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \
+ -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \
< $(srcdir)/wchar.in.h | \
sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
@@ -3760,14 +3800,14 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \
- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \
- -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
- -e 's/@''GNULIB_ISWDIGIT''@/$(GNULIB_ISWDIGIT)/g' \
- -e 's/@''GNULIB_ISWXDIGIT''@/$(GNULIB_ISWXDIGIT)/g' \
- -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \
- -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \
- -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \
- -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \
+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \
+ -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \
+ -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \
+ -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \
+ -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \
+ -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \
+ -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \
+ -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \
-e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index cb72f2620..6fed3c797 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -29,7 +29,7 @@
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| (!defined __STRICT_ANSI__ \
- && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
+ && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))))
diff --git a/lib/accept.c b/lib/accept.c
index 4ec4f43ea..71457dbf6 100644
--- a/lib/accept.c
+++ b/lib/accept.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/accept4.c b/lib/accept4.c
index b444e2227..4c2b80e50 100644
--- a/lib/accept4.c
+++ b/lib/accept4.c
@@ -1,18 +1,18 @@
/* Accept a connection on a socket, with specific opening flags.
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/alignof.h b/lib/alignof.h
index 6977c3ed2..e6e7a51b2 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -1,18 +1,18 @@
/* Determine alignment of types.
Copyright (C) 2003-2004, 2006, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _ALIGNOF_H
#define _ALIGNOF_H
diff --git a/lib/alloca.c b/lib/alloca.c
index 91b9ec389..48802832a 100644
--- a/lib/alloca.c
+++ b/lib/alloca.c
@@ -1,5 +1,7 @@
/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
+ This file is in the public domain. */
+
+/* (Mostly) portable implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 9c7ccbb64..65c2d4d93 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -3,20 +3,18 @@
Copyright (C) 1995, 1999, 2001-2004, 2006-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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
- <https://www.gnu.org/licenses/>.
- */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 0ac83ab91..9968067aa 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2005-2006, 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index 420440a29..c5367b281 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -1,18 +1,18 @@
/* Formatted output to strings.
Copyright (C) 1999, 2002, 2006, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/assure.h b/lib/assure.h
index d95c0c94f..49aa82fec 100644
--- a/lib/assure.h
+++ b/lib/assure.h
@@ -2,12 +2,12 @@
Copyright (C) 2014-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/attribute.h b/lib/attribute.h
index 27a0fce5f..80a23f550 100644
--- a/lib/attribute.h
+++ b/lib/attribute.h
@@ -2,15 +2,15 @@
Copyright 2020-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
@@ -32,7 +32,7 @@
/* This file defines two types of attributes:
- * C2X standard attributes. These have macro names that do not begin with
+ * C2x standard attributes. These have macro names that do not begin with
'ATTRIBUTE_'.
* Selected GCC attributes; see:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c
index 405edfa35..5dbd15708 100644
--- a/lib/basename-lgpl.c
+++ b/lib/basename-lgpl.c
@@ -3,12 +3,12 @@
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/basename-lgpl.h b/lib/basename-lgpl.h
index 222d21f82..d520c0930 100644
--- a/lib/basename-lgpl.h
+++ b/lib/basename-lgpl.h
@@ -1,20 +1,20 @@
-/* Extract the last component (base name) of a file name.
+/* Extract the last component (base name) of a file name.
- Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation,
- Inc.
+ Copyright (C) 1998, 2001, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 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.
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _BASENAME_LGPL_H
#define _BASENAME_LGPL_H
diff --git a/lib/binary-io.c b/lib/binary-io.c
index 83a820a5d..adc0ae2b0 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -1,12 +1,12 @@
/* Binary mode I/O.
Copyright 2017-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/binary-io.h b/lib/binary-io.h
index 1dfbe5a98..0fa8d546f 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -1,12 +1,12 @@
/* Binary mode I/O.
Copyright (C) 2001, 2003, 2005, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/bind.c b/lib/bind.c
index 87fe0ed11..0e4725446 100644
--- a/lib/bind.c
+++ b/lib/bind.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/btowc.c b/lib/btowc.c
index e800878dd..b8239afae 100644
--- a/lib/btowc.c
+++ b/lib/btowc.c
@@ -2,12 +2,12 @@
Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index c17623888..113f87802 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -2,12 +2,12 @@
Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 5d9d4d87a..300f97c29 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,3 +1,21 @@
+/* Character handling in C locale.
+
+ Copyright (C) 2003-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define C_CTYPE_INLINE _GL_EXTERN_INLINE
#include "c-ctype.h"
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index e8403dbda..3a652ac1f 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -7,18 +7,18 @@
Copyright (C) 2000-2003, 2006, 2008-2021 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 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 <https://www.gnu.org/licenses/>. */
+ 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 <https://www.gnu.org/licenses/>. */
#ifndef C_CTYPE_H
#define C_CTYPE_H
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 8240dbcf4..82f99bb06 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -2,18 +2,18 @@
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef C_STRCASE_H
#define C_STRCASE_H
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index 805dc990b..3c2245508 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,18 +1,18 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h
index ed979aa6c..66b9cf3c1 100644
--- a/lib/c-strcaseeq.h
+++ b/lib/c-strcaseeq.h
@@ -1,15 +1,15 @@
/* Optimized case-insensitive string comparison in C locale.
Copyright (C) 2001-2002, 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index c3203fddf..f3ca786cb 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,18 +1,18 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index c6fef174c..92e963972 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -74,7 +74,6 @@
# define __pathconf pathconf
# define __rawmemchr rawmemchr
# define __readlink readlink
-# define __stat stat
# if IN_RELOCWRAPPER
/* When building the relocatable program wrapper, use the system's memmove
function, not the gnulib override, otherwise we would get a link error.
@@ -105,7 +104,7 @@ file_accessible (char const *file)
return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
# else
struct stat st;
- return __stat (file, &st) == 0 || errno == EOVERFLOW;
+ return stat (file, &st) == 0 || errno == EOVERFLOW;
# endif
}
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 90f97412a..4dac9d264 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -259,9 +259,7 @@
# define __attribute_const__ /* Ignore */
#endif
-#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__
-# define __attribute_maybe_unused__ [[__maybe_unused__]]
-#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ __attribute__ ((__unused__))
#else
# define __attribute_maybe_unused__ /* Ignore */
@@ -320,7 +318,9 @@
#endif
/* The nonnull function attribute marks pointer parameters that
- must not be NULL. */
+ must not be NULL. This has the name __nonnull in glibc,
+ and __attribute_nonnull__ in files shared with Gnulib to avoid
+ collision with a different __nonnull in DragonFlyBSD 5.9. */
#ifndef __attribute_nonnull__
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
@@ -332,6 +332,16 @@
# define __nonnull(params) __attribute_nonnull__ (params)
#endif
+/* The returns_nonnull function attribute marks the return type of the function
+ as always being non-null. */
+#ifndef __returns_nonnull
+# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
+# define __returns_nonnull __attribute__ ((__returns_nonnull__))
+# else
+# define __returns_nonnull
+# endif
+#endif
+
/* If fortification mode, we warn about unused results of certain
function calls which can lead to problems. */
#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__)
@@ -485,9 +495,9 @@
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif
-/* The #ifndef lets Gnulib avoid including these on non-glibc
- platforms, where the includes typically do not exist. */
-#ifndef __WORDSIZE
+/* Gnulib avoids including these, as they don't work on non-glibc or
+ older glibc platforms. */
+#ifndef __GNULIB_CDEFS
# include <bits/wordsize.h>
# include <bits/long-double.h>
#endif
@@ -594,9 +604,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
array according to access mode, or at least one element when
size-index is not provided:
access (access-mode, <ref-index> [, <size-index>]) */
-#define __attr_access(x) __attribute__ ((__access__ x))
+# define __attr_access(x) __attribute__ ((__access__ x))
+# if __GNUC_PREREQ (11, 0)
+# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
+# else
+# define __attr_access_none(argno)
+# endif
#else
# define __attr_access(x)
+# define __attr_access_none(argno)
+#endif
+
+#if __GNUC_PREREQ (11, 0)
+/* Designates dealloc as a function to call to deallocate objects
+ allocated by the declared function. */
+# define __attr_dealloc(dealloc, argno) \
+ __attribute__ ((__malloc__ (dealloc, argno)))
+# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)
+#else
+# define __attr_dealloc(dealloc, argno)
+# define __attr_dealloc_free
#endif
/* Specify that a function such as setjmp or vfork may return
diff --git a/lib/ceil.c b/lib/ceil.c
index 06e7e5e31..fce05d986 100644
--- a/lib/ceil.c
+++ b/lib/ceil.c
@@ -1,12 +1,12 @@
/* Round towards positive infinity.
Copyright (C) 2007, 2010-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/cloexec.c b/lib/cloexec.c
index 1f58b721e..7defa9344 100644
--- a/lib/cloexec.c
+++ b/lib/cloexec.c
@@ -2,20 +2,20 @@
Copyright (C) 1991, 2004-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>.
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
- The code is taken from glibc/manual/llio.texi */
+/* The code is taken from glibc/manual/llio.texi */
#include <config.h>
diff --git a/lib/cloexec.h b/lib/cloexec.h
index 7a71ad4f3..97a3659ef 100644
--- a/lib/cloexec.h
+++ b/lib/cloexec.h
@@ -2,20 +2,18 @@
Copyright (C) 2004, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>.
-
-*/
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdbool.h>
diff --git a/lib/close.c b/lib/close.c
index 11e31dbbf..5b9ab6c9f 100644
--- a/lib/close.c
+++ b/lib/close.c
@@ -1,12 +1,12 @@
/* close replacement.
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/connect.c b/lib/connect.c
index fe0de7e6c..b2b2e9334 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/copysign.c b/lib/copysign.c
index ad5b1020e..fee131be1 100644
--- a/lib/copysign.c
+++ b/lib/copysign.c
@@ -1,12 +1,12 @@
/* Copy sign into another 'double' number.
Copyright (C) 2011-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index a285bdecc..5775edf09 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -1,12 +1,12 @@
/* A GNU-like <dirent.h>.
Copyright (C) 2006-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -74,6 +74,30 @@ typedef struct gl_directory DIR;
/* Declare overridden functions. */
+#if @GNULIB_CLOSEDIR@
+# if @REPLACE_CLOSEDIR@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef closedir
+# define closedir rpl_closedir
+# define GNULIB_defined_closedir 1
+# endif
+_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
+# else
+# if !@HAVE_CLOSEDIR@
+_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
+# endif
+_GL_CXXALIASWARN (closedir);
+#elif defined GNULIB_POSIXCHECK
+# undef closedir
+# if HAVE_RAW_DECL_CLOSEDIR
+_GL_WARN_ON_USE (closedir, "closedir is not portable - "
+ "use gnulib module closedir for portability");
+# endif
+#endif
+
#if @GNULIB_OPENDIR@
# if @REPLACE_OPENDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -81,20 +105,36 @@ typedef struct gl_directory DIR;
# define opendir rpl_opendir
# define GNULIB_defined_opendir 1
# endif
-_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (opendir, DIR *,
+ (const char *dir_name)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
# else
-# if !@HAVE_OPENDIR@
-_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
+# if !@HAVE_OPENDIR@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (opendir, DIR *,
+ (const char *dir_name)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif
_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
# endif
_GL_CXXALIASWARN (opendir);
-#elif defined GNULIB_POSIXCHECK
-# undef opendir
-# if HAVE_RAW_DECL_OPENDIR
+#else
+# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir
+/* For -Wmismatched-dealloc: Associate opendir with closedir or
+ rpl_closedir. */
+_GL_FUNCDECL_SYS (opendir, DIR *,
+ (const char *dir_name)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+# endif
+# if defined GNULIB_POSIXCHECK
+# undef opendir
+# if HAVE_RAW_DECL_OPENDIR
_GL_WARN_ON_USE (opendir, "opendir is not portable - "
"use gnulib module opendir for portability");
+# endif
# endif
#endif
@@ -126,30 +166,6 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
# endif
#endif
-#if @GNULIB_CLOSEDIR@
-# if @REPLACE_CLOSEDIR@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef closedir
-# define closedir rpl_closedir
-# define GNULIB_defined_closedir 1
-# endif
-_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
-# else
-# if !@HAVE_CLOSEDIR@
-_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
-# endif
-_GL_CXXALIASWARN (closedir);
-#elif defined GNULIB_POSIXCHECK
-# undef closedir
-# if HAVE_RAW_DECL_CLOSEDIR
-_GL_WARN_ON_USE (closedir, "closedir is not portable - "
- "use gnulib module closedir for portability");
-# endif
-#endif
-
#if @GNULIB_DIRFD@
/* Return the file descriptor associated with the given directory stream,
or -1 if none exists. */
@@ -200,20 +216,33 @@ _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
# undef fdopendir
# define fdopendir rpl_fdopendir
# endif
-_GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
+_GL_FUNCDECL_RPL (fdopendir, DIR *,
+ (int fd)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
# else
-# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@
-_GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
+# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (fdopendir, DIR *,
+ (int fd)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif
_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
# endif
_GL_CXXALIASWARN (fdopendir);
-#elif defined GNULIB_POSIXCHECK
-# undef fdopendir
-# if HAVE_RAW_DECL_FDOPENDIR
+#else
+# if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir
+/* For -Wmismatched-dealloc: Associate fdopendir with closedir or
+ rpl_closedir. */
+_GL_FUNCDECL_SYS (fdopendir, DIR *,
+ (int fd)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
+# endif
+# if defined GNULIB_POSIXCHECK
+# undef fdopendir
+# if HAVE_RAW_DECL_FDOPENDIR
_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
"use gnulib module fdopendir for portability");
+# endif
# endif
#endif
diff --git a/lib/dirfd.c b/lib/dirfd.c
index 7da640fc6..640cb4ff1 100644
--- a/lib/dirfd.c
+++ b/lib/dirfd.c
@@ -2,12 +2,12 @@
Copyright (C) 2001, 2006, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/dirname-lgpl.c b/lib/dirname-lgpl.c
index 9cc5db75e..95f9c9919 100644
--- a/lib/dirname-lgpl.c
+++ b/lib/dirname-lgpl.c
@@ -3,12 +3,12 @@
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/dirname.h b/lib/dirname.h
index dce18598a..25abc7b7e 100644
--- a/lib/dirname.h
+++ b/lib/dirname.h
@@ -1,26 +1,26 @@
-/* Take file names apart into directory and base names.
+/* Take file names apart into directory and base names.
- Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation,
- Inc.
+ Copyright (C) 1998, 2001, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 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.
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef DIRNAME_H_
# define DIRNAME_H_ 1
# include <stdbool.h>
-# include <stddef.h>
+# include <stdlib.h>
# include "filename.h"
# include "basename-lgpl.h"
@@ -33,11 +33,16 @@ extern "C" {
#endif
# if GNULIB_DIRNAME
-char *base_name (char const *file) _GL_ATTRIBUTE_MALLOC;
-char *dir_name (char const *file);
+char *base_name (char const *file)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_RETURNS_NONNULL;
+char *dir_name (char const *file)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
+ _GL_ATTRIBUTE_RETURNS_NONNULL;
# endif
-char *mdir_name (char const *file);
+char *mdir_name (char const *file)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
bool strip_trailing_slashes (char *file);
diff --git a/lib/dup2.c b/lib/dup2.c
index 653ef8995..53e555213 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -2,12 +2,12 @@
Copyright (C) 1999, 2004-2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/duplocale.c b/lib/duplocale.c
index 430634dbe..bc8740d4f 100644
--- a/lib/duplocale.c
+++ b/lib/duplocale.c
@@ -1,12 +1,12 @@
/* Duplicate a locale object.
Copyright (C) 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/dynarray.h b/lib/dynarray.h
index 5db6ed95b..ec64273b3 100644
--- a/lib/dynarray.h
+++ b/lib/dynarray.h
@@ -1,12 +1,12 @@
/* Type-safe arrays which grow dynamically.
Copyright 2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -257,18 +257,22 @@ static DYNARRAY_ELEMENT *
#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX
-# include <libc-config.h>
+# ifndef _GL_LIKELY
+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */
+# define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
+# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
+# endif
/* Define auxiliary structs and declare auxiliary functions, common to all
instantiations of dynarray. */
-# include <malloc/dynarray.h>
+# include <malloc/dynarray.gl.h>
/* Define the instantiation, specified through
DYNARRAY_STRUCT
DYNARRAY_ELEMENT
DYNARRAY_PREFIX
etc. */
-# include <malloc/dynarray-skeleton.c>
+# include <malloc/dynarray-skeleton.gl.h>
#else
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 0ae2aceca..3cad9e2d6 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ERRNO_H
diff --git a/lib/fcntl.c b/lib/fcntl.c
index e6c4b8e68..c744eb91e 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -2,12 +2,12 @@
Copyright (C) 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 7254a5619..26dedc304 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -2,12 +2,12 @@
Copyright (C) 2006-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/fd-hook.c b/lib/fd-hook.c
index f8e278158..75b1626de 100644
--- a/lib/fd-hook.c
+++ b/lib/fd-hook.c
@@ -2,15 +2,15 @@
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
index 0005db7aa..98e2a5263 100644
--- a/lib/fd-hook.h
+++ b/lib/fd-hook.h
@@ -1,15 +1,15 @@
/* Hook for making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
diff --git a/lib/float+.h b/lib/float+.h
index d814bf196..ad891f65d 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -2,18 +2,18 @@
Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _FLOATPLUS_H
#define _FLOATPLUS_H
diff --git a/lib/float.c b/lib/float.c
index 5c16d6110..dd1e84ad1 100644
--- a/lib/float.c
+++ b/lib/float.c
@@ -2,12 +2,12 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/float.in.h b/lib/float.in.h
index 1179df594..f52aba36e 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -2,12 +2,12 @@
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/floor.c b/lib/floor.c
index 9f13d1631..15303004f 100644
--- a/lib/floor.c
+++ b/lib/floor.c
@@ -1,12 +1,12 @@
/* Round towards negative infinity.
Copyright (C) 2007, 2010-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/free.c b/lib/free.c
index b22124154..780f03dd1 100644
--- a/lib/free.c
+++ b/lib/free.c
@@ -2,12 +2,12 @@
Copyright (C) 2003, 2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/frexp.c b/lib/frexp.c
index 55340b8d4..ab5f34315 100644
--- a/lib/frexp.c
+++ b/lib/frexp.c
@@ -1,12 +1,12 @@
/* Split a double into fraction and mantissa.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/fstat.c b/lib/fstat.c
index 30440d623..512c688c4 100644
--- a/lib/fstat.c
+++ b/lib/fstat.c
@@ -1,12 +1,12 @@
/* fstat() replacement.
Copyright (C) 2011-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/fsync.c b/lib/fsync.c
index 71fcddecc..99a932d77 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -9,15 +9,15 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
- This 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.
+ 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 library is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
diff --git a/lib/full-read.c b/lib/full-read.c
index 32ff1a54a..53be6596a 100644
--- a/lib/full-read.c
+++ b/lib/full-read.c
@@ -1,12 +1,12 @@
/* An interface to read that retries after partial reads and interrupts.
Copyright (C) 2002-2003, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/full-read.h b/lib/full-read.h
index 450d645d1..b36f2e169 100644
--- a/lib/full-read.h
+++ b/lib/full-read.h
@@ -2,12 +2,12 @@
Copyright (C) 2002, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/full-write.c b/lib/full-write.c
index acbfc3121..614ca0b4f 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -2,12 +2,12 @@
Copyright (C) 1993-1994, 1997-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/full-write.h b/lib/full-write.h
index 1220d05de..c316224b4 100644
--- a/lib/full-write.h
+++ b/lib/full-write.h
@@ -2,12 +2,12 @@
Copyright (C) 2002-2003, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 907e8e6da..4874ef5e3 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -3,18 +3,18 @@
This file is part of the GNU C Library.
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 05fc59e8d..0c42d1b7b 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -2,18 +2,18 @@
Copyright (C) 1997, 2001-2002, 2004-2021 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the sa == NULL test below. */
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 918db9dd4..5006c2d5c 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/getlogin.c b/lib/getlogin.c
index 4a7099450..7b78c67ce 100644
--- a/lib/getlogin.c
+++ b/lib/getlogin.c
@@ -2,12 +2,12 @@
Copyright (C) 2010-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/getpeername.c b/lib/getpeername.c
index 5d9cf79ea..468bb3d7c 100644
--- a/lib/getpeername.c
+++ b/lib/getpeername.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/getrandom.c b/lib/getrandom.c
index b467caa7a..a186c4d3b 100644
--- a/lib/getrandom.c
+++ b/lib/getrandom.c
@@ -2,12 +2,12 @@
Copyright 2020-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -178,7 +178,11 @@ getrandom (void *buffer, size_t length, unsigned int flags)
+ (flags & GRND_NONBLOCK ? O_NONBLOCK : 0));
fd = open (randdevice[devrandom], oflags);
if (fd < 0)
- return fd;
+ {
+ if (errno == ENOENT || errno == ENOTDIR)
+ errno = ENOSYS;
+ return -1;
+ }
randfd[devrandom] = fd;
}
diff --git a/lib/getsockname.c b/lib/getsockname.c
index 83c1b7dcf..d1f17b3ed 100644
--- a/lib/getsockname.c
+++ b/lib/getsockname.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/getsockopt.c b/lib/getsockopt.c
index cec49330c..b92d034bb 100644
--- a/lib/getsockopt.c
+++ b/lib/getsockopt.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/gettext.h b/lib/gettext.h
index dd05cdaa5..f1c7a2407 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -2,18 +2,18 @@
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
diff --git a/lib/hard-locale.c b/lib/hard-locale.c
index ab3610d29..8b6802d10 100644
--- a/lib/hard-locale.c
+++ b/lib/hard-locale.c
@@ -3,12 +3,12 @@
Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/hard-locale.h b/lib/hard-locale.h
index c4449f912..eba66018c 100644
--- a/lib/hard-locale.h
+++ b/lib/hard-locale.h
@@ -2,12 +2,12 @@
Copyright (C) 1999, 2003-2004, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/iconv.c b/lib/iconv.c
index f3480aad6..bf5149349 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 1999-2001, 2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index 0fc0fa7c8..3a2f94e75 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ICONV_H
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index bc40feccd..7429b925b 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/iconv_open-aix.gperf b/lib/iconv_open-aix.gperf
index 20ce70a0f..d07375914 100644
--- a/lib/iconv_open-aix.gperf
+++ b/lib/iconv_open-aix.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
%struct-type
diff --git a/lib/iconv_open-hpux.gperf b/lib/iconv_open-hpux.gperf
index 921c722ed..f4664d615 100644
--- a/lib/iconv_open-hpux.gperf
+++ b/lib/iconv_open-hpux.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[9 + 1]; };
%struct-type
diff --git a/lib/iconv_open-irix.gperf b/lib/iconv_open-irix.gperf
index 6241de60d..9885d9278 100644
--- a/lib/iconv_open-irix.gperf
+++ b/lib/iconv_open-irix.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
%struct-type
diff --git a/lib/iconv_open-osf.gperf b/lib/iconv_open-osf.gperf
index 97d570ced..d818d79dc 100644
--- a/lib/iconv_open-osf.gperf
+++ b/lib/iconv_open-osf.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
%struct-type
diff --git a/lib/iconv_open-solaris.gperf b/lib/iconv_open-solaris.gperf
index 0283aba22..648dd3afb 100644
--- a/lib/iconv_open-solaris.gperf
+++ b/lib/iconv_open-solaris.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2009, 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
%struct-type
diff --git a/lib/iconv_open-zos.gperf b/lib/iconv_open-zos.gperf
index faf5d65da..1c3552e0f 100644
--- a/lib/iconv_open-zos.gperf
+++ b/lib/iconv_open-zos.gperf
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2019-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
%struct-type
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 304592ec5..e573556e9 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,18 +1,18 @@
/* Character set conversion.
Copyright (C) 2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/iconveh.h b/lib/iconveh.h
index b2be8fa93..cbf692ebe 100644
--- a/lib/iconveh.h
+++ b/lib/iconveh.h
@@ -2,12 +2,12 @@
Copyright (C) 2001-2007, 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 5b9ea1172..409e88c76 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -2,18 +2,18 @@
Copyright (C) 2005-2006, 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index 57dc7dc40..14e8b0acd 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -2,12 +2,12 @@
Copyright (C) 2006, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index fe0af82f8..41cb4220c 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -2,12 +2,12 @@
Written by Paul Eggert, Bruno Haible, Derek Price.
This file is part of gnulib.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isfinite.c b/lib/isfinite.c
index cfd2d33f0..f1373b90e 100644
--- a/lib/isfinite.c
+++ b/lib/isfinite.c
@@ -1,18 +1,18 @@
/* Test for finite value (zero, subnormal, or normal, and not infinite or NaN).
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2007. */
diff --git a/lib/isinf.c b/lib/isinf.c
index 6d4dfc0ac..62becf22d 100644
--- a/lib/isinf.c
+++ b/lib/isinf.c
@@ -1,18 +1,18 @@
/* Test for positive or negative infinity.
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2008. */
diff --git a/lib/isnan.c b/lib/isnan.c
index 2282269e0..ed3452f90 100644
--- a/lib/isnan.c
+++ b/lib/isnan.c
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h
index fbed47489..df64f4e17 100644
--- a/lib/isnand-nolibm.h
+++ b/lib/isnand-nolibm.h
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnand.c b/lib/isnand.c
index f359130ba..7c5df9072 100644
--- a/lib/isnand.c
+++ b/lib/isnand.c
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h
index ba609d5d3..bd858117b 100644
--- a/lib/isnanf-nolibm.h
+++ b/lib/isnanf-nolibm.h
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnanf.c b/lib/isnanf.c
index 94a32e5a1..3b60340a2 100644
--- a/lib/isnanf.c
+++ b/lib/isnanf.c
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h
index 797c06b43..41fe15699 100644
--- a/lib/isnanl-nolibm.h
+++ b/lib/isnanl-nolibm.h
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/isnanl.c b/lib/isnanl.c
index b4595605f..e8dedf0f4 100644
--- a/lib/isnanl.c
+++ b/lib/isnanl.c
@@ -1,12 +1,12 @@
/* Test for NaN that does not need libm.
Copyright (C) 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/itold.c b/lib/itold.c
index f52216a88..798486636 100644
--- a/lib/itold.c
+++ b/lib/itold.c
@@ -2,12 +2,12 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h
index e8ac12c3c..4873899d8 100644
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -1,18 +1,18 @@
/* Substitute for and wrapper around <langinfo.h>.
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/*
* POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
diff --git a/lib/lc-charset-dispatch.c b/lib/lc-charset-dispatch.c
index 98c6e9de7..88a0bd325 100644
--- a/lib/lc-charset-dispatch.c
+++ b/lib/lc-charset-dispatch.c
@@ -1,12 +1,12 @@
/* Dispatching based on the current locale's character encoding.
Copyright (C) 2018-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/lc-charset-dispatch.h b/lib/lc-charset-dispatch.h
index d9d1ac161..59b485de4 100644
--- a/lib/lc-charset-dispatch.h
+++ b/lib/lc-charset-dispatch.h
@@ -1,12 +1,12 @@
/* Dispatching based on the current locale's character encoding.
Copyright (C) 2018-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/libc-config.h b/lib/libc-config.h
index f14013f7e..886c11f37 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -28,7 +28,10 @@
When compiled as part of glibc this is a no-op; when compiled as
part of Gnulib this includes Gnulib's <config.h> and defines macros
- that glibc library code would normally assume. */
+ that glibc library code would normally assume.
+
+ Note: This header file MUST NOT be included by public header files
+ of Gnulib. */
#include <config.h>
@@ -71,7 +74,7 @@
# endif
#endif
-#ifndef __attribute_maybe_unused__
+#ifndef __attribute_nonnull__
/* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
Prepare to include <cdefs.h>, which is Gnulib's version of a
more-recent glibc <sys/cdefs.h>. */
@@ -80,13 +83,9 @@
# ifndef _FEATURES_H
# define _FEATURES_H 1
# endif
-/* Define __WORDSIZE so that <cdefs.h> does not attempt to include
- nonexistent files. Make it a syntax error, since Gnulib does not
- use __WORDSIZE now, and if Gnulib uses it later the syntax error
- will let us know that __WORDSIZE needs configuring. */
-# ifndef __WORDSIZE
-# define __WORDSIZE %%%
-# endif
+/* Define __GNULIB_CDEFS so that <cdefs.h> does not attempt to include
+ nonexistent files. */
+# define __GNULIB_CDEFS
/* Undef the macros unconditionally defined by our copy of glibc
<sys/cdefs.h>, so that they do not clash with any system-defined
versions. */
@@ -118,6 +117,9 @@
# undef __THROW
# undef __THROWNL
# undef __attr_access
+# undef __attr_access_none
+# undef __attr_dealloc
+# undef __attr_dealloc_free
# undef __attribute__
# undef __attribute_alloc_size__
# undef __attribute_artificial__
diff --git a/lib/libunistring.valgrind b/lib/libunistring.valgrind
index 712c39a9d..9eee19afa 100644
--- a/lib/libunistring.valgrind
+++ b/lib/libunistring.valgrind
@@ -2,18 +2,26 @@
# Copyright (C) 2010-2021 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 of the License, or
-# (at your option) any later version.
+# This file is free software.
+# It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
+# You can redistribute it and/or modify it under either
+# - the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version, or
+# - the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option)
+# any later version, or
+# - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
#
# 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.
+# Lesser General Public License and the GNU 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 <https://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public
+# License and of the GNU General Public License along with this
+# program. If not, see <https://www.gnu.org/licenses/>.
# Suppress a valgrind message about use of uninitialized memory in freea().
# This use is OK because it provides only a speedup.
diff --git a/lib/limits.in.h b/lib/limits.in.h
index 4675ba4b2..2ecafebb0 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -2,18 +2,18 @@
Copyright 2016-2021 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, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -99,10 +99,11 @@
# endif
#endif
-/* Macros specified by ISO/IEC TS 18661-1:2014. */
+/* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */
#if (! defined ULLONG_WIDTH \
- && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \
+ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
@@ -114,7 +115,16 @@
# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
-#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
+#endif
+
+/* Macros specified by C2x. */
+
+#if (! defined BOOL_WIDTH \
+ && (defined _GNU_SOURCE \
+ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
+# define BOOL_MAX 1
+# define BOOL_WIDTH 1
+#endif
#endif /* _@GUARD_PREFIX@_LIMITS_H */
#endif /* _@GUARD_PREFIX@_LIMITS_H */
diff --git a/lib/link.c b/lib/link.c
index 3ba897a8b..bd4bef9f8 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -2,18 +2,18 @@
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/listen.c b/lib/listen.c
index ccf881ca3..a145f82c5 100644
--- a/lib/listen.c
+++ b/lib/listen.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 87a5979a3..9c22050dc 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -2,18 +2,18 @@
Copyright (C) 2000-2006, 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>. */
diff --git a/lib/localcharset.h b/lib/localcharset.h
index c2c1c6783..27c3ab60e 100644
--- a/lib/localcharset.h
+++ b/lib/localcharset.h
@@ -2,18 +2,18 @@
Copyright (C) 2000-2003, 2009-2021 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LOCALCHARSET_H
#define _LOCALCHARSET_H
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 4eb3c80ed..106307069 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -1,12 +1,12 @@
/* A POSIX <locale.h>.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/localeconv.c b/lib/localeconv.c
index cdcaf866c..25e95a112 100644
--- a/lib/localeconv.c
+++ b/lib/localeconv.c
@@ -1,12 +1,12 @@
/* Query locale dependent information for formatting numbers.
Copyright (C) 2012-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/log.c b/lib/log.c
index 03e9ac97d..3f142e88d 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -1,12 +1,12 @@
/* Logarithm.
Copyright (C) 2012-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/log1p.c b/lib/log1p.c
index 0e514984c..c45c6ff34 100644
--- a/lib/log1p.c
+++ b/lib/log1p.c
@@ -1,12 +1,12 @@
/* Natural logarithm of 1 plus argument.
Copyright (C) 2012-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/lstat.c b/lib/lstat.c
index d414d3af7..7de0bf102 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -2,12 +2,12 @@
Copyright (C) 1997-2006, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/malloc.c b/lib/malloc.c
index 6bbb97dc2..0d8b3596c 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -2,61 +2,50 @@
Copyright (C) 1997-1998, 2006-2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
-/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
-#ifdef malloc
-# define NEED_MALLOC_GNU 1
-# undef malloc
-/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
-#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
-# define NEED_MALLOC_GNU 1
-#endif
#include <stdlib.h>
-/* A function definition is only needed if NEED_MALLOC_GNU is defined above
- or if the module 'malloc-posix' requests it. */
-#if NEED_MALLOC_GNU || (GNULIB_MALLOC_POSIX && !HAVE_MALLOC_POSIX)
+#include <errno.h>
-# include <errno.h>
+#include "xalloc-oversized.h"
-/* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
+/* Allocate an N-byte block of memory from the heap, even if N is 0. */
void *
rpl_malloc (size_t n)
{
- void *result;
-
-# if NEED_MALLOC_GNU
if (n == 0)
n = 1;
-# endif
- result = malloc (n);
+ if (xalloc_oversized (n, 1))
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ void *result = malloc (n);
-# if !HAVE_MALLOC_POSIX
+#if !HAVE_MALLOC_POSIX
if (result == NULL)
errno = ENOMEM;
-# endif
+#endif
return result;
}
-
-#endif
diff --git a/lib/malloc/dynarray_at_failure.c b/lib/malloc/dynarray_at_failure.c
index 4f840db7c..8dd685078 100644
--- a/lib/malloc/dynarray_at_failure.c
+++ b/lib/malloc/dynarray_at_failure.c
@@ -18,11 +18,11 @@
#ifndef _LIBC
# include <libc-config.h>
+# include <stdlib.h>
#endif
#include <dynarray.h>
#include <stdio.h>
-#include <stdlib.h>
void
__libc_dynarray_at_failure (size_t size, size_t index)
@@ -32,6 +32,7 @@ __libc_dynarray_at_failure (size_t size, size_t index)
__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
diff --git a/lib/malloca.c b/lib/malloca.c
index a546b306a..b4884234a 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -2,18 +2,18 @@
Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003, 2018.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
@@ -21,6 +21,8 @@
/* Specification. */
#include "malloca.h"
+#include "idx.h"
+#include "intprops.h"
#include "verify.h"
/* The speed critical point in this file is freea() applied to an alloca()
@@ -45,24 +47,30 @@ mmalloca (size_t n)
#if HAVE_ALLOCA
/* Allocate one more word, used to determine the address to pass to freea(),
and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */
- size_t nplus = n + sizeof (small_t) + 2 * sa_alignment_max - 1;
-
- if (nplus >= n)
+ uintptr_t alignment2_mask = 2 * sa_alignment_max - 1;
+ int plus = sizeof (small_t) + alignment2_mask;
+ idx_t nplus;
+ if (!INT_ADD_WRAPV (n, plus, &nplus) && !xalloc_oversized (nplus, 1))
{
char *mem = (char *) malloc (nplus);
if (mem != NULL)
{
- char *p =
- (char *)((((uintptr_t)mem + sizeof (small_t) + sa_alignment_max - 1)
- & ~(uintptr_t)(2 * sa_alignment_max - 1))
- + sa_alignment_max);
+ uintptr_t umem = (uintptr_t)mem, umemplus;
+ /* The INT_ADD_WRAPV avoids signed integer overflow on
+ theoretical platforms where UINTPTR_MAX <= INT_MAX. */
+ INT_ADD_WRAPV (umem, sizeof (small_t) + sa_alignment_max - 1,
+ &umemplus);
+ idx_t offset = ((umemplus & ~alignment2_mask)
+ + sa_alignment_max - umem);
+ void *vp = mem + offset;
+ small_t *p = vp;
/* Here p >= mem + sizeof (small_t),
and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1
hence p + n <= mem + nplus.
So, the memory range [p, p+n) lies in the allocated memory range
[mem, mem + nplus). */
- ((small_t *) p)[-1] = p - mem;
+ p[-1] = offset;
/* p ≡ sa_alignment_max mod 2*sa_alignment_max. */
return p;
}
diff --git a/lib/malloca.h b/lib/malloca.h
index 9cf7fbb52..7eb63d2a7 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -2,18 +2,18 @@
Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _MALLOCA_H
#define _MALLOCA_H
@@ -51,6 +51,13 @@ extern "C" {
# define safe_alloca(N) ((void) (N), NULL)
#endif
+/* Free a block of memory allocated through malloca(). */
+#if HAVE_ALLOCA
+extern void freea (void *p);
+#else
+# define freea free
+#endif
+
/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of
memory allocated on the stack, that must be freed using freea() before
the function returns. Upon failure, it returns NULL. */
@@ -65,21 +72,16 @@ extern "C" {
# define malloca(N) \
mmalloca (N)
#endif
-extern void * mmalloca (size_t n);
-
-/* Free a block of memory allocated through malloca(). */
-#if HAVE_ALLOCA
-extern void freea (void *p);
-#else
-# define freea free
-#endif
+extern void *mmalloca (size_t n)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (freea, 1)
+ _GL_ATTRIBUTE_ALLOC_SIZE ((1));
/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S).
It allocates an array of N objects, each with S bytes of memory,
- on the stack. S must be positive and N must be nonnegative.
- Either N or S should be of type ptrdiff_t or size_t or wider.
+ on the stack. N and S should be nonnegative and free of side effects.
The array must be freed using freea() before the function returns. */
-#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s)))
+#define nmalloca(n, s) \
+ (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s)))
#ifdef __cplusplus
diff --git a/lib/math.c b/lib/math.c
index ba2a6abd6..3ffd1d728 100644
--- a/lib/math.c
+++ b/lib/math.c
@@ -1,4 +1,22 @@
+/* Inline functions for <math.h>.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define _GL_MATH_INLINE _GL_EXTERN_INLINE
#include "math.h"
typedef int dummy;
diff --git a/lib/math.in.h b/lib/math.in.h
index d80047cd6..6a055fbf5 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2,12 +2,12 @@
Copyright (C) 2002-2003, 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbrtowc-impl-utf8.h b/lib/mbrtowc-impl-utf8.h
index ea5ef1fe5..330fb1051 100644
--- a/lib/mbrtowc-impl-utf8.h
+++ b/lib/mbrtowc-impl-utf8.h
@@ -1,12 +1,12 @@
/* Convert multibyte character to wide character.
Copyright (C) 1999-2002, 2005-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbrtowc-impl.h b/lib/mbrtowc-impl.h
index f7e28fce9..bc3e68823 100644
--- a/lib/mbrtowc-impl.h
+++ b/lib/mbrtowc-impl.h
@@ -1,12 +1,12 @@
/* Convert multibyte character to wide character.
Copyright (C) 1999-2002, 2005-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 0db510470..8832f6e80 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -2,12 +2,12 @@
Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index 7ca8df75c..f44015534 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbtowc-impl.h b/lib/mbtowc-impl.h
index 01342af50..30d715d6a 100644
--- a/lib/mbtowc-impl.h
+++ b/lib/mbtowc-impl.h
@@ -2,12 +2,12 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbtowc-lock.c b/lib/mbtowc-lock.c
index ce7479363..0f7ae6c21 100644
--- a/lib/mbtowc-lock.c
+++ b/lib/mbtowc-lock.c
@@ -1,12 +1,12 @@
/* Return the internal lock used by mbrtowc and mbrtoc32.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h
index 093951713..d31b0b6c7 100644
--- a/lib/mbtowc-lock.h
+++ b/lib/mbtowc-lock.h
@@ -1,12 +1,12 @@
/* Use the internal lock used by mbrtowc and mbrtoc32.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mbtowc.c b/lib/mbtowc.c
index 27111944c..47b431a42 100644
--- a/lib/mbtowc.c
+++ b/lib/mbtowc.c
@@ -2,12 +2,12 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/memchr.c b/lib/memchr.c
index d8feb192f..56fd59d79 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -7,21 +7,21 @@
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
and implemented by Roland McGrath (roland@ai.mit.edu).
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ NOTE: The canonical source of this file is maintained with the GNU C Library.
+ Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-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 3 of the License, or any
-later version.
+ 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 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.
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/lib/memchr.valgrind b/lib/memchr.valgrind
index 034d1ee76..4f16481ce 100644
--- a/lib/memchr.valgrind
+++ b/lib/memchr.valgrind
@@ -2,12 +2,12 @@
# Copyright (C) 2009-2021 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 3 of the License, or
-# (at your option) any later version.
+# 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 program is distributed in the hope that it will be useful,
+# 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.
diff --git a/lib/mempcpy.c b/lib/mempcpy.c
index c80e119f7..cacacdbc6 100644
--- a/lib/mempcpy.c
+++ b/lib/mempcpy.c
@@ -1,18 +1,18 @@
/* Copy memory area and return pointer after last written byte.
Copyright (C) 2003, 2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/minmax.h b/lib/minmax.h
index 7d0b67255..a03361baf 100644
--- a/lib/minmax.h
+++ b/lib/minmax.h
@@ -2,18 +2,18 @@
Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _MINMAX_H
#define _MINMAX_H
diff --git a/lib/mkdir.c b/lib/mkdir.c
index 453e428d3..2766cc786 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -3,12 +3,12 @@
Copyright (C) 2001, 2003, 2006, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/mkostemp.c b/lib/mkostemp.c
index cfab63555..285f1badf 100644
--- a/lib/mkostemp.c
+++ b/lib/mkostemp.c
@@ -2,12 +2,12 @@
Foundation, Inc.
This file is derived from the one in the GNU C Library.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/msvc-inval.c b/lib/msvc-inval.c
index de6ebee3f..a23dac958 100644
--- a/lib/msvc-inval.c
+++ b/lib/msvc-inval.c
@@ -1,18 +1,18 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h
index 0d418e1f1..e115a3514 100644
--- a/lib/msvc-inval.h
+++ b/lib/msvc-inval.h
@@ -1,18 +1,18 @@
/* Invalid parameter handler for MSVC runtime libraries.
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _MSVC_INVAL_H
#define _MSVC_INVAL_H
diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c
index e72dabe0d..d3c1f54be 100644
--- a/lib/msvc-nothrow.c
+++ b/lib/msvc-nothrow.c
@@ -2,18 +2,18 @@
with MSVC runtime libraries.
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h
index a56cd4eaa..057b5dd8e 100644
--- a/lib/msvc-nothrow.h
+++ b/lib/msvc-nothrow.h
@@ -2,18 +2,18 @@
with MSVC runtime libraries.
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _MSVC_NOTHROW_H
#define _MSVC_NOTHROW_H
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 6bcaf1a22..eb5c960ba 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Simon Josefsson.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <netdb.h>.
It is intended to provide definitions and prototypes needed by an
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index 3c1cad68e..21f3a64f9 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -1,18 +1,18 @@
/* Substitute for <netinet/in.h>.
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_NETINET_IN_H
diff --git a/lib/nl_langinfo-lock.c b/lib/nl_langinfo-lock.c
index 915c38bc7..fcdf56dc6 100644
--- a/lib/nl_langinfo-lock.c
+++ b/lib/nl_langinfo-lock.c
@@ -1,12 +1,12 @@
/* Return the internal lock used by nl_langinfo.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c
index e8f3cef46..b481f209d 100644
--- a/lib/nl_langinfo.c
+++ b/lib/nl_langinfo.c
@@ -2,12 +2,12 @@
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/nproc.c b/lib/nproc.c
index fef1f8b20..e3ddb9288 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -2,18 +2,18 @@
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */
diff --git a/lib/nproc.h b/lib/nproc.h
index cd3ed365d..d7659a5ca 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -2,18 +2,18 @@
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 7ef75290b..7f258e872 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -1,19 +1,18 @@
/* Copyright (C) 1991-2021 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.
+ 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 3 of the
+ License, or (at your option) any later version.
- The GNU C Library is distributed in the hope that it will be useful,
+ 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.
+ 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
- <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifdef _LIBC
# define USE_IN_EXTENDED_LOCALE_MODEL 1
diff --git a/lib/open.c b/lib/open.c
index 5dc117eeb..372cda881 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -1,12 +1,12 @@
/* Open a descriptor to a file.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/pathmax.h b/lib/pathmax.h
index 4af7802fd..716f4a9aa 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -2,18 +2,18 @@
Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _PATHMAX_H
# define _PATHMAX_H
diff --git a/lib/pipe.c b/lib/pipe.c
index 3316cebd0..fc978f2eb 100644
--- a/lib/pipe.c
+++ b/lib/pipe.c
@@ -1,18 +1,18 @@
/* Create a pipe.
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/pipe2.c b/lib/pipe2.c
index 25bce6ff4..9ba8c3b70 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -1,18 +1,18 @@
/* Create a pipe, with specific opening flags.
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/poll.c b/lib/poll.c
index d7876760c..8d5ba9655 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -5,18 +5,18 @@
This file is part of gnulib.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Tell gcc not to warn about the (nfd < 0) tests, below. */
#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
diff --git a/lib/poll.in.h b/lib/poll.in.h
index 1fe83706f..e94cd31de 100644
--- a/lib/poll.in.h
+++ b/lib/poll.in.h
@@ -5,18 +5,18 @@
This file is part of gnulib.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_POLL_H
diff --git a/lib/printf-args.c b/lib/printf-args.c
index 22e44ef16..b822682c3 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -2,18 +2,18 @@
Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
diff --git a/lib/printf-args.h b/lib/printf-args.h
index d15b12d1f..c8d91747b 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -2,18 +2,18 @@
Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _PRINTF_ARGS_H
#define _PRINTF_ARGS_H
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 9f9799528..f21cc17c0 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,18 +1,18 @@
/* Formatted output to strings.
Copyright (C) 1999-2000, 2002-2003, 2006-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
CHAR_T The element type of the format string.
@@ -48,16 +48,7 @@
#include <stddef.h>
/* Get intmax_t. */
-#if defined IN_LIBINTL || defined IN_LIBASPRINTF
-# if HAVE_STDINT_H_WITH_UINTMAX
-# include <stdint.h>
-# endif
-# if HAVE_INTTYPES_H_WITH_UINTMAX
-# include <inttypes.h>
-# endif
-#else
-# include <stdint.h>
-#endif
+#include <stdint.h>
/* malloc(), realloc(), free(). */
#include <stdlib.h>
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index e05ac8f59..77b74093c 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -2,18 +2,18 @@
Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _PRINTF_PARSE_H
#define _PRINTF_PARSE_H
diff --git a/lib/putenv.c b/lib/putenv.c
index d342b8153..435d10fdc 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -4,12 +4,12 @@
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- 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 3 of the License, or any
- later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/raise.c b/lib/raise.c
index eda9126b7..37c100dd8 100644
--- a/lib/raise.c
+++ b/lib/raise.c
@@ -2,12 +2,12 @@
Copyright (C) 2002-2003, 2005-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
index ef356895e..896d435af 100644
--- a/lib/rawmemchr.c
+++ b/lib/rawmemchr.c
@@ -1,12 +1,12 @@
/* Searching in a string.
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/rawmemchr.valgrind b/lib/rawmemchr.valgrind
index 90ed95e1d..d489c320c 100644
--- a/lib/rawmemchr.valgrind
+++ b/lib/rawmemchr.valgrind
@@ -2,12 +2,12 @@
# Copyright (C) 2008-2021 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 3 of the License, or
-# (at your option) any later version.
+# 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 program is distributed in the hope that it will be useful,
+# 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.
diff --git a/lib/read.c b/lib/read.c
index 125e73874..840d9ed5a 100644
--- a/lib/read.c
+++ b/lib/read.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/readlink.c b/lib/readlink.c
index 38d9e0c6b..d4f4b08e9 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,12 +1,12 @@
/* Read the contents of a symbolic link.
Copyright (C) 2003-2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/realloc.c b/lib/realloc.c
index 114551498..af03f0c57 100644
--- a/lib/realloc.c
+++ b/lib/realloc.c
@@ -3,12 +3,12 @@
Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -18,68 +18,46 @@
/* written by Jim Meyering and Bruno Haible */
-#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
-/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
-#ifdef realloc
-# define NEED_REALLOC_GNU 1
-/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */
-#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
-# define NEED_REALLOC_GNU 1
-#endif
-
-/* Infer the properties of the system's malloc function.
- The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
-#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
-# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
-#endif
-
#include <stdlib.h>
-/* A function definition is only needed if NEED_REALLOC_GNU is defined above
- or if the module 'realloc-posix' requests it. */
-#if NEED_REALLOC_GNU || (GNULIB_REALLOC_POSIX && !HAVE_REALLOC_POSIX)
+#include <errno.h>
+
+#include "xalloc-oversized.h"
-# include <errno.h>
+/* Call the system's realloc below. This file does not define
+ _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */
+#undef realloc
/* Change the size of an allocated block of memory P to N bytes,
- with error checking. If N is zero, change it to 1. If P is NULL,
- use malloc. */
+ with error checking. If P is NULL, use malloc. Otherwise if N is zero,
+ free P and return NULL. */
void *
rpl_realloc (void *p, size_t n)
{
- void *result;
+ if (p == NULL)
+ return malloc (n);
-# if NEED_REALLOC_GNU
if (n == 0)
{
- n = 1;
-
- /* In theory realloc might fail, so don't rely on it to free. */
free (p);
- p = NULL;
+ return NULL;
}
-# endif
- if (p == NULL)
+ if (xalloc_oversized (n, 1))
{
-# if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
- if (n == 0)
- n = 1;
-# endif
- result = malloc (n);
+ errno = ENOMEM;
+ return NULL;
}
- else
- result = realloc (p, n);
-# if !HAVE_REALLOC_POSIX
+ void *result = realloc (p, n);
+
+#if !HAVE_MALLOC_POSIX
if (result == NULL)
errno = ENOMEM;
-# endif
+#endif
return result;
}
-
-#endif
diff --git a/lib/recv.c b/lib/recv.c
index f2a342f7d..3eb2b4d4b 100644
--- a/lib/recv.c
+++ b/lib/recv.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/recvfrom.c b/lib/recvfrom.c
index 8abda0c69..25231ffe1 100644
--- a/lib/recvfrom.c
+++ b/lib/recvfrom.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 55f6b66de..aefcfa2f5 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1211,6 +1211,10 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
if (__glibc_unlikely (dest->nelem == 0))
{
+ /* Although we already guaranteed above that dest->alloc != 0 and
+ therefore dest->elems != NULL, add a debug assertion to pacify
+ GCC 11.2.1's -fanalyzer. */
+ DEBUG_ASSERT (dest->elems);
dest->nelem = src->nelem;
memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
return REG_NOERROR;
@@ -1286,7 +1290,10 @@ re_node_set_insert (re_node_set *set, Idx elem)
if (__glibc_unlikely (set->nelem) == 0)
{
- /* We already guaranteed above that set->alloc != 0. */
+ /* Although we already guaranteed above that set->alloc != 0 and
+ therefore set->elems != NULL, add a debug assertion to pacify
+ GCC 11.2 -fanalyzer. */
+ DEBUG_ASSERT (set->elems);
set->elems[0] = elem;
++set->nelem;
return true;
diff --git a/lib/regexec.c b/lib/regexec.c
index 6309deac8..5e4eb497a 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1220,9 +1220,13 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
{
re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes;
re_node_set *edests = &dfa->edests[node];
- bool ok = re_node_set_insert (eps_via_nodes, node);
- if (__glibc_unlikely (! ok))
- return -2;
+
+ if (! re_node_set_contains (eps_via_nodes, node))
+ {
+ bool ok = re_node_set_insert (eps_via_nodes, node);
+ if (__glibc_unlikely (! ok))
+ return -2;
+ }
/* Pick a valid destination, or return -1 if none is found. */
Idx dest_node = -1;
@@ -1414,7 +1418,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch);
if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node)
- || re_node_set_contains (&eps_via_nodes, cur_node))
+ || (fs && re_node_set_contains (&eps_via_nodes, cur_node)))
{
Idx reg_idx;
cur_node = -1;
diff --git a/lib/rename.c b/lib/rename.c
index 487302543..a3b7dc641 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -2,12 +2,12 @@
Copyright (C) 2001-2003, 2005-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/rmdir.c b/lib/rmdir.c
index a99fb1ee7..6295e4125 100644
--- a/lib/rmdir.c
+++ b/lib/rmdir.c
@@ -3,12 +3,12 @@
Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/round.c b/lib/round.c
index 47a393658..552505042 100644
--- a/lib/round.c
+++ b/lib/round.c
@@ -1,18 +1,18 @@
/* Round toward nearest, breaking ties away from zero.
Copyright (C) 2007, 2010-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2007.
Based heavily on code by Bruno Haible. */
diff --git a/lib/safe-read.c b/lib/safe-read.c
index a4a1b089d..e187b1258 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -3,12 +3,12 @@
Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/safe-read.h b/lib/safe-read.h
index 50501245f..111aff5c4 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -1,12 +1,12 @@
/* An interface to read() that retries after interrupts.
Copyright (C) 2002, 2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/safe-write.c b/lib/safe-write.c
index f8b3b8b2d..494de1495 100644
--- a/lib/safe-write.c
+++ b/lib/safe-write.c
@@ -1,12 +1,12 @@
/* An interface to write that retries after interrupts.
Copyright (C) 2002, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/safe-write.h b/lib/safe-write.h
index 459629e1a..25d8c710c 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -1,12 +1,12 @@
/* An interface to write() that retries after interrupts.
Copyright (C) 2002, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/same-inode.h b/lib/same-inode.h
index 45e322a84..c7277779a 100644
--- a/lib/same-inode.h
+++ b/lib/same-inode.h
@@ -2,12 +2,12 @@
Copyright (C) 2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h
index 4b17f72ea..88735771d 100644
--- a/lib/scratch_buffer.h
+++ b/lib/scratch_buffer.h
@@ -1,12 +1,12 @@
/* Variable-sized buffer with on-stack default allocation.
Copyright (C) 2017-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -110,14 +110,18 @@ extern void *scratch_buffer_dupfree (struct scratch_buffer *buffer,
/* The implementation is imported from glibc. */
-#include <libc-config.h>
-
/* Avoid possible conflicts with symbols exported by the GNU libc. */
#define __libc_scratch_buffer_dupfree gl_scratch_buffer_dupfree
#define __libc_scratch_buffer_grow gl_scratch_buffer_grow
#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
-#include <malloc/scratch_buffer.h>
+#ifndef _GL_LIKELY
+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */
+# define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
+# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
+#endif
+
+#include <malloc/scratch_buffer.gl.h>
#endif /* _GL_SCRATCH_BUFFER_H */
diff --git a/lib/select.c b/lib/select.c
index 9a6fc2804..eddac4b61 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -5,18 +5,18 @@
This file is part of gnulib.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
@@ -530,12 +530,13 @@ restart:
if (h != handle_array[nhandles])
{
/* Perform handle->descriptor mapping. */
- WSAEventSelect ((SOCKET) h, NULL, 0);
- if (FD_ISSET (h, &handle_rfds))
+ SOCKET s = (SOCKET) h;
+ WSAEventSelect (s, NULL, 0);
+ if (FD_ISSET (s, &handle_rfds))
FD_SET (i, rfds);
- if (FD_ISSET (h, &handle_wfds))
+ if (FD_ISSET (s, &handle_wfds))
FD_SET (i, wfds);
- if (FD_ISSET (h, &handle_xfds))
+ if (FD_ISSET (s, &handle_xfds))
FD_SET (i, xfds);
}
else
diff --git a/lib/send.c b/lib/send.c
index 36258642d..58cb70b56 100644
--- a/lib/send.c
+++ b/lib/send.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/sendto.c b/lib/sendto.c
index 5372a6683..029ccd69f 100644
--- a/lib/sendto.c
+++ b/lib/sendto.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/setenv.c b/lib/setenv.c
index 53740447a..3ad3477e9 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -1,12 +1,12 @@
/* Copyright (C) 1992, 1995-2003, 2005-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/setlocale-lock.c b/lib/setlocale-lock.c
index 3cb5d4788..53e231c6c 100644
--- a/lib/setlocale-lock.c
+++ b/lib/setlocale-lock.c
@@ -1,12 +1,12 @@
/* Return the internal lock used by setlocale_null_r.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/setlocale_null.c b/lib/setlocale_null.c
index 4c50472f0..dbfda25c5 100644
--- a/lib/setlocale_null.c
+++ b/lib/setlocale_null.c
@@ -1,12 +1,12 @@
/* Query the name of the current global locale.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/setlocale_null.h b/lib/setlocale_null.h
index bf96fa490..00c42e2aa 100644
--- a/lib/setlocale_null.h
+++ b/lib/setlocale_null.h
@@ -1,12 +1,12 @@
/* Query the name of the current global locale.
Copyright (C) 2019-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/setsockopt.c b/lib/setsockopt.c
index db32996f0..10b1e9061 100644
--- a/lib/setsockopt.c
+++ b/lib/setsockopt.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/shutdown.c b/lib/shutdown.c
index c5527cd86..70c927c6a 100644
--- a/lib/shutdown.c
+++ b/lib/shutdown.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/signal.in.h b/lib/signal.in.h
index b2111372d..275da8c81 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -2,12 +2,12 @@
Copyright (C) 2006-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/signbitd.c b/lib/signbitd.c
index 2992dd47b..22597719f 100644
--- a/lib/signbitd.c
+++ b/lib/signbitd.c
@@ -1,12 +1,12 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
Copyright (C) 2007-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/signbitf.c b/lib/signbitf.c
index 01be49a32..b196d9ab5 100644
--- a/lib/signbitf.c
+++ b/lib/signbitf.c
@@ -1,12 +1,12 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
Copyright (C) 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/signbitl.c b/lib/signbitl.c
index 6e0f64e9b..f73802d1a 100644
--- a/lib/signbitl.c
+++ b/lib/signbitl.c
@@ -1,12 +1,12 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
Copyright (C) 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/size_max.h b/lib/size_max.h
index c6d4a1835..1186ba95d 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -2,18 +2,18 @@
Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc.
Written by Simon Josefsson.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef GNULIB_SIZE_MAX_H
#define GNULIB_SIZE_MAX_H
diff --git a/lib/snprintf.c b/lib/snprintf.c
index 357f287f2..a589cf1a6 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -2,18 +2,18 @@
Copyright (C) 2004, 2006-2021 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/socket.c b/lib/socket.c
index 85252603d..0f2e6ff91 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/sockets.c b/lib/sockets.c
index 394b01ee5..934da73d2 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/sockets.h b/lib/sockets.h
index a13b0cb7a..e70c2bbfd 100644
--- a/lib/sockets.h
+++ b/lib/sockets.h
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/stat-time.c b/lib/stat-time.c
index 81b83ddb4..7b9279269 100644
--- a/lib/stat-time.c
+++ b/lib/stat-time.c
@@ -1,3 +1,21 @@
+/* stat-related time functions.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE
#include "stat-time.h"
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 00c93296b..fe3483d63 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -2,12 +2,12 @@
Copyright (C) 2005, 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/stat-w32.c b/lib/stat-w32.c
index fe505cbdb..4164199b6 100644
--- a/lib/stat-w32.c
+++ b/lib/stat-w32.c
@@ -1,12 +1,12 @@
/* Core of implementation of fstat and stat for native Windows.
Copyright (C) 2017-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/stat-w32.h b/lib/stat-w32.h
index 05c9b0ff5..5b56c09dd 100644
--- a/lib/stat-w32.h
+++ b/lib/stat-w32.h
@@ -1,12 +1,12 @@
/* Core of implementation of fstat and stat for native Windows.
Copyright (C) 2017-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/stat.c b/lib/stat.c
index 39a12691f..bc9a767d3 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,12 +1,12 @@
/* Work around platform bugs in stat.
Copyright (C) 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index 7b51043ec..592d58e37 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -2,18 +2,18 @@
Copyright 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert and Bruno Haible. */
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index c404f8d13..2a1992da8 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,18 +1,18 @@
/* Copyright (C) 2001-2003, 2006-2021 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 4c53e6455..42290d448 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2009-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index a98f1c8cf..85c5418f1 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -2,18 +2,18 @@
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/*
* ISO C 99 <stdint.h> for platforms that lack it.
@@ -85,7 +85,7 @@
/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
wint_t. */
-#if @GNULIB_OVERRIDES_WINT_T@
+#if @GNULIBHEADERS_OVERRIDE_WINT_T@
# undef WINT_MIN
# undef WINT_MAX
# define WINT_MIN 0x0U
@@ -598,7 +598,7 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* wint_t limits */
/* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, @WINT_T_SUFFIX@ is not
accurate, therefore use the definitions from above. */
-# if !@GNULIB_OVERRIDES_WINT_T@
+# if !@GNULIBHEADERS_OVERRIDE_WINT_T@
# undef WINT_MIN
# undef WINT_MAX
# if @HAVE_SIGNED_WINT_T@
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 6e10c742e..f1bf81732 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2004, 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -242,7 +242,7 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
_GL_CXXALIAS_MDA (fcloseall, int, (void));
# else
# if @HAVE_DECL_FCLOSEALL@
-# if defined __FreeBSD__
+# if defined __FreeBSD__ || defined __DragonFly__
_GL_CXXALIAS_SYS (fcloseall, void, (void));
# else
_GL_CXXALIAS_SYS (fcloseall, int, (void));
@@ -260,8 +260,9 @@ _GL_CXXALIASWARN (fcloseall);
# undef fdopen
# define fdopen rpl_fdopen
# endif
-_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
- _GL_ARG_NONNULL ((2)));
+_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)
@@ -270,28 +271,42 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
# 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);
-#elif defined GNULIB_POSIXCHECK
-# undef 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@
+# 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
+# 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
+# else
_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
-# endif
+# endif
_GL_CXXALIASWARN (fdopen);
+# endif
#endif
#if @GNULIB_FFLUSH@
@@ -380,21 +395,35 @@ _GL_CXXALIASWARN (fileno);
# endif
_GL_FUNCDECL_RPL (fopen, FILE *,
(const char *restrict filename, const char *restrict mode)
- _GL_ARG_NONNULL ((1, 2)));
+ _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
-#elif defined GNULIB_POSIXCHECK
-# undef fopen
+#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@
@@ -1009,22 +1038,32 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
# undef popen
# define popen rpl_popen
# endif
-_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
+_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@
-_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
- _GL_ARG_NONNULL ((1, 2)));
+# 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);
-#elif defined GNULIB_POSIXCHECK
-# undef popen
-# if HAVE_RAW_DECL_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
@@ -1257,6 +1296,7 @@ _GL_CXXALIASWARN (scanf);
# 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, ...)
@@ -1302,6 +1342,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# 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)
@@ -1344,19 +1385,32 @@ _GL_CXXALIASWARN (tempnam);
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define tmpfile rpl_tmpfile
# endif
-_GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
+_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
-#elif defined GNULIB_POSIXCHECK
-# undef tmpfile
-# if HAVE_RAW_DECL_TMPFILE
+#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
@@ -1369,6 +1423,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
# 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)
@@ -1390,6 +1445,7 @@ _GL_CXXALIASWARN (asprintf);
# 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)
@@ -1573,6 +1629,7 @@ _GL_CXXALIASWARN (vscanf);
# 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)
@@ -1609,6 +1666,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
# 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)
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 7e012621d..d86a88071 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -2,12 +2,12 @@
Copyright (C) 1995, 2001-2004, 2006-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -149,6 +149,28 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
#endif
+#if @GNULIB_FREE_POSIX@
+# if @REPLACE_FREE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef free
+# define free rpl_free
+# endif
+_GL_FUNCDECL_RPL (free, void, (void *ptr));
+_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@
@@ -156,21 +178,37 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
# undef aligned_alloc
# define aligned_alloc rpl_aligned_alloc
# endif
-_GL_FUNCDECL_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
+_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 @HAVE_ALIGNED_ALLOC@
_GL_CXXALIASWARN (aligned_alloc);
# endif
-#elif defined GNULIB_POSIXCHECK
-# undef aligned_alloc
-# if HAVE_RAW_DECL_ALIGNED_ALLOC
+#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
@@ -198,19 +236,35 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
# undef calloc
# define calloc rpl_calloc
# endif
-_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
+_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
-#elif defined GNULIB_POSIXCHECK
-# undef calloc
+#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@
@@ -218,13 +272,17 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
# 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_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@
-_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
- _GL_ARG_NONNULL ((1)));
+# 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
@@ -233,12 +291,22 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
(!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
# endif
_GL_CXXALIASWARN (canonicalize_file_name);
-#elif defined GNULIB_POSIXCHECK
-# undef canonicalize_file_name
-# if HAVE_RAW_DECL_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
@@ -288,27 +356,6 @@ _GL_CXXALIASWARN (fcvt);
# endif
#endif
-#if @GNULIB_FREE_POSIX@
-# if @REPLACE_FREE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef free
-# define free rpl_free
-# endif
-_GL_FUNCDECL_RPL (free, void, (void *ptr));
-_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
-
#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
@@ -404,19 +451,35 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
# undef malloc
# define malloc rpl_malloc
# endif
-_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
+_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
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef malloc
+#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. */
@@ -1015,29 +1078,53 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
# undef realloc
# define realloc rpl_realloc
# endif
-_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
+_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
-#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
-# undef realloc
+#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 ! @HAVE_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
+# endif
_GL_CXXALIAS_SYS (reallocarray, void *,
(void *ptr, size_t nmemb, size_t size));
+# endif
_GL_CXXALIASWARN (reallocarray);
#elif defined GNULIB_POSIXCHECK
# undef reallocarray
diff --git a/lib/strdup.c b/lib/strdup.c
index 2a3704900..e5d4d75c8 100644
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -3,18 +3,18 @@
This file is part of the GNU C Library.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/lib/streq.h b/lib/streq.h
index 2d9d4c2c6..adabd158e 100644
--- a/lib/streq.h
+++ b/lib/streq.h
@@ -1,15 +1,15 @@
/* Optimized string comparison.
Copyright (C) 2001-2002, 2007, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
+ 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 <https://www.gnu.org/licenses/>. */
diff --git a/lib/strftime.h b/lib/strftime.h
index 645e8c768..790a80ed8 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -2,12 +2,12 @@
Copyright (C) 2002, 2004, 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/striconveh.c b/lib/striconveh.c
index 82f6467ba..78a5e0296 100644
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -2,12 +2,12 @@
Copyright (C) 2001-2021 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/striconveh.h b/lib/striconveh.h
index c9dff1e69..60c632928 100644
--- a/lib/striconveh.h
+++ b/lib/striconveh.h
@@ -2,12 +2,12 @@
Copyright (C) 2001-2007, 2009-2021 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -18,7 +18,7 @@
#ifndef _STRICONVEH_H
#define _STRICONVEH_H
-#include <stddef.h>
+#include <stdlib.h>
#if HAVE_ICONV
#include <iconv.h>
#endif
@@ -95,7 +95,8 @@ extern int
extern char *
str_cd_iconveh (const char *src,
const iconveh_t *cd,
- enum iconv_ilseq_handler handler);
+ enum iconv_ilseq_handler handler)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
#endif
@@ -129,7 +130,8 @@ extern int
extern char *
str_iconveh (const char *src,
const char *from_codeset, const char *to_codeset,
- enum iconv_ilseq_handler handler);
+ enum iconv_ilseq_handler handler)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
#ifdef __cplusplus
diff --git a/lib/string.in.h b/lib/string.in.h
index 1292e29a7..b043c7522 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -2,18 +2,18 @@
Copyright (C) 1995-1996, 2001-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -47,6 +47,9 @@
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
+/* Get free(). */
+#include <stdlib.h>
+
/* MirBSD defines mbslen as a macro. */
#if @GNULIB_MBSLEN@ && defined __MirBSD__
# include <wchar.h>
@@ -418,7 +421,10 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
# undef strdup
# define strdup rpl_strdup
# endif
-_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (strdup, char *,
+ (char const *__s)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -431,35 +437,47 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
/* strdup exists as a function and as a macro. Get rid of the macro. */
# undef strdup
# endif
-# if !(@HAVE_DECL_STRDUP@ || defined strdup)
-_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
+# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup
+_GL_FUNCDECL_SYS (strdup, char *,
+ (char const *__s)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
# endif
_GL_CXXALIASWARN (strdup);
-#elif defined GNULIB_POSIXCHECK
-# undef strdup
-# if HAVE_RAW_DECL_STRDUP
+#else
+# if __GNUC__ >= 11 && !defined strdup
+/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
+_GL_FUNCDECL_SYS (strdup, char *,
+ (char const *__s)
+ _GL_ARG_NONNULL ((1))
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+# endif
+# if defined GNULIB_POSIXCHECK
+# undef strdup
+# if HAVE_RAW_DECL_STRDUP
_GL_WARN_ON_USE (strdup, "strdup is unportable - "
"use gnulib module strdup for portability");
-# endif
-#elif @GNULIB_MDA_STRDUP@
+# endif
+# elif @GNULIB_MDA_STRDUP@
/* On native Windows, map 'creat' to '_creat', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between
- platforms by defining GNULIB_NAMESPACE::creat always. */
-# if defined _WIN32 && !defined __CYGWIN__
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef strdup
-# define strdup _strdup
-# endif
+ platforms by defining GNULIB_NAMESPACE::strdup always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strdup
+# define strdup _strdup
+# endif
_GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
-# else
-# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
-# undef strdup
-# endif
+# else
+# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+# undef strdup
+# endif
_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
-# endif
+# endif
_GL_CXXALIASWARN (strdup);
+# endif
#endif
/* Append no more than N characters from SRC onto DEST. */
diff --git a/lib/stripslash.c b/lib/stripslash.c
index b0797959f..99bfbe66b 100644
--- a/lib/stripslash.c
+++ b/lib/stripslash.c
@@ -3,12 +3,12 @@
Copyright (C) 1990, 2001, 2003-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/sys-limits.h b/lib/sys-limits.h
index 1856e7f82..2d9784d1b 100644
--- a/lib/sys-limits.h
+++ b/lib/sys-limits.h
@@ -2,18 +2,18 @@
Copyright 2018-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GL_SYS_LIMITS_H
#define _GL_SYS_LIMITS_H
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index e18594fda..41660822b 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Richard W.M. Jones. */
diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h
index 1a479e967..1abd6c544 100644
--- a/lib/sys_random.in.h
+++ b/lib/sys_random.in.h
@@ -1,18 +1,18 @@
/* Substitute for <sys/random.h>.
Copyright (C) 2020-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index d82c5d18a..f8ef648d4 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -1,18 +1,18 @@
/* Substitute for <sys/select.h>.
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/sys_socket.c b/lib/sys_socket.c
index 3b261da03..d90b32c97 100644
--- a/lib/sys_socket.c
+++ b/lib/sys_socket.c
@@ -1,4 +1,22 @@
+/* Inline functions for <sys/socket.h>.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
#include "sys/socket.h"
typedef int dummy;
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index c0baa71c0..0a2c57db5 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -3,18 +3,18 @@
Copyright (C) 2005-2021 Free Software Foundation, Inc.
Written by Simon Josefsson.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <sys/socket.h>,
on platforms where <sys/socket.h> cannot be included standalone, and on
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 125aca0d3..babe3dba3 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,18 +1,18 @@
/* Provide a more complete sys/stat.h header file.
Copyright (C) 2005-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index f310ca5e8..8035fbe7e 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
diff --git a/lib/sys_times.in.h b/lib/sys_times.in.h
index 3d96200a7..85b728f00 100644
--- a/lib/sys_times.in.h
+++ b/lib/sys_times.in.h
@@ -1,18 +1,18 @@
/* Provide a sys/times.h header file.
Copyright (C) 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 26e7db73f..2079d72ef 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
index 1941360cc..507ab011b 100644
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -1,18 +1,18 @@
/* Substitute for <sys/uio.h>.
Copyright (C) 2011-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/tempname.h b/lib/tempname.h
index c91a58d83..795bb4976 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -2,12 +2,12 @@
Copyright (C) 2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/time-internal.h b/lib/time-internal.h
index b86b7a012..6bbd0a727 100644
--- a/lib/time-internal.h
+++ b/lib/time-internal.h
@@ -2,18 +2,18 @@
Copyright 2015-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
diff --git a/lib/time.in.h b/lib/time.in.h
index cbd2bbaf7..a73fe59cb 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/time_r.c b/lib/time_r.c
index 2510c4eb2..88d3c1c76 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -2,18 +2,18 @@
Copyright (C) 2003, 2006-2007, 2010-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
diff --git a/lib/time_rz.c b/lib/time_rz.c
index d32cce796..e7722447c 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -2,18 +2,18 @@
Copyright 2015-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
diff --git a/lib/times.c b/lib/times.c
index b8afa6092..72b852e58 100644
--- a/lib/times.c
+++ b/lib/times.c
@@ -2,18 +2,18 @@
Copyright (C) 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
diff --git a/lib/trunc.c b/lib/trunc.c
index cf2adac4b..1c9c420af 100644
--- a/lib/trunc.c
+++ b/lib/trunc.c
@@ -1,12 +1,12 @@
/* Round towards zero.
Copyright (C) 2007, 2010-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/tzset.c b/lib/tzset.c
index 1f423c474..7fd4936b2 100644
--- a/lib/tzset.c
+++ b/lib/tzset.c
@@ -2,18 +2,18 @@
Copyright (C) 2001-2003, 2005-2007, 2009-2021 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, or (at your option)
- any later version.
+ 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 3 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering */
diff --git a/lib/unistd.c b/lib/unistd.c
index 72bad1c05..076345602 100644
--- a/lib/unistd.c
+++ b/lib/unistd.c
@@ -1,4 +1,22 @@
+/* Inline functions for <unistd.h>.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
#include "unistd.h"
typedef int dummy;
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 5914fd5ae..73c882f97 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,18 +1,18 @@
/* Substitute for and wrapper around <unistd.h>.
Copyright (C) 2003-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_UNISTD_H
@@ -1521,6 +1521,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
# undef isatty
# define isatty rpl_isatty
# endif
+# define GNULIB_defined_isatty 1
_GL_FUNCDECL_RPL (isatty, int, (int fd));
_GL_CXXALIAS_RPL (isatty, int, (int fd));
# elif defined _WIN32 && !defined __CYGWIN__
@@ -2027,15 +2028,23 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
#if @GNULIB_MDA_SWAB@
/* On native Windows, map 'swab' to '_swab', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between
- platforms by defining GNULIB_NAMESPACE::creat always. */
+ platforms by defining GNULIB_NAMESPACE::swab always. */
# if defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef swab
# define swab _swab
# endif
-_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
+/* Need to cast, because in old mingw the arguments are
+ (const char *from, char *to, size_t n). */
+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
# else
+# if defined __hpux /* HP-UX */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
+# elif defined __sun && !defined _XPG4 /* Solaris */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
+# else
_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
+# endif
# endif
_GL_CXXALIASWARN (swab);
#endif
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
index 005fb1f42..b2e910e39 100644
--- a/lib/unsetenv.c
+++ b/lib/unsetenv.c
@@ -1,12 +1,12 @@
/* Copyright (C) 1992, 1995-2002, 2005-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 8d5100695..d9b669d15 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1,18 +1,18 @@
/* vsprintf with automatic memory allocation.
Copyright (C) 1999, 2002-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
VASNPRINTF The name of the function being defined.
@@ -60,10 +60,16 @@
#ifndef VASNPRINTF
# include <config.h>
#endif
-#ifndef IN_LIBINTL
-# include <alloca.h>
+
+/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's
+ use of CHECK macros expands to code that is too complicated for gcc
+ -fanalyzer. Suppress the resulting bogus warnings. */
+#if 10 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
#endif
+#include <alloca.h>
+
/* Specification. */
#ifndef VASNPRINTF
# if WIDE_CHAR_VERSION
@@ -1924,7 +1930,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* Ensures that allocated >= needed. Aborts through a jump to
out_of_memory if needed is SIZE_MAX or otherwise too big. */
-#define ENSURE_ALLOCATION(needed) \
+#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \
if ((needed) > allocated) \
{ \
size_t memory_size; \
@@ -1935,17 +1941,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
allocated = (needed); \
memory_size = xtimes (allocated, sizeof (DCHAR_T)); \
if (size_overflow_p (memory_size)) \
- goto out_of_memory; \
+ oom_statement \
if (result == resultbuf || result == NULL) \
memory = (DCHAR_T *) malloc (memory_size); \
else \
memory = (DCHAR_T *) realloc (result, memory_size); \
if (memory == NULL) \
- goto out_of_memory; \
+ oom_statement \
if (result == resultbuf && length > 0) \
DCHAR_CPY (memory, result, length); \
result = memory; \
}
+#define ENSURE_ALLOCATION(needed) \
+ ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; )
for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
{
@@ -2193,7 +2201,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2317,7 +2326,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2441,7 +2451,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
if (converted != result + length)
{
- ENSURE_ALLOCATION (xsum (length, converted_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
+ { free (converted); goto out_of_memory; });
DCHAR_CPY (result + length, converted, converted_len);
free (converted);
}
@@ -2944,7 +2955,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
# else
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
length += tmpdst_len;
@@ -3147,7 +3159,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
}
# else
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
length += tmpdst_len;
@@ -5598,7 +5611,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
CLEANUP ();
return NULL;
}
- ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
+ { free (tmpdst); goto out_of_memory; });
DCHAR_CPY (result + length, tmpdst, tmpdst_len);
free (tmpdst);
count = tmpdst_len;
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index aaed8599f..9b02cdf8a 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -1,18 +1,18 @@
/* vsprintf with automatic memory allocation.
Copyright (C) 2002-2004, 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _VASNPRINTF_H
#define _VASNPRINTF_H
diff --git a/lib/verify.h b/lib/verify.h
index d1b499579..a8ca59b09 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -2,12 +2,12 @@
Copyright (C) 2005-2006, 2009-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -25,7 +25,7 @@
works as per C11. This is supported by GCC 4.6.0+ and by clang 4+.
Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as
- per C2X. This is supported by GCC 9.1+.
+ per C2x. This is supported by GCC 9.1+.
Support compilers claiming conformance to the relevant standard,
and also support GCC when not pedantic. If we were willing to slow
@@ -202,7 +202,7 @@ template <int w>
This macro requires three or more arguments but uses at most the first
two, so that the _Static_assert macro optionally defined below supports
- both the C11 two-argument syntax and the C2X one-argument syntax.
+ both the C11 two-argument syntax and the C2x one-argument syntax.
Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index c94c5cb2d..4a0a3dc6a 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -2,18 +2,18 @@
Copyright (C) 2004, 2006-2021 Free Software Foundation, Inc.
Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>.
- 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/lib/w32sock.h b/lib/w32sock.h
index 9b6a2314b..635a1b228 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index fe4171c54..be5d36c8d 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2007-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
@@ -72,6 +72,9 @@
# include <stddef.h>
#endif
+/* Get free(). */
+#include <stdlib.h>
+
/* Include the original <wchar.h> if it exists.
Some builds of uClibc lack it. */
/* The include_next requires a split double-inclusion guard. */
@@ -111,7 +114,7 @@
/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
<stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
wint_t must be "unchanged by default argument promotions". Override it. */
-# if @GNULIB_OVERRIDES_WINT_T@
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@
# if !GNULIB_defined_wint_t
# if @HAVE_CRTDEFS_H@
# include <crtdefs.h>
@@ -941,36 +944,48 @@ _GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
# endif
_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
# else
-# if !@HAVE_WCSDUP@
-_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# if !@HAVE_WCSDUP@ || __GNUC__ >= 11
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+ (const wchar_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
# endif
_GL_CXXALIASWARN (wcsdup);
-#elif defined GNULIB_POSIXCHECK
-# undef wcsdup
-# if HAVE_RAW_DECL_WCSDUP
+#else
+# if __GNUC__ >= 11 && !defined wcsdup
+/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+ (const wchar_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+# endif
+# if defined GNULIB_POSIXCHECK
+# undef wcsdup
+# if HAVE_RAW_DECL_WCSDUP
_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
"use gnulib module wcsdup for portability");
-# endif
-#elif @GNULIB_MDA_WCSDUP@
+# endif
+# elif @GNULIB_MDA_WCSDUP@
/* On native Windows, map 'wcsdup' to '_wcsdup', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between
platforms by defining GNULIB_NAMESPACE::wcsdup always. */
-# if defined _WIN32 && !defined __CYGWIN__
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef wcsdup
-# define wcsdup _wcsdup
-# endif
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef wcsdup
+# define wcsdup _wcsdup
+# endif
_GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
-# else
-_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
-# if @HAVE_DECL_WCSDUP@
+# else
+_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
+ (const wchar_t *s)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
+# if @HAVE_DECL_WCSDUP@
_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
+# endif
# endif
-# endif
-# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
+# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_WCSDUP@
_GL_CXXALIASWARN (wcsdup);
+# endif
# endif
#endif
diff --git a/lib/wcrtomb.c b/lib/wcrtomb.c
index 76d21ae62..5c9fd795b 100644
--- a/lib/wcrtomb.c
+++ b/lib/wcrtomb.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/wctype-h.c b/lib/wctype-h.c
index bb5f847e3..150221d6d 100644
--- a/lib/wctype-h.c
+++ b/lib/wctype-h.c
@@ -1,4 +1,23 @@
+/* Inline functions for <wctype.h>.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
/* Normally this would be wctype.c, but that name's already taken. */
+
#include <config.h>
+
#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
#include "wctype.h"
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 6f0cd21a0..652d811ea 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -2,18 +2,18 @@
Copyright (C) 2006-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible and Paul Eggert. */
@@ -103,7 +103,7 @@ _GL_INLINE_HEADER_BEGIN
/* mingw and MSVC define wint_t as 'unsigned short' in <crtdefs.h> or
<stddef.h>. This is too small: ISO C 99 section 7.24.1.(2) says that
wint_t must be "unchanged by default argument promotions". Override it. */
-# if @GNULIB_OVERRIDES_WINT_T@
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@
# if !GNULIB_defined_wint_t
# if @HAVE_CRTDEFS_H@
# include <crtdefs.h>
@@ -132,7 +132,7 @@ typedef unsigned int rpl_wint_t;
same way, or not at all. */
# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
-# if @GNULIB_OVERRIDES_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */
_GL_WCTYPE_INLINE int
rpl_iswalnum (wint_t wc)
@@ -496,7 +496,7 @@ _GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc));
# endif
-# if defined __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@
+# if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@
/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
The functions towlower and towupper are implemented in the MSVCRT library
@@ -529,7 +529,7 @@ rpl_towupper (wint_t wc)
# define towupper rpl_towupper
# endif
-# endif /* __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@ */
+# endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */
# define GNULIB_defined_wctype_functions 1
#endif
@@ -646,7 +646,7 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - "
The argument WC must be either a wchar_t value or WEOF.
The argument DESC must have been returned by the wctype() function. */
#if @GNULIB_ISWCTYPE@
-# if @GNULIB_OVERRIDES_WINT_T@
+# if @GNULIBHEADERS_OVERRIDE_WINT_T@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef iswctype
# define iswctype rpl_iswctype
diff --git a/lib/windows-initguard.h b/lib/windows-initguard.h
index e84051e1e..7999b2339 100644
--- a/lib/windows-initguard.h
+++ b/lib/windows-initguard.h
@@ -1,18 +1,18 @@
/* Init guards, somewhat like spinlocks (native Windows implementation).
Copyright (C) 2005-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2005.
Based on GCC's gthr-win32.h. */
diff --git a/lib/write.c b/lib/write.c
index bc53d4dcf..614cdc62f 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -2,12 +2,12 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
- 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index d25596932..4184f3395 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -2,12 +2,12 @@
Copyright (C) 1990-2000, 2003-2004, 2006-2021 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 3 of the License, or
- (at your option) any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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.
@@ -22,33 +22,38 @@
#include <stdint.h>
/* True if N * S does not fit into both ptrdiff_t and size_t.
- S must be positive and N must be nonnegative.
+ N and S should be nonnegative and free of side effects.
This expands to a constant expression if N and S are both constants.
By gnulib convention, SIZE_MAX represents overflow in size_t
calculations, so the conservative size_t-based dividend to use here
is SIZE_MAX - 1. */
#define __xalloc_oversized(n, s) \
- ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n))
+ ((s) != 0 \
+ && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \
+ < (n)))
-#if PTRDIFF_MAX < SIZE_MAX
-typedef ptrdiff_t xalloc_count_t;
-#else
-typedef size_t xalloc_count_t;
-#endif
+/* Return 1 if and only if an array of N objects, each of size S,
+ cannot exist reliably because its total size in bytes would exceed
+ MIN (PTRDIFF_MAX, SIZE_MAX - 1).
+
+ N and S should be nonnegative and free of side effects.
+
+ Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can
+ misbehave if N and S are both narrower than ptrdiff_t and size_t,
+ and can be rewritten as (xalloc_oversized (N, S) ? NULL
+ : malloc (N * (size_t) S)).
-/* Return 1 if an array of N objects, each of size S, cannot exist reliably
- because its total size in bytes exceeds MIN (PTRDIFF_MAX, SIZE_MAX).
- N must be nonnegative, S must be positive, and either N or S should be
- of type ptrdiff_t or size_t or wider. This is a macro, not a function,
- so that it works even if an argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */
-#if 7 <= __GNUC__ && !defined __clang__
+ This is a macro, not a function, so that it works even if an
+ argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */
+#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
# define xalloc_oversized(n, s) \
- __builtin_mul_overflow_p (n, s, (xalloc_count_t) 1)
-#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__
+ __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
+#elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \
+ && PTRDIFF_MAX < SIZE_MAX)
# define xalloc_oversized(n, s) \
(__builtin_constant_p (n) && __builtin_constant_p (s) \
? __xalloc_oversized (n, s) \
- : ({ xalloc_count_t __xalloc_count; \
+ : ({ ptrdiff_t __xalloc_count; \
__builtin_mul_overflow (n, s, &__xalloc_count); }))
/* Other compilers use integer division; this may be slower but is
diff --git a/lib/xsize.c b/lib/xsize.c
index 4b4914c2c..b3d73a2d8 100644
--- a/lib/xsize.c
+++ b/lib/xsize.c
@@ -1,3 +1,21 @@
+/* Checked size_t computations.
+
+ Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>. */
+
#include <config.h>
+
#define XSIZE_INLINE _GL_EXTERN_INLINE
#include "xsize.h"
diff --git a/lib/xsize.h b/lib/xsize.h
index d4d7b1c7c..91fa877ce 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -2,18 +2,18 @@
Copyright (C) 2003, 2008-2021 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, or (at your option)
- any later version.
+ 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 program is distributed in the hope that it will be useful,
+ 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 <https://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _XSIZE_H
#define _XSIZE_H
diff --git a/libguile.h b/libguile.h
index 45117af9e..6b76abe29 100644
--- a/libguile.h
+++ b/libguile.h
@@ -58,7 +58,6 @@ extern "C" {
#include "libguile/fports.h"
#include "libguile/frames.h"
#include "libguile/gc.h"
-#include "libguile/generalized-arrays.h"
#include "libguile/generalized-vectors.h"
#include "libguile/goops.h"
#include "libguile/gsubr.h"
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index c0cc08cbc..3568767af 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -163,7 +163,6 @@ libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = \
gc-malloc.c \
gc.c \
gettext.c \
- generalized-arrays.c \
generalized-vectors.c \
goops.c \
gsubr.c \
@@ -281,7 +280,6 @@ DOT_X_FILES = \
gc-malloc.x \
gc.x \
gettext.x \
- generalized-arrays.x \
generalized-vectors.x \
goops.x \
gsubr.x \
@@ -388,7 +386,6 @@ DOT_DOC_FILES = \
gc-malloc.doc \
gc.doc \
gettext.doc \
- generalized-arrays.doc \
generalized-vectors.doc \
goops.doc \
gsubr.doc \
@@ -636,7 +633,6 @@ modinclude_HEADERS = \
gc.h \
gc-inline.h \
gettext.h \
- generalized-arrays.h \
generalized-vectors.h \
goops.h \
gsubr.h \
diff --git a/libguile/array-handle.h b/libguile/array-handle.h
index 137371eeb..6ad80eb41 100644
--- a/libguile/array-handle.h
+++ b/libguile/array-handle.h
@@ -1,7 +1,7 @@
#ifndef SCM_ARRAY_HANDLE_H
#define SCM_ARRAY_HANDLE_H
-/* Copyright 1995-1997,1999-2001,2004,2006,2008-2009,2011,2013-2014,2018
+/* Copyright 1995-1997,1999-2001,2004,2006,2008-2009,2011,2013-2014,2018,2021
Free Software Foundation, Inc.
This file is part of Guile.
@@ -25,19 +25,13 @@
#include "libguile/error.h"
#include "libguile/inline.h"
#include "libguile/numbers.h"
+#include "libguile/arrays.h"
typedef SCM (*scm_t_vector_ref) (SCM, size_t);
typedef void (*scm_t_vector_set) (SCM, size_t, SCM);
-typedef struct scm_t_array_dim
-{
- ssize_t lbnd;
- ssize_t ubnd;
- ssize_t inc;
-} scm_t_array_dim;
-
typedef enum
{
SCM_ARRAY_ELEMENT_TYPE_SCM = 0, /* SCM values */
diff --git a/libguile/array-map.c b/libguile/array-map.c
index 6460a2483..ce0f7ba09 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -36,7 +36,6 @@
#include "eq.h"
#include "eval.h"
#include "feature.h"
-#include "generalized-arrays.h"
#include "gsubr.h"
#include "list.h"
#include "numbers.h"
@@ -668,7 +667,7 @@ SCM
scm_i_array_rebase (SCM a, size_t base)
{
size_t ndim = SCM_I_ARRAY_NDIM (a);
- SCM b = scm_words (((scm_t_bits) ndim << 17) + scm_tc7_array, 3 + ndim*3);
+ SCM b = scm_i_raw_array (ndim);
SCM_I_ARRAY_SET_V (b, SCM_I_ARRAY_V (a));
/* FIXME do check base */
SCM_I_ARRAY_SET_BASE (b, base);
diff --git a/libguile/arrays.c b/libguile/arrays.c
index 0a919515b..924ee0094 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -1,5 +1,5 @@
-/* Copyright 1995-1998,2000-2006,2009-2015,2018
- Free Software Foundation, Inc.
+/* Copyright 1995-1998,2000-2006,2009-2015,2018, 2021
+ Free Software Foundation, Inc.
This file is part of Guile.
@@ -35,10 +35,10 @@
#include "chars.h"
#include "dynwind.h"
#include "eq.h"
+#include "error.h"
#include "eval.h"
#include "feature.h"
#include "fports.h"
-#include "generalized-arrays.h"
#include "generalized-vectors.h"
#include "gsubr.h"
#include "list.h"
@@ -52,10 +52,373 @@
#include "strings.h"
#include "uniform.h"
#include "vectors.h"
-#include "verify.h"
#include "arrays.h"
+SCM_INTERNAL SCM scm_i_array_ref (SCM v,
+ SCM idx0, SCM idx1, SCM idxN);
+SCM_INTERNAL SCM scm_i_array_set_x (SCM v, SCM obj,
+ SCM idx0, SCM idx1, SCM idxN);
+
+
+int
+scm_is_array (SCM obj)
+{
+ if (!SCM_HEAP_OBJECT_P (obj))
+ return 0;
+
+ switch (SCM_TYP7 (obj))
+ {
+ case scm_tc7_string:
+ case scm_tc7_vector:
+ case scm_tc7_bitvector:
+ case scm_tc7_bytevector:
+ case scm_tc7_array:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+SCM_DEFINE (scm_array_p_2, "array?", 1, 0, 0,
+ (SCM obj),
+ "Return @code{#t} if the @var{obj} is an array, and @code{#f} if\n"
+ "not.")
+#define FUNC_NAME s_scm_array_p_2
+{
+ return scm_from_bool (scm_is_array (obj));
+}
+#undef FUNC_NAME
+
+/* The array type predicate, with an extra argument kept for backward
+ compatibility. Note that we can't use `SCM_DEFINE' directly because there
+ would be an argument count mismatch that would be caught by
+ `snarf-check-and-output-texi.scm'. */
+SCM
+scm_array_p (SCM obj, SCM unused)
+{
+ return scm_array_p_2 (obj);
+}
+
+int
+scm_is_typed_array (SCM obj, SCM type)
+{
+ int ret = 0;
+ if (scm_is_array (obj))
+ {
+ scm_t_array_handle h;
+
+ scm_array_get_handle (obj, &h);
+ ret = scm_is_eq (scm_array_handle_element_type (&h), type);
+ scm_array_handle_release (&h);
+ }
+
+ return ret;
+}
+
+SCM_DEFINE (scm_typed_array_p, "typed-array?", 2, 0, 0,
+ (SCM obj, SCM type),
+ "Return @code{#t} if the @var{obj} is an array of type\n"
+ "@var{type}, and @code{#f} if not.")
+#define FUNC_NAME s_scm_typed_array_p
+{
+ return scm_from_bool (scm_is_typed_array (obj, type));
+}
+#undef FUNC_NAME
+
+
+size_t
+scm_c_array_length (SCM array)
+{
+ scm_t_array_handle handle;
+ size_t res;
+
+ scm_array_get_handle (array, &handle);
+ if (scm_array_handle_rank (&handle) < 1)
+ {
+ scm_array_handle_release (&handle);
+ scm_wrong_type_arg_msg (NULL, 0, array, "array of nonzero rank");
+ }
+ res = handle.dims[0].ubnd - handle.dims[0].lbnd + 1;
+ scm_array_handle_release (&handle);
+
+ return res;
+}
+
+SCM_DEFINE (scm_array_length, "array-length", 1, 0, 0,
+ (SCM array),
+ "Return the length of an array: its first dimension.\n"
+ "It is an error to ask for the length of an array of rank 0.")
+#define FUNC_NAME s_scm_array_length
+{
+ return scm_from_size_t (scm_c_array_length (array));
+}
+#undef FUNC_NAME
+
+
+SCM_DEFINE (scm_array_dimensions, "array-dimensions", 1, 0, 0,
+ (SCM ra),
+ "@code{array-dimensions} is similar to @code{array-shape} but replaces\n"
+ "elements with a @code{0} minimum with one greater than the maximum. So:\n"
+ "@lisp\n"
+ "(array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)\n"
+ "@end lisp")
+#define FUNC_NAME s_scm_array_dimensions
+{
+ scm_t_array_handle handle;
+ scm_t_array_dim *s;
+ SCM res = SCM_EOL;
+ size_t k;
+
+ scm_array_get_handle (ra, &handle);
+ s = scm_array_handle_dims (&handle);
+ k = scm_array_handle_rank (&handle);
+
+ while (k--)
+ res = scm_cons (s[k].lbnd
+ ? scm_cons2 (scm_from_ssize_t (s[k].lbnd),
+ scm_from_ssize_t (s[k].ubnd),
+ SCM_EOL)
+ : scm_from_ssize_t (1 + s[k].ubnd),
+ res);
+
+ scm_array_handle_release (&handle);
+ return res;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_array_type, "array-type", 1, 0, 0,
+ (SCM ra),
+ "")
+#define FUNC_NAME s_scm_array_type
+{
+ scm_t_array_handle h;
+ SCM type;
+
+ scm_array_get_handle (ra, &h);
+ type = scm_array_handle_element_type (&h);
+ scm_array_handle_release (&h);
+
+ return type;
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_array_type_code,
+ "array-type-code", 1, 0, 0,
+ (SCM array),
+ "Return the type of the elements in @var{array},\n"
+ "as an integer code.")
+#define FUNC_NAME s_scm_array_type_code
+{
+ scm_t_array_handle h;
+ scm_t_array_element_type element_type;
+
+ scm_array_get_handle (array, &h);
+ element_type = h.element_type;
+ scm_array_handle_release (&h);
+
+ return scm_from_uint16 (element_type);
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1,
+ (SCM ra, SCM args),
+ "Return @code{#t} if its arguments would be acceptable to\n"
+ "@code{array-ref}.")
+#define FUNC_NAME s_scm_array_in_bounds_p
+{
+ SCM res = SCM_BOOL_T;
+ size_t k, ndim;
+ scm_t_array_dim *s;
+ scm_t_array_handle handle;
+
+ SCM_VALIDATE_REST_ARGUMENT (args);
+
+ scm_array_get_handle (ra, &handle);
+ s = scm_array_handle_dims (&handle);
+ ndim = scm_array_handle_rank (&handle);
+
+ for (k = 0; k < ndim; k++)
+ {
+ long ind;
+
+ if (!scm_is_pair (args))
+ SCM_WRONG_NUM_ARGS ();
+ ind = scm_to_long (SCM_CAR (args));
+ args = SCM_CDR (args);
+
+ if (ind < s[k].lbnd || ind > s[k].ubnd)
+ {
+ res = SCM_BOOL_F;
+ /* We do not stop the checking after finding a violation
+ since we want to validate the type-correctness and
+ number of arguments in any case.
+ */
+ }
+ }
+
+ scm_array_handle_release (&handle);
+ return res;
+}
+#undef FUNC_NAME
+
+
+SCM
+scm_c_array_ref_1 (SCM array, ssize_t idx0)
+{
+ scm_t_array_handle handle;
+ SCM res;
+
+ scm_array_get_handle (array, &handle);
+ res = scm_array_handle_ref (&handle, scm_array_handle_pos_1 (&handle, idx0));
+ scm_array_handle_release (&handle);
+ return res;
+}
+
+
+SCM
+scm_c_array_ref_2 (SCM array, ssize_t idx0, ssize_t idx1)
+{
+ scm_t_array_handle handle;
+ SCM res;
+
+ scm_array_get_handle (array, &handle);
+ res = scm_array_handle_ref (&handle, scm_array_handle_pos_2 (&handle, idx0, idx1));
+ scm_array_handle_release (&handle);
+ return res;
+}
+
+
+SCM
+scm_array_ref (SCM v, SCM args)
+{
+ scm_t_array_handle handle;
+ SCM res;
+
+ scm_array_get_handle (v, &handle);
+ res = scm_array_handle_ref (&handle, scm_array_handle_pos (&handle, args));
+ scm_array_handle_release (&handle);
+ return res;
+}
+
+
+void
+scm_c_array_set_1_x (SCM array, SCM obj, ssize_t idx0)
+{
+ scm_t_array_handle handle;
+
+ scm_array_get_handle (array, &handle);
+ scm_array_handle_set (&handle, scm_array_handle_pos_1 (&handle, idx0),
+ obj);
+ scm_array_handle_release (&handle);
+}
+
+
+void
+scm_c_array_set_2_x (SCM array, SCM obj, ssize_t idx0, ssize_t idx1)
+{
+ scm_t_array_handle handle;
+
+ scm_array_get_handle (array, &handle);
+ scm_array_handle_set (&handle, scm_array_handle_pos_2 (&handle, idx0, idx1),
+ obj);
+ scm_array_handle_release (&handle);
+}
+
+
+SCM
+scm_array_set_x (SCM v, SCM obj, SCM args)
+{
+ scm_t_array_handle handle;
+
+ scm_array_get_handle (v, &handle);
+ scm_array_handle_set (&handle, scm_array_handle_pos (&handle, args), obj);
+ scm_array_handle_release (&handle);
+ return SCM_UNSPECIFIED;
+}
+
+
+SCM_DEFINE (scm_i_array_ref, "array-ref", 1, 2, 1,
+ (SCM v, SCM idx0, SCM idx1, SCM idxN),
+ "Return the element at the @code{(idx0, idx1, idxN...)}\n"
+ "position in array @var{v}.")
+#define FUNC_NAME s_scm_i_array_ref
+{
+ if (SCM_UNBNDP (idx0))
+ return scm_array_ref (v, SCM_EOL);
+ else if (SCM_UNBNDP (idx1))
+ return scm_c_array_ref_1 (v, scm_to_ssize_t (idx0));
+ else if (scm_is_null (idxN))
+ return scm_c_array_ref_2 (v, scm_to_ssize_t (idx0), scm_to_ssize_t (idx1));
+ else
+ return scm_array_ref (v, scm_cons (idx0, scm_cons (idx1, idxN)));
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_i_array_set_x, "array-set!", 2, 2, 1,
+ (SCM v, SCM obj, SCM idx0, SCM idx1, SCM idxN),
+ "Set the element at the @code{(idx0, idx1, idxN...)} position\n"
+ "in the array @var{v} to @var{obj}. The value returned by\n"
+ "@code{array-set!} is unspecified.")
+#define FUNC_NAME s_scm_i_array_set_x
+{
+ if (SCM_UNBNDP (idx0))
+ scm_array_set_x (v, obj, SCM_EOL);
+ else if (SCM_UNBNDP (idx1))
+ scm_c_array_set_1_x (v, obj, scm_to_ssize_t (idx0));
+ else if (scm_is_null (idxN))
+ scm_c_array_set_2_x (v, obj, scm_to_ssize_t (idx0), scm_to_ssize_t (idx1));
+ else
+ scm_array_set_x (v, obj, scm_cons (idx0, scm_cons (idx1, idxN)));
+
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
+
+static SCM
+array_to_list (scm_t_array_handle *h, size_t dim, unsigned long pos)
+{
+ if (dim == scm_array_handle_rank (h))
+ return scm_array_handle_ref (h, pos);
+ else
+ {
+ SCM res = SCM_EOL;
+ long inc;
+ size_t i;
+
+ i = h->dims[dim].ubnd - h->dims[dim].lbnd + 1;
+ inc = h->dims[dim].inc;
+ pos += (i - 1) * inc;
+
+ for (; i > 0; i--, pos -= inc)
+ res = scm_cons (array_to_list (h, dim + 1, pos), res);
+ return res;
+ }
+}
+
+SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0,
+ (SCM array),
+ "Return a list representation of @var{array}.\n\n"
+ "It is easiest to specify the behavior of this function by\n"
+ "example:\n"
+ "@example\n"
+ "(array->list #0(a)) @result{} 1\n"
+ "(array->list #1(a b)) @result{} (a b)\n"
+ "(array->list #2((aa ab) (ba bb)) @result{} ((aa ab) (ba bb))\n"
+ "@end example\n")
+#define FUNC_NAME s_scm_array_to_list
+{
+ scm_t_array_handle h;
+ SCM res;
+
+ scm_array_get_handle (array, &h);
+ res = array_to_list (&h, 0, 0);
+ scm_array_handle_release (&h);
+
+ return res;
+}
+#undef FUNC_NAME
size_t
scm_c_array_rank (SCM array)
@@ -69,8 +432,8 @@ scm_c_array_rank (SCM array)
}
SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0,
- (SCM array),
- "Return the number of dimensions of the array @var{array.}\n")
+ (SCM array),
+ "Return the number of dimensions of the array @var{array.}\n")
#define FUNC_NAME s_scm_array_rank
{
return scm_from_size_t (scm_c_array_rank (array));
@@ -79,8 +442,8 @@ SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0,
SCM_DEFINE (scm_shared_array_root, "shared-array-root", 1, 0, 0,
- (SCM ra),
- "Return the root vector of a shared array.")
+ (SCM ra),
+ "Return the root vector of a shared array.")
#define FUNC_NAME s_scm_shared_array_root
{
if (SCM_I_ARRAYP (ra))
@@ -94,8 +457,8 @@ SCM_DEFINE (scm_shared_array_root, "shared-array-root", 1, 0, 0,
SCM_DEFINE (scm_shared_array_offset, "shared-array-offset", 1, 0, 0,
- (SCM ra),
- "Return the root vector index of the first element in the array.")
+ (SCM ra),
+ "Return the root vector index of the first element in the array.")
#define FUNC_NAME s_scm_shared_array_offset
{
if (SCM_I_ARRAYP (ra))
@@ -109,8 +472,8 @@ SCM_DEFINE (scm_shared_array_offset, "shared-array-offset", 1, 0, 0,
SCM_DEFINE (scm_shared_array_increments, "shared-array-increments", 1, 0, 0,
- (SCM ra),
- "For each dimension, return the distance between elements in the root vector.")
+ (SCM ra),
+ "For each dimension, return the distance between elements in the root vector.")
#define FUNC_NAME s_scm_shared_array_increments
{
if (SCM_I_ARRAYP (ra))
@@ -129,16 +492,11 @@ SCM_DEFINE (scm_shared_array_increments, "shared-array-increments", 1, 0, 0,
}
#undef FUNC_NAME
-/* FIXME: to avoid this assumption, fix the accessors in arrays.h,
- scm_i_make_array, and the array cases in system/vm/assembler.scm. */
-verify (sizeof (scm_t_array_dim) == 3*sizeof (scm_t_bits));
-
-/* Matching SCM_I_ARRAY accessors in arrays.h */
SCM
scm_i_make_array (int ndim)
{
- SCM ra = scm_words (((scm_t_bits) ndim << 17) + scm_tc7_array, 3 + ndim*3);
+ SCM ra = scm_i_raw_array (ndim);
SCM_I_ARRAY_SET_V (ra, SCM_BOOL_F);
SCM_I_ARRAY_SET_BASE (ra, 0);
/* dimensions are unset */
@@ -166,35 +524,35 @@ scm_i_shap2ra (SCM args)
{
spec = SCM_CAR (args);
if (scm_is_integer (spec))
- {
- s->lbnd = 0;
- s->ubnd = scm_to_ssize_t (spec);
+ {
+ s->lbnd = 0;
+ s->ubnd = scm_to_ssize_t (spec);
if (s->ubnd < 0)
scm_misc_error (NULL, s_bad_spec, SCM_EOL);
--s->ubnd;
- }
+ }
else
- {
- if (!scm_is_pair (spec) || !scm_is_integer (SCM_CAR (spec)))
- scm_misc_error (NULL, s_bad_spec, SCM_EOL);
- s->lbnd = scm_to_ssize_t (SCM_CAR (spec));
- spec = SCM_CDR (spec);
- if (!scm_is_pair (spec)
- || !scm_is_integer (SCM_CAR (spec))
- || !scm_is_null (SCM_CDR (spec)))
- scm_misc_error (NULL, s_bad_spec, SCM_EOL);
- s->ubnd = scm_to_ssize_t (SCM_CAR (spec));
+ {
+ if (!scm_is_pair (spec) || !scm_is_integer (SCM_CAR (spec)))
+ scm_misc_error (NULL, s_bad_spec, SCM_EOL);
+ s->lbnd = scm_to_ssize_t (SCM_CAR (spec));
+ spec = SCM_CDR (spec);
+ if (!scm_is_pair (spec)
+ || !scm_is_integer (SCM_CAR (spec))
+ || !scm_is_null (SCM_CDR (spec)))
+ scm_misc_error (NULL, s_bad_spec, SCM_EOL);
+ s->ubnd = scm_to_ssize_t (SCM_CAR (spec));
if (s->ubnd - s->lbnd < -1)
scm_misc_error (NULL, s_bad_spec, SCM_EOL);
- }
+ }
s->inc = 1;
}
return ra;
}
SCM_DEFINE (scm_make_typed_array, "make-typed-array", 2, 0, 1,
- (SCM type, SCM fill, SCM bounds),
- "Create and return an array of type @var{type}.")
+ (SCM type, SCM fill, SCM bounds),
+ "Create and return an array of type @var{type}.")
#define FUNC_NAME s_scm_make_typed_array
{
size_t k, rlen = 1;
@@ -202,7 +560,6 @@ SCM_DEFINE (scm_make_typed_array, "make-typed-array", 2, 0, 1,
SCM ra;
ra = scm_i_shap2ra (bounds);
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
s = SCM_I_ARRAY_DIMS (ra);
k = SCM_I_ARRAY_NDIM (ra);
@@ -226,114 +583,35 @@ SCM_DEFINE (scm_make_typed_array, "make-typed-array", 2, 0, 1,
}
#undef FUNC_NAME
-SCM
-scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes,
- size_t byte_len)
-#define FUNC_NAME "scm_from_contiguous_typed_array"
-{
- size_t k, rlen = 1;
- scm_t_array_dim *s;
- SCM ra;
- scm_t_array_handle h;
- void *elts;
- size_t sz;
-
- ra = scm_i_shap2ra (bounds);
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
- s = SCM_I_ARRAY_DIMS (ra);
- k = SCM_I_ARRAY_NDIM (ra);
-
- while (k--)
- {
- s[k].inc = rlen;
- SCM_ASSERT_RANGE (1, bounds, s[k].lbnd <= s[k].ubnd + 1);
- rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
- }
- SCM_I_ARRAY_SET_V (ra, scm_make_generalized_vector (type, scm_from_size_t (rlen), SCM_UNDEFINED));
-
-
- scm_array_get_handle (ra, &h);
- elts = h.writable_elements;
- sz = scm_array_handle_uniform_element_bit_size (&h);
- scm_array_handle_release (&h);
-
- if (sz >= 8 && ((sz % 8) == 0))
- {
- if (byte_len % (sz / 8))
- SCM_MISC_ERROR ("byte length not a multiple of the unit size", SCM_EOL);
- if (byte_len / (sz / 8) != rlen)
- SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
- }
- else if (sz < 8)
- {
- /* Elements of sub-byte size (bitvectors) are addressed in 32-bit
- units. */
- if (byte_len != ((rlen * sz + 31) / 32) * 4)
- SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
- }
- else
- /* an internal guile error, really */
- SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole bytes", SCM_EOL);
-
- memcpy (elts, bytes, byte_len);
-
- if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
- if (0 == s->lbnd)
- return SCM_I_ARRAY_V (ra);
- return ra;
-}
-#undef FUNC_NAME
SCM_DEFINE (scm_make_array, "make-array", 1, 0, 1,
- (SCM fill, SCM bounds),
- "Create and return an array.")
+ (SCM fill, SCM bounds),
+ "Create and return an array.")
#define FUNC_NAME s_scm_make_array
{
return scm_make_typed_array (SCM_BOOL_T, fill, bounds);
}
#undef FUNC_NAME
-/* see scm_from_contiguous_array */
-static void
-scm_i_ra_set_contp (SCM ra)
-{
- size_t k = SCM_I_ARRAY_NDIM (ra);
- if (k)
- {
- ssize_t inc = SCM_I_ARRAY_DIMS (ra)[k - 1].inc;
- while (k--)
- {
- if (inc != SCM_I_ARRAY_DIMS (ra)[k].inc)
- {
- SCM_CLR_ARRAY_CONTIGUOUS_FLAG (ra);
- return;
- }
- inc *= (SCM_I_ARRAY_DIMS (ra)[k].ubnd
- - SCM_I_ARRAY_DIMS (ra)[k].lbnd + 1);
- }
- }
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
-}
-
SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
- (SCM oldra, SCM mapfunc, SCM dims),
- "@code{make-shared-array} can be used to create shared subarrays\n"
- "of other arrays. The @var{mapfunc} is a function that\n"
- "translates coordinates in the new array into coordinates in the\n"
- "old array. A @var{mapfunc} must be linear, and its range must\n"
- "stay within the bounds of the old array, but it can be\n"
- "otherwise arbitrary. A simple example:\n"
- "@lisp\n"
- "(define fred (make-array #f 8 8))\n"
- "(define freds-diagonal\n"
- " (make-shared-array fred (lambda (i) (list i i)) 8))\n"
- "(array-set! freds-diagonal 'foo 3)\n"
- "(array-ref fred 3 3) @result{} foo\n"
- "(define freds-center\n"
- " (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))\n"
- "(array-ref freds-center 0 0) @result{} foo\n"
- "@end lisp")
+ (SCM oldra, SCM mapfunc, SCM dims),
+ "@code{make-shared-array} can be used to create shared subarrays\n"
+ "of other arrays. The @var{mapfunc} is a function that\n"
+ "translates coordinates in the new array into coordinates in the\n"
+ "old array. A @var{mapfunc} must be linear, and its range must\n"
+ "stay within the bounds of the old array, but it can be\n"
+ "otherwise arbitrary. A simple example:\n"
+ "@lisp\n"
+ "(define fred (make-array #f 8 8))\n"
+ "(define freds-diagonal\n"
+ " (make-shared-array fred (lambda (i) (list i i)) 8))\n"
+ "(array-set! freds-diagonal 'foo 3)\n"
+ "(array-ref fred 3 3) @result{} foo\n"
+ "(define freds-center\n"
+ " (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))\n"
+ "(array-ref freds-center 0 0) @result{} foo\n"
+ "@end lisp")
#define FUNC_NAME s_scm_make_shared_array
{
scm_t_array_handle old_handle;
@@ -358,12 +636,12 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
s = scm_array_handle_dims (&old_handle);
k = scm_array_handle_rank (&old_handle);
while (k--)
- {
- if (s[k].inc > 0)
- old_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
- else
- old_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
- }
+ {
+ if (s[k].inc > 0)
+ old_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
+ else
+ old_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
+ }
}
else
{
@@ -378,16 +656,16 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
{
inds = scm_cons (scm_from_ssize_t (s[k].lbnd), inds);
if (s[k].ubnd < s[k].lbnd)
- {
- if (1 == SCM_I_ARRAY_NDIM (ra))
- ra = scm_make_generalized_vector (scm_array_type (ra),
+ {
+ if (1 == SCM_I_ARRAY_NDIM (ra))
+ ra = scm_make_generalized_vector (scm_array_type (ra),
SCM_INUM0, SCM_UNDEFINED);
- else
- SCM_I_ARRAY_SET_V (ra, scm_make_generalized_vector (scm_array_type (ra),
+ else
+ SCM_I_ARRAY_SET_V (ra, scm_make_generalized_vector (scm_array_type (ra),
SCM_INUM0, SCM_UNDEFINED));
- scm_array_handle_release (&old_handle);
- return ra;
- }
+ scm_array_handle_release (&old_handle);
+ return ra;
+ }
}
imap = scm_apply_0 (mapfunc, scm_reverse (inds));
@@ -399,18 +677,18 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
while (k--)
{
if (s[k].ubnd > s[k].lbnd)
- {
- SCM_SETCAR (indptr, scm_sum (SCM_CAR (indptr), scm_from_int (1)));
- imap = scm_apply_0 (mapfunc, scm_reverse (inds));
- s[k].inc = scm_array_handle_pos (&old_handle, imap) - i;
- i += s[k].inc;
- if (s[k].inc > 0)
- new_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
- else
- new_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
- }
+ {
+ SCM_SETCAR (indptr, scm_sum (SCM_CAR (indptr), scm_from_int (1)));
+ imap = scm_apply_0 (mapfunc, scm_reverse (inds));
+ s[k].inc = scm_array_handle_pos (&old_handle, imap) - i;
+ i += s[k].inc;
+ if (s[k].inc > 0)
+ new_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
+ else
+ new_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
+ }
else
- s[k].inc = new_max - new_min + 1; /* contiguous by default */
+ s[k].inc = new_max - new_min + 1; /* contiguous by default */
indptr = SCM_CDR (indptr);
}
@@ -423,12 +701,11 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
SCM v = SCM_I_ARRAY_V (ra);
size_t length = scm_c_array_length (v);
if (1 == s->inc && 0 == s->lbnd && length == 1 + s->ubnd)
- return v;
+ return v;
if (s->ubnd < s->lbnd)
- return scm_make_generalized_vector (scm_array_type (ra), SCM_INUM0,
+ return scm_make_generalized_vector (scm_array_type (ra), SCM_INUM0,
SCM_UNDEFINED);
}
- scm_i_ra_set_contp (ra);
return ra;
}
#undef FUNC_NAME
@@ -470,7 +747,7 @@ array_from_get_o (scm_t_array_handle *handle, size_t k, scm_t_array_dim *s, ssiz
}
SCM_DEFINE (scm_array_slice, "array-slice", 1, 0, 1,
- (SCM ra, SCM indices),
+ (SCM ra, SCM indices),
"Return the array slice @var{ra}[@var{indices} ..., ...]\n"
"The rank of @var{ra} must equal to the number of indices or larger.\n\n"
"See also @code{array-ref}, @code{array-cell-ref}, @code{array-cell-set!}.\n\n"
@@ -508,7 +785,7 @@ SCM_DEFINE (scm_array_slice, "array-slice", 1, 0, 1,
SCM_DEFINE (scm_array_cell_ref, "array-cell-ref", 1, 0, 1,
- (SCM ra, SCM indices),
+ (SCM ra, SCM indices),
"Return the element at the @code{(@var{indices} ...)} position\n"
"in array @var{ra}, or the array slice @var{ra}[@var{indices} ..., ...]\n"
"if the rank of @var{ra} is larger than the number of indices.\n\n"
@@ -608,26 +885,26 @@ SCM_DEFINE (scm_array_cell_set_x, "array-cell-set!", 2, 0, 1,
/* args are RA . DIMS */
SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
- (SCM ra, SCM args),
- "Return an array sharing contents with @var{ra}, but with\n"
- "dimensions arranged in a different order. There must be one\n"
- "@var{dim} argument for each dimension of @var{ra}.\n"
- "@var{dim0}, @var{dim1}, @dots{} should be integers between 0\n"
- "and the rank of the array to be returned. Each integer in that\n"
- "range must appear at least once in the argument list.\n"
- "\n"
- "The values of @var{dim0}, @var{dim1}, @dots{} correspond to\n"
- "dimensions in the array to be returned, their positions in the\n"
- "argument list to dimensions of @var{ra}. Several @var{dim}s\n"
- "may have the same value, in which case the returned array will\n"
- "have smaller rank than @var{ra}.\n"
- "\n"
- "@lisp\n"
- "(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
- "(transpose-array '#2((a b) (c d)) 0 0) @result{} #1(a d)\n"
- "(transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) @result{}\n"
- " #2((a 4) (b 5) (c 6))\n"
- "@end lisp")
+ (SCM ra, SCM args),
+ "Return an array sharing contents with @var{ra}, but with\n"
+ "dimensions arranged in a different order. There must be one\n"
+ "@var{dim} argument for each dimension of @var{ra}.\n"
+ "@var{dim0}, @var{dim1}, @dots{} should be integers between 0\n"
+ "and the rank of the array to be returned. Each integer in that\n"
+ "range must appear at least once in the argument list.\n"
+ "\n"
+ "The values of @var{dim0}, @var{dim1}, @dots{} correspond to\n"
+ "dimensions in the array to be returned, their positions in the\n"
+ "argument list to dimensions of @var{ra}. Several @var{dim}s\n"
+ "may have the same value, in which case the returned array will\n"
+ "have smaller rank than @var{ra}.\n"
+ "\n"
+ "@lisp\n"
+ "(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
+ "(transpose-array '#2((a b) (c d)) 0 0) @result{} #1(a d)\n"
+ "(transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) @result{}\n"
+ " #2((a 4) (b 5) (c 6))\n"
+ "@end lisp")
#define FUNC_NAME s_scm_transpose_array
{
SCM res, vargs;
@@ -641,65 +918,64 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
{
case 0:
if (!scm_is_null (args))
- SCM_WRONG_NUM_ARGS ();
+ SCM_WRONG_NUM_ARGS ();
return ra;
case 1:
/* Make sure that we are called with a single zero as
- arguments.
+ arguments.
*/
if (scm_is_null (args) || !scm_is_null (SCM_CDR (args)))
- SCM_WRONG_NUM_ARGS ();
+ SCM_WRONG_NUM_ARGS ();
SCM_VALIDATE_INT_COPY (SCM_ARG2, SCM_CAR (args), i);
SCM_ASSERT_RANGE (SCM_ARG2, SCM_CAR (args), i == 0);
return ra;
default:
vargs = scm_vector (args);
if (SCM_SIMPLE_VECTOR_LENGTH (vargs) != SCM_I_ARRAY_NDIM (ra))
- SCM_WRONG_NUM_ARGS ();
+ SCM_WRONG_NUM_ARGS ();
ndim = 0;
for (k = 0; k < SCM_I_ARRAY_NDIM (ra); k++)
- {
- i = scm_to_signed_integer (SCM_SIMPLE_VECTOR_REF (vargs, k),
- 0, SCM_I_ARRAY_NDIM(ra));
- if (ndim < i)
- ndim = i;
- }
+ {
+ i = scm_to_signed_integer (SCM_SIMPLE_VECTOR_REF (vargs, k),
+ 0, SCM_I_ARRAY_NDIM(ra));
+ if (ndim < i)
+ ndim = i;
+ }
ndim++;
res = scm_i_make_array (ndim);
SCM_I_ARRAY_SET_V (res, SCM_I_ARRAY_V (ra));
SCM_I_ARRAY_SET_BASE (res, SCM_I_ARRAY_BASE (ra));
for (k = ndim; k--;)
- {
- SCM_I_ARRAY_DIMS (res)[k].lbnd = 0;
- SCM_I_ARRAY_DIMS (res)[k].ubnd = -1;
- }
+ {
+ SCM_I_ARRAY_DIMS (res)[k].lbnd = 0;
+ SCM_I_ARRAY_DIMS (res)[k].ubnd = -1;
+ }
for (k = SCM_I_ARRAY_NDIM (ra); k--;)
- {
- i = scm_to_int (SCM_SIMPLE_VECTOR_REF (vargs, k));
- s = &(SCM_I_ARRAY_DIMS (ra)[k]);
- r = &(SCM_I_ARRAY_DIMS (res)[i]);
- if (r->ubnd < r->lbnd)
- {
- r->lbnd = s->lbnd;
- r->ubnd = s->ubnd;
- r->inc = s->inc;
- ndim--;
- }
- else
- {
- if (r->ubnd > s->ubnd)
- r->ubnd = s->ubnd;
- if (r->lbnd < s->lbnd)
- {
- SCM_I_ARRAY_SET_BASE (res, SCM_I_ARRAY_BASE (res) + (s->lbnd - r->lbnd) * r->inc);
- r->lbnd = s->lbnd;
- }
- r->inc += s->inc;
- }
- }
+ {
+ i = scm_to_int (SCM_SIMPLE_VECTOR_REF (vargs, k));
+ s = &(SCM_I_ARRAY_DIMS (ra)[k]);
+ r = &(SCM_I_ARRAY_DIMS (res)[i]);
+ if (r->ubnd < r->lbnd)
+ {
+ r->lbnd = s->lbnd;
+ r->ubnd = s->ubnd;
+ r->inc = s->inc;
+ ndim--;
+ }
+ else
+ {
+ if (r->ubnd > s->ubnd)
+ r->ubnd = s->ubnd;
+ if (r->lbnd < s->lbnd)
+ {
+ SCM_I_ARRAY_SET_BASE (res, SCM_I_ARRAY_BASE (res) + (s->lbnd - r->lbnd) * r->inc);
+ r->lbnd = s->lbnd;
+ }
+ r->inc += s->inc;
+ }
+ }
if (ndim > 0)
- SCM_MISC_ERROR ("bad argument list", SCM_EOL);
- scm_i_ra_set_contp (res);
+ SCM_MISC_ERROR ("bad argument list", SCM_EOL);
return res;
}
}
@@ -710,16 +986,16 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
/* if strict is true, return #f if returned array
wouldn't have contiguous elements. */
SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
- (SCM ra, SCM strict),
- "If @var{ra} may be @dfn{unrolled} into a one dimensional shared\n"
- "array without changing their order (last subscript changing\n"
- "fastest), then @code{array-contents} returns that shared array,\n"
- "otherwise it returns @code{#f}. All arrays made by\n"
- "@code{make-array} and @code{make-uniform-array} may be unrolled,\n"
- "some arrays made by @code{make-shared-array} may not be. If\n"
- "the optional argument @var{strict} is provided, a shared array\n"
- "will be returned only if its elements are stored contiguously\n"
- "in memory.")
+ (SCM ra, SCM strict),
+ "If @var{ra} may be @dfn{unrolled} into a one dimensional shared\n"
+ "array without changing their order (last subscript changing\n"
+ "fastest), then @code{array-contents} returns that shared array,\n"
+ "otherwise it returns @code{#f}. All arrays made by\n"
+ "@code{make-array} and @code{make-uniform-array} may be unrolled,\n"
+ "some arrays made by @code{make-shared-array} may not be. If\n"
+ "the optional argument @var{strict} is provided, a shared array\n"
+ "will be returned only if its elements are stored contiguously\n"
+ "in memory.")
#define FUNC_NAME s_scm_array_contents
{
if (SCM_I_ARRAYP (ra))
@@ -742,19 +1018,19 @@ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
}
if (!SCM_UNBNDP (strict) && scm_is_true (strict))
- {
- if (ndim && (1 != s[ndim - 1].inc))
- return SCM_BOOL_F;
- if (scm_is_bitvector (SCM_I_ARRAY_V (ra))
+ {
+ if (ndim && (1 != s[ndim - 1].inc))
+ return SCM_BOOL_F;
+ if (scm_is_bitvector (SCM_I_ARRAY_V (ra))
&& (len != scm_c_bitvector_length (SCM_I_ARRAY_V (ra)) ||
SCM_I_ARRAY_BASE (ra) % SCM_LONG_BIT ||
len % SCM_LONG_BIT))
return SCM_BOOL_F;
- }
+ }
v = SCM_I_ARRAY_V (ra);
if ((len == scm_c_array_length (v)) && (0 == SCM_I_ARRAY_BASE (ra)))
- return v;
+ return v;
else
{
SCM sra = scm_i_make_array (1);
@@ -788,38 +1064,38 @@ list_to_array (SCM lst, scm_t_array_handle *handle, ssize_t pos, size_t k)
n = len;
while (n > 0 && scm_is_pair (lst))
- {
- list_to_array (SCM_CAR (lst), handle, pos, k + 1);
- pos += inc;
- lst = SCM_CDR (lst);
- n -= 1;
- }
+ {
+ list_to_array (SCM_CAR (lst), handle, pos, k + 1);
+ pos += inc;
+ lst = SCM_CDR (lst);
+ n -= 1;
+ }
if (n != 0)
- errmsg = "too few elements for array dimension ~a, need ~a";
+ errmsg = "too few elements for array dimension ~a, need ~a";
if (!scm_is_null (lst))
- errmsg = "too many elements for array dimension ~a, want ~a";
+ errmsg = "too many elements for array dimension ~a, want ~a";
if (errmsg)
- scm_misc_error (NULL, errmsg, scm_list_2 (scm_from_size_t (k),
- scm_from_size_t (len)));
+ scm_misc_error (NULL, errmsg, scm_list_2 (scm_from_size_t (k),
+ scm_from_size_t (len)));
}
}
SCM_DEFINE (scm_list_to_typed_array, "list->typed-array", 3, 0, 0,
- (SCM type, SCM shape, SCM lst),
- "Return an array of the type @var{type}\n"
- "with elements the same as those of @var{lst}.\n"
- "\n"
- "The argument @var{shape} determines the number of dimensions\n"
- "of the array and their shape. It is either an exact integer,\n"
- "giving the\n"
- "number of dimensions directly, or a list whose length\n"
- "specifies the number of dimensions and each element specified\n"
- "the lower and optionally the upper bound of the corresponding\n"
- "dimension.\n"
- "When the element is list of two elements, these elements\n"
- "give the lower and upper bounds. When it is an exact\n"
- "integer, it gives only the lower bound.")
+ (SCM type, SCM shape, SCM lst),
+ "Return an array of the type @var{type}\n"
+ "with elements the same as those of @var{lst}.\n"
+ "\n"
+ "The argument @var{shape} determines the number of dimensions\n"
+ "of the array and their shape. It is either an exact integer,\n"
+ "giving the\n"
+ "number of dimensions directly, or a list whose length\n"
+ "specifies the number of dimensions and each element specified\n"
+ "the lower and optionally the upper bound of the corresponding\n"
+ "dimension.\n"
+ "When the element is list of two elements, these elements\n"
+ "give the lower and upper bounds. When it is an exact\n"
+ "integer, it gives only the lower bound.")
#define FUNC_NAME s_scm_list_to_typed_array
{
SCM row;
@@ -832,40 +1108,40 @@ SCM_DEFINE (scm_list_to_typed_array, "list->typed-array", 3, 0, 0,
size_t k = scm_to_size_t (shape);
shape = SCM_EOL;
while (k-- > 0)
- {
- shape = scm_cons (scm_length (row), shape);
- if (k > 0 && !scm_is_null (row))
- row = scm_car (row);
- }
+ {
+ shape = scm_cons (scm_length (row), shape);
+ if (k > 0 && !scm_is_null (row))
+ row = scm_car (row);
+ }
}
else
{
SCM shape_spec = shape;
shape = SCM_EOL;
while (1)
- {
- SCM spec = scm_car (shape_spec);
- if (scm_is_pair (spec))
- shape = scm_cons (spec, shape);
- else
- shape = scm_cons (scm_list_2 (spec,
- scm_sum (scm_sum (spec,
- scm_length (row)),
- scm_from_int (-1))),
- shape);
- shape_spec = scm_cdr (shape_spec);
- if (scm_is_pair (shape_spec))
- {
- if (!scm_is_null (row))
- row = scm_car (row);
- }
- else
- break;
- }
+ {
+ SCM spec = scm_car (shape_spec);
+ if (scm_is_pair (spec))
+ shape = scm_cons (spec, shape);
+ else
+ shape = scm_cons (scm_list_2 (spec,
+ scm_sum (scm_sum (spec,
+ scm_length (row)),
+ scm_from_int (-1))),
+ shape);
+ shape_spec = scm_cdr (shape_spec);
+ if (scm_is_pair (shape_spec))
+ {
+ if (!scm_is_null (row))
+ row = scm_car (row);
+ }
+ else
+ break;
+ }
}
ra = scm_make_typed_array (type, SCM_UNSPECIFIED,
- scm_reverse_x (shape, SCM_EOL));
+ scm_reverse_x (shape, SCM_EOL));
scm_array_get_handle (ra, &handle);
list_to_array (lst, &handle, 0, 0);
@@ -876,8 +1152,8 @@ SCM_DEFINE (scm_list_to_typed_array, "list->typed-array", 3, 0, 0,
#undef FUNC_NAME
SCM_DEFINE (scm_list_to_array, "list->array", 2, 0, 0,
- (SCM ndim, SCM lst),
- "Return an array with elements the same as those of @var{lst}.")
+ (SCM ndim, SCM lst),
+ "Return an array with elements the same as those of @var{lst}.")
#define FUNC_NAME s_scm_list_to_array
{
return scm_list_to_typed_array (SCM_BOOL_T, ndim, lst);
@@ -889,7 +1165,7 @@ SCM_DEFINE (scm_list_to_array, "list->array", 2, 0, 0,
static int
scm_i_print_array_dimension (scm_t_array_handle *h, int dim, int pos,
- SCM port, scm_print_state *pstate)
+ SCM port, scm_print_state *pstate)
{
if (dim == h->ndims)
scm_iprin1 (scm_array_handle_ref (h, pos), port, pstate);
@@ -917,26 +1193,26 @@ scm_i_print_array (SCM array, SCM port, scm_print_state *pstate)
scm_call_2 (scm_c_private_ref ("ice-9 arrays", "array-print-prefix"),
array, port);
-
+
scm_array_get_handle (array, &h);
if (h.ndims == 0)
{
/* Rank zero arrays, which are really just scalars, are printed
- specially. The consequent way would be to print them as
+ specially. The consequent way would be to print them as
- #0 OBJ
+ #0 OBJ
where OBJ is the printed representation of the scalar, but we
print them instead as
- #0(OBJ)
+ #0(OBJ)
to make them look less strange.
- Just printing them as
+ Just printing them as
- OBJ
+ OBJ
would be correct in a way as well, but zero rank arrays are
not really the same as Scheme values since they are boxed and
@@ -958,7 +1234,5 @@ void
scm_init_arrays ()
{
scm_add_feature ("array");
-
#include "arrays.x"
-
}
diff --git a/libguile/arrays.h b/libguile/arrays.h
index 7221fdb63..5457ddb95 100644
--- a/libguile/arrays.h
+++ b/libguile/arrays.h
@@ -22,7 +22,6 @@
-#include "libguile/gc.h"
#include "libguile/print.h"
@@ -31,14 +30,17 @@
Also see ....
*/
+#define SCM_VALIDATE_ARRAY(pos, v) \
+ do { \
+ SCM_ASSERT (SCM_HEAP_OBJECT_P (v) \
+ && scm_is_true (scm_array_p (v, SCM_UNDEFINED)), \
+ v, pos, FUNC_NAME); \
+ } while (0)
/** Arrays */
SCM_API SCM scm_make_array (SCM fill, SCM bounds);
SCM_API SCM scm_make_typed_array (SCM type, SCM fill, SCM bounds);
-SCM_API SCM scm_from_contiguous_typed_array (SCM type, SCM bounds,
- const void *bytes,
- size_t byte_len);
SCM_API SCM scm_shared_array_root (SCM ra);
SCM_API SCM scm_shared_array_offset (SCM ra);
@@ -57,26 +59,56 @@ SCM_API SCM scm_list_to_typed_array (SCM type, SCM ndim, SCM lst);
SCM_API size_t scm_c_array_rank (SCM ra);
SCM_API SCM scm_array_rank (SCM ra);
-/* internal. */
+SCM_API int scm_is_array (SCM obj);
+SCM_API SCM scm_array_p (SCM v, SCM unused);
+SCM_INTERNAL SCM scm_array_p_2 (SCM);
+
+SCM_API int scm_is_typed_array (SCM obj, SCM type);
+SCM_API SCM scm_typed_array_p (SCM v, SCM type);
+
+SCM_API size_t scm_c_array_length (SCM ra);
+SCM_API SCM scm_array_length (SCM ra);
+
+SCM_API SCM scm_array_dimensions (SCM ra);
+SCM_API SCM scm_array_type (SCM ra);
+SCM_API SCM scm_array_type_code (SCM ra);
+SCM_API SCM scm_array_in_bounds_p (SCM v, SCM args);
+
+SCM_API SCM scm_c_array_ref_1 (SCM v, ssize_t idx0);
+SCM_API SCM scm_c_array_ref_2 (SCM v, ssize_t idx0, ssize_t idx1);
+
+SCM_API void scm_c_array_set_1_x (SCM v, SCM obj, ssize_t idx0);
+SCM_API void scm_c_array_set_2_x (SCM v, SCM obj, ssize_t idx0, ssize_t idx1);
+
+SCM_API SCM scm_array_ref (SCM v, SCM args);
+SCM_API SCM scm_array_set_x (SCM v, SCM obj, SCM args);
+SCM_API SCM scm_array_to_list (SCM v);
-/* see scm_from_contiguous_array for these three */
-#define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0)
-#define SCM_SET_ARRAY_CONTIGUOUS_FLAG(x) \
- (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) | (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)))
-#define SCM_CLR_ARRAY_CONTIGUOUS_FLAG(x) \
- (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) & ~(SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)))
+typedef struct scm_t_array_dim
+{
+ ssize_t lbnd;
+ ssize_t ubnd;
+ ssize_t inc;
+} scm_t_array_dim;
+
+/* internal. */
#define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc7_array, a)
#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>17))
-#define SCM_I_ARRAY_CONTP(x) (SCM_CELL_WORD_0 (x) & (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16))
-
#define SCM_I_ARRAY_V(a) SCM_CELL_OBJECT_1 (a)
#define SCM_I_ARRAY_BASE(a) ((size_t) SCM_CELL_WORD_2 (a))
#define SCM_I_ARRAY_DIMS(a) ((scm_t_array_dim *) SCM_CELL_OBJECT_LOC (a, 3))
-
#define SCM_I_ARRAY_SET_V(a, v) SCM_SET_CELL_OBJECT_1(a, v)
#define SCM_I_ARRAY_SET_BASE(a, base) SCM_SET_CELL_WORD_2(a, base)
+/* See the array cases in system/vm/assembler.scm. */
+
+static inline SCM
+scm_i_raw_array (int ndim)
+{
+ return scm_words (((scm_t_bits) ndim << 17) + scm_tc7_array, 3 + ndim*3);
+}
+
SCM_INTERNAL SCM scm_i_make_array (int ndim);
SCM_INTERNAL int scm_i_print_array (SCM array, SCM port, scm_print_state *pstate);
SCM_INTERNAL SCM scm_i_shap2ra (SCM args);
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 2d6cbdb3e..5bb1c8d49 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -565,32 +565,46 @@ SCM_DEFINE (scm_bytevector_eq_p, "bytevector=?", 2, 0, 0,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_bytevector_fill_x, "bytevector-fill!", 2, 0, 0,
- (SCM bv, SCM fill),
- "Fill bytevector @var{bv} with @var{fill}, a byte.")
-#define FUNC_NAME s_scm_bytevector_fill_x
-{
- size_t c_len, i;
- uint8_t *c_bv, c_fill;
- int value;
+static SCM scm_bytevector_fill_partial_x (SCM bv, SCM fill, SCM start, SCM end);
+SCM_DEFINE (scm_bytevector_fill_partial_x, "bytevector-fill!", 2, 2, 0,
+ (SCM bv, SCM fill, SCM start, SCM end),
+ "Fill positions [@var{start} ... @var{end}) of bytevector "
+ "@var{bv} with @var{fill}, a byte. @var{start} defaults to 0 "
+ "and @var{end} defaults to the length of @var{bv}. "
+ "The return value is unspecified.")
+#define FUNC_NAME s_scm_bytevector_fill_partial_x
+{
SCM_VALIDATE_MUTABLE_BYTEVECTOR (1, bv);
- value = scm_to_int (fill);
+ int value = scm_to_int (fill);
if (SCM_UNLIKELY ((value < -128) || (value > 255)))
scm_out_of_range (FUNC_NAME, fill);
- c_fill = (uint8_t) value;
+
+ size_t i = 0;
+ size_t c_end = SCM_BYTEVECTOR_LENGTH (bv);
+ uint8_t *c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
- c_len = SCM_BYTEVECTOR_LENGTH (bv);
- c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
+ if (!SCM_UNBNDP (start))
+ i = scm_to_unsigned_integer (start, 0, c_end);
+ if (!SCM_UNBNDP (end))
+ c_end = scm_to_unsigned_integer (end, i, c_end);
- for (i = 0; i < c_len; i++)
- c_bv[i] = c_fill;
+ memset (c_bv + i, value, c_end-i);
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
+SCM
+scm_bytevector_fill_x (SCM bv, SCM fill)
+#define FUNC_NAME s_scm_bytevector_fill_x
+{
+ return scm_bytevector_fill_partial_x (bv, fill, SCM_UNDEFINED, SCM_UNDEFINED);
+}
+#undef FUNC_NAME
+
+
SCM_DEFINE (scm_bytevector_copy_x, "bytevector-copy!", 5, 0, 0,
(SCM source, SCM source_start, SCM target, SCM target_start,
SCM len),
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index e4909dfc6..277a4d9ed 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -28,12 +28,15 @@
#define SCM_BUILDING_DEPRECATED_CODE
#include "alist.h"
+#include "array-handle.h"
+#include "arrays.h"
#include "boolean.h"
#include "bitvectors.h"
#include "deprecation.h"
#include "dynl.h"
#include "eval.h"
#include "foreign.h"
+#include "generalized-vectors.h"
#include "gc.h"
#include "gsubr.h"
#include "modules.h"
@@ -42,6 +45,8 @@
#include "srfi-4.h"
#include "strings.h"
#include "symbols.h"
+#include "uniform.h"
+#include "vectors.h"
#include "deprecated.h"
@@ -96,6 +101,14 @@ scm_find_executable (const char *name)
+int
+scm_is_simple_vector (SCM obj)
+{
+ scm_c_issue_deprecation_warning
+ ("scm_is_simple_vector is deprecated. Use scm_is_vector instead.");
+ return SCM_I_IS_VECTOR (obj);
+}
+
SCM
scm_bitvector_p (SCM vec)
{
@@ -577,6 +590,69 @@ scm_istr2bve (SCM str)
return res;
}
+SCM
+scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes,
+ size_t byte_len)
+#define FUNC_NAME "scm_from_contiguous_typed_array"
+{
+ size_t k, rlen = 1;
+ scm_t_array_dim *s;
+ SCM ra;
+ scm_t_array_handle h;
+ void *elts;
+ size_t sz;
+
+ scm_c_issue_deprecation_warning
+ ("scm_from_contiguous_typed_array is deprecated. "
+ "Instead, use scm_make_typed_array() and the array handle functions "
+ "to copy data to the new array.");
+
+ ra = scm_i_shap2ra (bounds);
+ s = SCM_I_ARRAY_DIMS (ra);
+ k = SCM_I_ARRAY_NDIM (ra);
+
+ while (k--)
+ {
+ s[k].inc = rlen;
+ SCM_ASSERT_RANGE (1, bounds, s[k].lbnd <= s[k].ubnd + 1);
+ rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
+ }
+ SCM_I_ARRAY_SET_V (ra, scm_make_generalized_vector (type, scm_from_size_t (rlen), SCM_UNDEFINED));
+
+
+ scm_array_get_handle (ra, &h);
+ elts = h.writable_elements;
+ sz = scm_array_handle_uniform_element_bit_size (&h);
+ scm_array_handle_release (&h);
+
+ if (sz >= 8 && ((sz % 8) == 0))
+ {
+ if (byte_len % (sz / 8))
+ SCM_MISC_ERROR ("byte length not a multiple of the unit size", SCM_EOL);
+ if (byte_len / (sz / 8) != rlen)
+ SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
+ }
+ else if (sz < 8)
+ {
+ /* Elements of sub-byte size (bitvectors) are addressed in 32-bit
+ units. */
+ if (byte_len != ((rlen * sz + 31) / 32) * 4)
+ SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
+ }
+ else
+ /* an internal guile error, really */
+ SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole bytes", SCM_EOL);
+
+ memcpy (elts, bytes, byte_len);
+
+ if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
+ if (0 == s->lbnd)
+ return SCM_I_ARRAY_V (ra);
+ return ra;
+}
+#undef FUNC_NAME
+
+
SCM_GLOBAL_SYMBOL (scm_sym_copy, "copy");
SCM
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index c68decf74..a062cbecb 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -115,6 +115,7 @@ typedef struct scm_thread scm_i_thread SCM_DEPRECATED_TYPE;
SCM_DEPRECATED char* scm_find_executable (const char *name);
+SCM_DEPRECATED int scm_is_simple_vector (SCM obj);
SCM_DEPRECATED SCM scm_bitvector_p (SCM vec);
SCM_DEPRECATED SCM scm_bitvector (SCM bits);
SCM_DEPRECATED SCM scm_make_bitvector (SCM len, SCM fill);
@@ -130,6 +131,9 @@ SCM_DEPRECATED SCM scm_bit_count_star (SCM v, SCM kv, SCM obj);
SCM_DEPRECATED SCM scm_bit_position (SCM item, SCM v, SCM k);
SCM_DEPRECATED SCM scm_bit_set_star_x (SCM v, SCM kv, SCM obj);
SCM_DEPRECATED SCM scm_istr2bve (SCM str);
+SCM_DEPRECATED SCM scm_from_contiguous_typed_array (SCM type, SCM bounds,
+ const void *bytes,
+ size_t byte_len);
#define SCM_SOURCE_PROPERTY_FLAG_BREAK 1
diff --git a/libguile/eq.c b/libguile/eq.c
index 627d6f09b..bf18cda88 100644
--- a/libguile/eq.c
+++ b/libguile/eq.c
@@ -32,7 +32,7 @@
#include "bytevectors.h"
#include "eval.h"
#include "foreign.h"
-#include "generalized-arrays.h"
+#include "arrays.h"
#include "goops.h"
#include "gsubr.h"
#include "hashtab.h"
diff --git a/libguile/frames.c b/libguile/frames.c
index 0bb40579c..b2711df5c 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -1,4 +1,4 @@
-/* Copyright 2001,2009-2015,2018
+/* Copyright 2001,2009-2015,2018,2021
Free Software Foundation, Inc.
This file is part of Guile.
@@ -231,7 +231,8 @@ enum stack_item_representation
STACK_ITEM_SCM = 0,
STACK_ITEM_F64 = 1,
STACK_ITEM_U64 = 2,
- STACK_ITEM_S64 = 3
+ STACK_ITEM_S64 = 3,
+ STACK_ITEM_PTR = 4
};
static enum stack_item_representation
@@ -245,6 +246,8 @@ scm_to_stack_item_representation (SCM x, const char *subr, int pos)
return STACK_ITEM_U64;
if (scm_is_eq (x, scm_from_latin1_symbol ("s64")))
return STACK_ITEM_S64;
+ if (scm_is_eq (x, scm_from_latin1_symbol ("ptr")))
+ return STACK_ITEM_PTR;
scm_wrong_type_arg (subr, pos, x);
return 0; /* Not reached. */
@@ -279,6 +282,8 @@ scm_frame_local_ref (SCM frame, SCM index, SCM representation)
return scm_from_uint64 (item->as_u64);
case STACK_ITEM_S64:
return scm_from_int64 (item->as_s64);
+ case STACK_ITEM_PTR:
+ return scm_from_uintptr_t (item->as_uint);
default:
abort();
}
@@ -321,6 +326,8 @@ scm_frame_local_set_x (SCM frame, SCM index, SCM val, SCM representation)
case STACK_ITEM_S64:
item->as_s64 = scm_to_int64 (val);
break;
+ case STACK_ITEM_PTR:
+ item->as_uint = scm_to_uintptr_t (val);
default:
abort();
}
diff --git a/libguile/generalized-arrays.c b/libguile/generalized-arrays.c
deleted file mode 100644
index 28ca6b3c7..000000000
--- a/libguile/generalized-arrays.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/* Copyright 1995-1998,2000-2006,2009-2010,2013-2014,2018
- Free Software Foundation, Inc.
-
- This file is part of Guile.
-
- Guile 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 3 of the License, or
- (at your option) any later version.
-
- Guile 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 Guile. If not, see
- <https://www.gnu.org/licenses/>. */
-
-
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "array-handle.h"
-#include "gsubr.h"
-#include "list.h"
-#include "numbers.h"
-#include "pairs.h"
-
-#include "generalized-arrays.h"
-
-
-SCM_INTERNAL SCM scm_i_array_ref (SCM v,
- SCM idx0, SCM idx1, SCM idxN);
-SCM_INTERNAL SCM scm_i_array_set_x (SCM v, SCM obj,
- SCM idx0, SCM idx1, SCM idxN);
-
-
-int
-scm_is_array (SCM obj)
-{
- if (!SCM_HEAP_OBJECT_P (obj))
- return 0;
-
- switch (SCM_TYP7 (obj))
- {
- case scm_tc7_string:
- case scm_tc7_vector:
- case scm_tc7_bitvector:
- case scm_tc7_bytevector:
- case scm_tc7_array:
- return 1;
- default:
- return 0;
- }
-}
-
-SCM_DEFINE (scm_array_p_2, "array?", 1, 0, 0,
- (SCM obj),
- "Return @code{#t} if the @var{obj} is an array, and @code{#f} if\n"
- "not.")
-#define FUNC_NAME s_scm_array_p_2
-{
- return scm_from_bool (scm_is_array (obj));
-}
-#undef FUNC_NAME
-
-/* The array type predicate, with an extra argument kept for backward
- compatibility. Note that we can't use `SCM_DEFINE' directly because there
- would be an argument count mismatch that would be caught by
- `snarf-check-and-output-texi.scm'. */
-SCM
-scm_array_p (SCM obj, SCM unused)
-{
- return scm_array_p_2 (obj);
-}
-
-int
-scm_is_typed_array (SCM obj, SCM type)
-{
- int ret = 0;
- if (scm_is_array (obj))
- {
- scm_t_array_handle h;
-
- scm_array_get_handle (obj, &h);
- ret = scm_is_eq (scm_array_handle_element_type (&h), type);
- scm_array_handle_release (&h);
- }
-
- return ret;
-}
-
-SCM_DEFINE (scm_typed_array_p, "typed-array?", 2, 0, 0,
- (SCM obj, SCM type),
- "Return @code{#t} if the @var{obj} is an array of type\n"
- "@var{type}, and @code{#f} if not.")
-#define FUNC_NAME s_scm_typed_array_p
-{
- return scm_from_bool (scm_is_typed_array (obj, type));
-}
-#undef FUNC_NAME
-
-
-size_t
-scm_c_array_length (SCM array)
-{
- scm_t_array_handle handle;
- size_t res;
-
- scm_array_get_handle (array, &handle);
- if (scm_array_handle_rank (&handle) < 1)
- {
- scm_array_handle_release (&handle);
- scm_wrong_type_arg_msg (NULL, 0, array, "array of nonzero rank");
- }
- res = handle.dims[0].ubnd - handle.dims[0].lbnd + 1;
- scm_array_handle_release (&handle);
-
- return res;
-}
-
-SCM_DEFINE (scm_array_length, "array-length", 1, 0, 0,
- (SCM array),
- "Return the length of an array: its first dimension.\n"
- "It is an error to ask for the length of an array of rank 0.")
-#define FUNC_NAME s_scm_array_length
-{
- return scm_from_size_t (scm_c_array_length (array));
-}
-#undef FUNC_NAME
-
-
-SCM_DEFINE (scm_array_dimensions, "array-dimensions", 1, 0, 0,
- (SCM ra),
- "@code{array-dimensions} is similar to @code{array-shape} but replaces\n"
- "elements with a @code{0} minimum with one greater than the maximum. So:\n"
- "@lisp\n"
- "(array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)\n"
- "@end lisp")
-#define FUNC_NAME s_scm_array_dimensions
-{
- scm_t_array_handle handle;
- scm_t_array_dim *s;
- SCM res = SCM_EOL;
- size_t k;
-
- scm_array_get_handle (ra, &handle);
- s = scm_array_handle_dims (&handle);
- k = scm_array_handle_rank (&handle);
-
- while (k--)
- res = scm_cons (s[k].lbnd
- ? scm_cons2 (scm_from_ssize_t (s[k].lbnd),
- scm_from_ssize_t (s[k].ubnd),
- SCM_EOL)
- : scm_from_ssize_t (1 + s[k].ubnd),
- res);
-
- scm_array_handle_release (&handle);
- return res;
-}
-#undef FUNC_NAME
-
-SCM_DEFINE (scm_array_type, "array-type", 1, 0, 0,
- (SCM ra),
- "")
-#define FUNC_NAME s_scm_array_type
-{
- scm_t_array_handle h;
- SCM type;
-
- scm_array_get_handle (ra, &h);
- type = scm_array_handle_element_type (&h);
- scm_array_handle_release (&h);
-
- return type;
-}
-#undef FUNC_NAME
-
-SCM_DEFINE (scm_array_type_code,
- "array-type-code", 1, 0, 0,
- (SCM array),
- "Return the type of the elements in @var{array},\n"
- "as an integer code.")
-#define FUNC_NAME s_scm_array_type_code
-{
- scm_t_array_handle h;
- scm_t_array_element_type element_type;
-
- scm_array_get_handle (array, &h);
- element_type = h.element_type;
- scm_array_handle_release (&h);
-
- return scm_from_uint16 (element_type);
-}
-#undef FUNC_NAME
-
-SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1,
- (SCM ra, SCM args),
- "Return @code{#t} if its arguments would be acceptable to\n"
- "@code{array-ref}.")
-#define FUNC_NAME s_scm_array_in_bounds_p
-{
- SCM res = SCM_BOOL_T;
- size_t k, ndim;
- scm_t_array_dim *s;
- scm_t_array_handle handle;
-
- SCM_VALIDATE_REST_ARGUMENT (args);
-
- scm_array_get_handle (ra, &handle);
- s = scm_array_handle_dims (&handle);
- ndim = scm_array_handle_rank (&handle);
-
- for (k = 0; k < ndim; k++)
- {
- long ind;
-
- if (!scm_is_pair (args))
- SCM_WRONG_NUM_ARGS ();
- ind = scm_to_long (SCM_CAR (args));
- args = SCM_CDR (args);
-
- if (ind < s[k].lbnd || ind > s[k].ubnd)
- {
- res = SCM_BOOL_F;
- /* We do not stop the checking after finding a violation
- since we want to validate the type-correctness and
- number of arguments in any case.
- */
- }
- }
-
- scm_array_handle_release (&handle);
- return res;
-}
-#undef FUNC_NAME
-
-
-SCM
-scm_c_array_ref_1 (SCM array, ssize_t idx0)
-{
- scm_t_array_handle handle;
- SCM res;
-
- scm_array_get_handle (array, &handle);
- res = scm_array_handle_ref (&handle, scm_array_handle_pos_1 (&handle, idx0));
- scm_array_handle_release (&handle);
- return res;
-}
-
-
-SCM
-scm_c_array_ref_2 (SCM array, ssize_t idx0, ssize_t idx1)
-{
- scm_t_array_handle handle;
- SCM res;
-
- scm_array_get_handle (array, &handle);
- res = scm_array_handle_ref (&handle, scm_array_handle_pos_2 (&handle, idx0, idx1));
- scm_array_handle_release (&handle);
- return res;
-}
-
-
-SCM
-scm_array_ref (SCM v, SCM args)
-{
- scm_t_array_handle handle;
- SCM res;
-
- scm_array_get_handle (v, &handle);
- res = scm_array_handle_ref (&handle, scm_array_handle_pos (&handle, args));
- scm_array_handle_release (&handle);
- return res;
-}
-
-
-void
-scm_c_array_set_1_x (SCM array, SCM obj, ssize_t idx0)
-{
- scm_t_array_handle handle;
-
- scm_array_get_handle (array, &handle);
- scm_array_handle_set (&handle, scm_array_handle_pos_1 (&handle, idx0),
- obj);
- scm_array_handle_release (&handle);
-}
-
-
-void
-scm_c_array_set_2_x (SCM array, SCM obj, ssize_t idx0, ssize_t idx1)
-{
- scm_t_array_handle handle;
-
- scm_array_get_handle (array, &handle);
- scm_array_handle_set (&handle, scm_array_handle_pos_2 (&handle, idx0, idx1),
- obj);
- scm_array_handle_release (&handle);
-}
-
-
-SCM
-scm_array_set_x (SCM v, SCM obj, SCM args)
-{
- scm_t_array_handle handle;
-
- scm_array_get_handle (v, &handle);
- scm_array_handle_set (&handle, scm_array_handle_pos (&handle, args), obj);
- scm_array_handle_release (&handle);
- return SCM_UNSPECIFIED;
-}
-
-
-SCM_DEFINE (scm_i_array_ref, "array-ref", 1, 2, 1,
- (SCM v, SCM idx0, SCM idx1, SCM idxN),
- "Return the element at the @code{(idx0, idx1, idxN...)}\n"
- "position in array @var{v}.")
-#define FUNC_NAME s_scm_i_array_ref
-{
- if (SCM_UNBNDP (idx0))
- return scm_array_ref (v, SCM_EOL);
- else if (SCM_UNBNDP (idx1))
- return scm_c_array_ref_1 (v, scm_to_ssize_t (idx0));
- else if (scm_is_null (idxN))
- return scm_c_array_ref_2 (v, scm_to_ssize_t (idx0), scm_to_ssize_t (idx1));
- else
- return scm_array_ref (v, scm_cons (idx0, scm_cons (idx1, idxN)));
-}
-#undef FUNC_NAME
-
-
-SCM_DEFINE (scm_i_array_set_x, "array-set!", 2, 2, 1,
- (SCM v, SCM obj, SCM idx0, SCM idx1, SCM idxN),
- "Set the element at the @code{(idx0, idx1, idxN...)} position\n"
- "in the array @var{v} to @var{obj}. The value returned by\n"
- "@code{array-set!} is unspecified.")
-#define FUNC_NAME s_scm_i_array_set_x
-{
- if (SCM_UNBNDP (idx0))
- scm_array_set_x (v, obj, SCM_EOL);
- else if (SCM_UNBNDP (idx1))
- scm_c_array_set_1_x (v, obj, scm_to_ssize_t (idx0));
- else if (scm_is_null (idxN))
- scm_c_array_set_2_x (v, obj, scm_to_ssize_t (idx0), scm_to_ssize_t (idx1));
- else
- scm_array_set_x (v, obj, scm_cons (idx0, scm_cons (idx1, idxN)));
-
- return SCM_UNSPECIFIED;
-}
-#undef FUNC_NAME
-
-
-static SCM
-array_to_list (scm_t_array_handle *h, size_t dim, unsigned long pos)
-{
- if (dim == scm_array_handle_rank (h))
- return scm_array_handle_ref (h, pos);
- else
- {
- SCM res = SCM_EOL;
- long inc;
- size_t i;
-
- i = h->dims[dim].ubnd - h->dims[dim].lbnd + 1;
- inc = h->dims[dim].inc;
- pos += (i - 1) * inc;
-
- for (; i > 0; i--, pos -= inc)
- res = scm_cons (array_to_list (h, dim + 1, pos), res);
- return res;
- }
-}
-
-SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0,
- (SCM array),
- "Return a list representation of @var{array}.\n\n"
- "It is easiest to specify the behavior of this function by\n"
- "example:\n"
- "@example\n"
- "(array->list #0(a)) @result{} 1\n"
- "(array->list #1(a b)) @result{} (a b)\n"
- "(array->list #2((aa ab) (ba bb)) @result{} ((aa ab) (ba bb))\n"
- "@end example\n")
-#define FUNC_NAME s_scm_array_to_list
-{
- scm_t_array_handle h;
- SCM res;
-
- scm_array_get_handle (array, &h);
- res = array_to_list (&h, 0, 0);
- scm_array_handle_release (&h);
-
- return res;
-}
-#undef FUNC_NAME
-
-void
-scm_init_generalized_arrays ()
-{
-#include "generalized-arrays.x"
-}
diff --git a/libguile/generalized-arrays.h b/libguile/generalized-arrays.h
deleted file mode 100644
index 130807b29..000000000
--- a/libguile/generalized-arrays.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef SCM_GENERALIZED_ARRAYS_H
-#define SCM_GENERALIZED_ARRAYS_H
-
-/* Copyright 1995-1997,1999-2001,2004,2006,2008-2009,2013-2014,2018
- Free Software Foundation, Inc.
-
- This file is part of Guile.
-
- Guile 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 3 of the License, or
- (at your option) any later version.
-
- Guile 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 Guile. If not, see
- <https://www.gnu.org/licenses/>. */
-
-
-
-#include "libguile/array-handle.h"
-#include "libguile/boolean.h"
-#include <libguile/error.h>
-
-
-
-/* These functions operate on all kinds of arrays that Guile knows about.
- */
-
-
-#define SCM_VALIDATE_ARRAY(pos, v) \
- do { \
- SCM_ASSERT (SCM_HEAP_OBJECT_P (v) \
- && scm_is_true (scm_array_p (v, SCM_UNDEFINED)), \
- v, pos, FUNC_NAME); \
- } while (0)
-
-
-/** Arrays */
-
-SCM_API int scm_is_array (SCM obj);
-SCM_API SCM scm_array_p (SCM v, SCM unused);
-SCM_INTERNAL SCM scm_array_p_2 (SCM);
-
-SCM_API int scm_is_typed_array (SCM obj, SCM type);
-SCM_API SCM scm_typed_array_p (SCM v, SCM type);
-
-SCM_API size_t scm_c_array_length (SCM ra);
-SCM_API SCM scm_array_length (SCM ra);
-
-SCM_API SCM scm_array_dimensions (SCM ra);
-SCM_API SCM scm_array_type (SCM ra);
-SCM_API SCM scm_array_type_code (SCM ra);
-SCM_API SCM scm_array_in_bounds_p (SCM v, SCM args);
-
-SCM_API SCM scm_c_array_ref_1 (SCM v, ssize_t idx0);
-SCM_API SCM scm_c_array_ref_2 (SCM v, ssize_t idx0, ssize_t idx1);
-
-SCM_API void scm_c_array_set_1_x (SCM v, SCM obj, ssize_t idx0);
-SCM_API void scm_c_array_set_2_x (SCM v, SCM obj, ssize_t idx0, ssize_t idx1);
-
-SCM_API SCM scm_array_ref (SCM v, SCM args);
-SCM_API SCM scm_array_set_x (SCM v, SCM obj, SCM args);
-SCM_API SCM scm_array_to_list (SCM v);
-
-SCM_INTERNAL void scm_init_generalized_arrays (void);
-
-
-#endif /* SCM_GENERALIZED_ARRAYS_H */
diff --git a/libguile/init.c b/libguile/init.c
index beffc2c7a..4f4c65bf3 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -77,7 +77,6 @@
#include "fports.h"
#include "frames.h"
#include "gc.h"
-#include "generalized-arrays.h"
#include "generalized-vectors.h"
#include "gettext.h"
#include "goops.h"
@@ -446,7 +445,6 @@ scm_i_init_guile (void *base)
scm_init_srcprop (); /* requires smob_prehistory */
scm_init_stackchk ();
- scm_init_generalized_arrays ();
scm_init_generalized_vectors ();
scm_init_vectors (); /* Requires array-handle, */
scm_init_uniform ();
diff --git a/libguile/loader.h b/libguile/loader.h
index 7c474bc85..28452a1c7 100644
--- a/libguile/loader.h
+++ b/libguile/loader.h
@@ -40,7 +40,7 @@
/* Major and minor versions must be single characters. */
#define SCM_OBJCODE_MAJOR_VERSION 4
#define SCM_OBJCODE_MINIMUM_MINOR_VERSION 2
-#define SCM_OBJCODE_MINOR_VERSION 5
+#define SCM_OBJCODE_MINOR_VERSION 6
#define SCM_OBJCODE_MAJOR_VERSION_STRING \
SCM_CPP_STRINGIFY(SCM_OBJCODE_MAJOR_VERSION)
#define SCM_OBJCODE_MINOR_VERSION_STRING \
diff --git a/libguile/print.h b/libguile/print.h
index b9cc20a6b..587475362 100644
--- a/libguile/print.h
+++ b/libguile/print.h
@@ -74,7 +74,7 @@ typedef struct scm_print_state {
unsigned long ceiling; /* Max size of reference stack */
SCM ref_vect; /* Stack of references used during
circular reference detection;
- a simple vector. */
+ a vector. */
SCM highlight_objects; /* List of objects to be highlighted */
} scm_print_state;
diff --git a/libguile/random.c b/libguile/random.c
index 63da7f5d6..c6755e677 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -39,7 +39,6 @@
#include "arrays.h"
#include "feature.h"
-#include "generalized-arrays.h"
#include "generalized-vectors.h"
#include "gsubr.h"
#include "list.h"
diff --git a/libguile/sort.c b/libguile/sort.c
index 05ecee577..38f64c37c 100644
--- a/libguile/sort.c
+++ b/libguile/sort.c
@@ -46,7 +46,6 @@
#include "dynwind.h"
#include "eval.h"
#include "feature.h"
-#include "generalized-arrays.h"
#include "gsubr.h"
#include "list.h"
#include "pairs.h"
diff --git a/libguile/srfi-4.h b/libguile/srfi-4.h
index 3f279e6ef..c885f7a47 100644
--- a/libguile/srfi-4.h
+++ b/libguile/srfi-4.h
@@ -2,7 +2,7 @@
#define SCM_SRFI_4_H
/* srfi-4.c --- Homogeneous numeric vector datatypes.
- Copyright 2001,2004,2006,2008-2011,2014,2018
+ Copyright 2001,2004,2006,2008-2011,2014,2018,2021
Free Software Foundation, Inc.
This file is part of Guile.
@@ -26,254 +26,39 @@
SCM_API SCM scm_make_srfi_4_vector (SCM type, SCM len, SCM fill);
-
/* Specific procedures.
*/
-SCM_API SCM scm_u8vector_p (SCM obj);
-SCM_API SCM scm_make_u8vector (SCM n, SCM fill);
-SCM_API SCM scm_take_u8vector (uint8_t *data, size_t n);
-SCM_API SCM scm_u8vector (SCM l);
-SCM_API SCM scm_u8vector_length (SCM uvec);
-SCM_API SCM scm_u8vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_u8vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_u8vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_u8vector (SCM l);
-SCM_API SCM scm_any_to_u8vector (SCM obj);
-SCM_API const uint8_t *scm_array_handle_u8_elements (scm_t_array_handle *h);
-SCM_API uint8_t *scm_array_handle_u8_writable_elements (scm_t_array_handle *h);
-SCM_API const uint8_t *scm_u8vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API uint8_t *scm_u8vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_s8vector_p (SCM obj);
-SCM_API SCM scm_make_s8vector (SCM n, SCM fill);
-SCM_API SCM scm_take_s8vector (int8_t *data, size_t n);
-SCM_API SCM scm_s8vector (SCM l);
-SCM_API SCM scm_s8vector_length (SCM uvec);
-SCM_API SCM scm_s8vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_s8vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_s8vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_s8vector (SCM l);
-SCM_API SCM scm_any_to_s8vector (SCM obj);
-SCM_API const int8_t *scm_array_handle_s8_elements (scm_t_array_handle *h);
-SCM_API int8_t *scm_array_handle_s8_writable_elements (scm_t_array_handle *h);
-SCM_API const int8_t *scm_s8vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API int8_t *scm_s8vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_u16vector_p (SCM obj);
-SCM_API SCM scm_make_u16vector (SCM n, SCM fill);
-SCM_API SCM scm_take_u16vector (uint16_t *data, size_t n);
-SCM_API SCM scm_u16vector (SCM l);
-SCM_API SCM scm_u16vector_length (SCM uvec);
-SCM_API SCM scm_u16vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_u16vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_u16vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_u16vector (SCM l);
-SCM_API SCM scm_any_to_u16vector (SCM obj);
-SCM_API const uint16_t *scm_array_handle_u16_elements (scm_t_array_handle *h);
-SCM_API uint16_t *scm_array_handle_u16_writable_elements (scm_t_array_handle *h);
-SCM_API const uint16_t *scm_u16vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-SCM_API uint16_t *scm_u16vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_s16vector_p (SCM obj);
-SCM_API SCM scm_make_s16vector (SCM n, SCM fill);
-SCM_API SCM scm_take_s16vector (int16_t *data, size_t n);
-SCM_API SCM scm_s16vector (SCM l);
-SCM_API SCM scm_s16vector_length (SCM uvec);
-SCM_API SCM scm_s16vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_s16vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_s16vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_s16vector (SCM l);
-SCM_API SCM scm_any_to_s16vector (SCM obj);
-SCM_API const int16_t *scm_array_handle_s16_elements (scm_t_array_handle *h);
-SCM_API int16_t *scm_array_handle_s16_writable_elements (scm_t_array_handle *h);
-SCM_API const int16_t *scm_s16vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API int16_t *scm_s16vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_u32vector_p (SCM obj);
-SCM_API SCM scm_make_u32vector (SCM n, SCM fill);
-SCM_API SCM scm_take_u32vector (uint32_t *data, size_t n);
-SCM_API SCM scm_u32vector (SCM l);
-SCM_API SCM scm_u32vector_length (SCM uvec);
-SCM_API SCM scm_u32vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_u32vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_u32vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_u32vector (SCM l);
-SCM_API SCM scm_any_to_u32vector (SCM obj);
-SCM_API const uint32_t *scm_array_handle_u32_elements (scm_t_array_handle *h);
-SCM_API uint32_t *scm_array_handle_u32_writable_elements (scm_t_array_handle *h);
-SCM_API const uint32_t *scm_u32vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-SCM_API uint32_t *scm_u32vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_s32vector_p (SCM obj);
-SCM_API SCM scm_make_s32vector (SCM n, SCM fill);
-SCM_API SCM scm_take_s32vector (int32_t *data, size_t n);
-SCM_API SCM scm_s32vector (SCM l);
-SCM_API SCM scm_s32vector_length (SCM uvec);
-SCM_API SCM scm_s32vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_s32vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_s32vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_s32vector (SCM l);
-SCM_API SCM scm_any_to_s32vector (SCM obj);
-SCM_API const int32_t *scm_array_handle_s32_elements (scm_t_array_handle *h);
-SCM_API int32_t *scm_array_handle_s32_writable_elements (scm_t_array_handle *h);
-SCM_API const int32_t *scm_s32vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API int32_t *scm_s32vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_u64vector_p (SCM obj);
-SCM_API SCM scm_make_u64vector (SCM n, SCM fill);
-SCM_API SCM scm_u64vector (SCM l);
-SCM_API SCM scm_u64vector_length (SCM uvec);
-SCM_API SCM scm_u64vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_u64vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_u64vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_u64vector (SCM l);
-SCM_API SCM scm_any_to_u64vector (SCM obj);
-
-SCM_API SCM scm_take_u64vector (uint64_t *data, size_t n);
-SCM_API const uint64_t *scm_array_handle_u64_elements (scm_t_array_handle *h);
-SCM_API uint64_t *scm_array_handle_u64_writable_elements (scm_t_array_handle *h);
-SCM_API const uint64_t *scm_u64vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-SCM_API uint64_t *scm_u64vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_s64vector_p (SCM obj);
-SCM_API SCM scm_make_s64vector (SCM n, SCM fill);
-SCM_API SCM scm_s64vector (SCM l);
-SCM_API SCM scm_s64vector_length (SCM uvec);
-SCM_API SCM scm_s64vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_s64vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_s64vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_s64vector (SCM l);
-SCM_API SCM scm_any_to_s64vector (SCM obj);
-
-SCM_API SCM scm_take_s64vector (int64_t *data, size_t n);
-SCM_API const int64_t *scm_array_handle_s64_elements (scm_t_array_handle *h);
-SCM_API int64_t *scm_array_handle_s64_writable_elements (scm_t_array_handle *h);
-SCM_API const int64_t *scm_s64vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API int64_t *scm_s64vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_f32vector_p (SCM obj);
-SCM_API SCM scm_make_f32vector (SCM n, SCM fill);
-SCM_API SCM scm_take_f32vector (float *data, size_t n);
-SCM_API SCM scm_f32vector (SCM l);
-SCM_API SCM scm_f32vector_length (SCM uvec);
-SCM_API SCM scm_f32vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_f32vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_f32vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_f32vector (SCM l);
-SCM_API SCM scm_any_to_f32vector (SCM obj);
-SCM_API const float *scm_array_handle_f32_elements (scm_t_array_handle *h);
-SCM_API float *scm_array_handle_f32_writable_elements (scm_t_array_handle *h);
-SCM_API const float *scm_f32vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API float *scm_f32vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_f64vector_p (SCM obj);
-SCM_API SCM scm_make_f64vector (SCM n, SCM fill);
-SCM_API SCM scm_take_f64vector (double *data, size_t n);
-SCM_API SCM scm_f64vector (SCM l);
-SCM_API SCM scm_f64vector_length (SCM uvec);
-SCM_API SCM scm_f64vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_f64vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_f64vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_f64vector (SCM l);
-SCM_API SCM scm_any_to_f64vector (SCM obj);
-SCM_API const double *scm_array_handle_f64_elements (scm_t_array_handle *h);
-SCM_API double *scm_array_handle_f64_writable_elements (scm_t_array_handle *h);
-SCM_API const double *scm_f64vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API double *scm_f64vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_c32vector_p (SCM obj);
-SCM_API SCM scm_make_c32vector (SCM n, SCM fill);
-SCM_API SCM scm_take_c32vector (float *data, size_t n);
-SCM_API SCM scm_c32vector (SCM l);
-SCM_API SCM scm_c32vector_length (SCM uvec);
-SCM_API SCM scm_c32vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_c32vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_c32vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_c32vector (SCM l);
-SCM_API SCM scm_any_to_c32vector (SCM obj);
-SCM_API const float *scm_array_handle_c32_elements (scm_t_array_handle *h);
-SCM_API float *scm_array_handle_c32_writable_elements (scm_t_array_handle *h);
-SCM_API const float *scm_c32vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API float *scm_c32vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
-
-SCM_API SCM scm_c64vector_p (SCM obj);
-SCM_API SCM scm_make_c64vector (SCM n, SCM fill);
-SCM_API SCM scm_take_c64vector (double *data, size_t n);
-SCM_API SCM scm_c64vector (SCM l);
-SCM_API SCM scm_c64vector_length (SCM uvec);
-SCM_API SCM scm_c64vector_ref (SCM uvec, SCM index);
-SCM_API SCM scm_c64vector_set_x (SCM uvec, SCM index, SCM value);
-SCM_API SCM scm_c64vector_to_list (SCM uvec);
-SCM_API SCM scm_list_to_c64vector (SCM l);
-SCM_API SCM scm_any_to_c64vector (SCM obj);
-SCM_API const double *scm_array_handle_c64_elements (scm_t_array_handle *h);
-SCM_API double *scm_array_handle_c64_writable_elements (scm_t_array_handle *h);
-SCM_API const double *scm_c64vector_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp, ssize_t *incp);
-SCM_API double *scm_c64vector_writable_elements (SCM uvec,
- scm_t_array_handle *h,
- size_t *lenp,
- ssize_t *incp);
+#define SCM_SRFI4_DECL(tag, type) \
+ SCM_API SCM scm_##tag##vector_p (SCM obj); \
+ SCM_API SCM scm_make_##tag##vector (SCM n, SCM fill); \
+ SCM_API SCM scm_take_##tag##vector (type *data, size_t n); \
+ SCM_API SCM scm_##tag##vector (SCM l); \
+ SCM_API SCM scm_##tag##vector_length (SCM uvec); \
+ SCM_API SCM scm_##tag##vector_ref (SCM uvec, SCM index); \
+ SCM_API SCM scm_##tag##vector_set_x (SCM uvec, SCM index, SCM value); \
+ SCM_API SCM scm_##tag##vector_to_list (SCM uvec); \
+ SCM_API SCM scm_list_to_##tag##vector (SCM l); \
+ SCM_API SCM scm_any_to_##tag##vector (SCM obj); \
+ SCM_API const type *scm_array_handle_##tag##_elements (scm_t_array_handle *h); \
+ SCM_API type *scm_array_handle_##tag##_writable_elements (scm_t_array_handle *h); \
+ SCM_API const type *scm_##tag##vector_elements (SCM uvec, scm_t_array_handle *h, size_t *lenp, ssize_t *incp); \
+ SCM_API type *scm_##tag##vector_writable_elements (SCM uvec, scm_t_array_handle *h, size_t *lenp, ssize_t *incp);
+
+SCM_SRFI4_DECL (u8, uint8_t)
+SCM_SRFI4_DECL (s8, int8_t)
+SCM_SRFI4_DECL (u16, uint16_t)
+SCM_SRFI4_DECL (s16, int16_t)
+SCM_SRFI4_DECL (u32, uint32_t)
+SCM_SRFI4_DECL (s32, int32_t)
+SCM_SRFI4_DECL (u64, uint64_t)
+SCM_SRFI4_DECL (s64, int64_t)
+SCM_SRFI4_DECL (f32, float)
+SCM_SRFI4_DECL (f64, double)
+SCM_SRFI4_DECL (c32, float)
+SCM_SRFI4_DECL (c64, double)
+
+#undef SCM_SRFI4_DECL
SCM_INTERNAL void scm_init_srfi_4 (void);
diff --git a/libguile/vectors.c b/libguile/vectors.c
index 0f1e6085e..8cbd201f5 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -24,19 +24,20 @@
# include <config.h>
#endif
+#include <string.h>
+
#include "array-handle.h"
#include "bdw-gc.h"
#include "boolean.h"
+#include "deprecation.h"
#include "eq.h"
+#include "generalized-vectors.h"
#include "gsubr.h"
#include "list.h"
#include "numbers.h"
#include "pairs.h"
#include "vectors.h"
-#include "generalized-vectors.h"
-
-
#define VECTOR_MAX_LENGTH (SCM_T_BITS_MAX >> 8)
@@ -54,21 +55,15 @@ scm_is_vector (SCM obj)
return SCM_I_IS_VECTOR (obj);
}
-int
-scm_is_simple_vector (SCM obj)
-{
- return SCM_I_IS_VECTOR (obj);
-}
-
const SCM *
-scm_vector_elements (SCM vec, scm_t_array_handle *h,
+scm_vector_elements (SCM array, scm_t_array_handle *h,
size_t *lenp, ssize_t *incp)
{
- scm_array_get_handle (vec, h);
+ scm_array_get_handle (array, h);
if (1 != scm_array_handle_rank (h))
{
scm_array_handle_release (h);
- scm_wrong_type_arg_msg (NULL, 0, vec, "rank 1 array of Scheme values");
+ scm_wrong_type_arg_msg (NULL, 0, array, "rank 1 array of Scheme values");
}
if (lenp)
@@ -81,13 +76,13 @@ scm_vector_elements (SCM vec, scm_t_array_handle *h,
}
SCM *
-scm_vector_writable_elements (SCM vec, scm_t_array_handle *h,
+scm_vector_writable_elements (SCM array, scm_t_array_handle *h,
size_t *lenp, ssize_t *incp)
{
- const SCM *ret = scm_vector_elements (vec, h, lenp, incp);
+ const SCM *ret = scm_vector_elements (array, h, lenp, incp);
if (h->writable_elements != h->elements)
- scm_wrong_type_arg_msg (NULL, 0, vec, "mutable vector");
+ scm_wrong_type_arg_msg (NULL, 0, array, "mutable rank 1 array of Scheme values");
return (SCM *) ret;
}
@@ -264,34 +259,116 @@ scm_c_make_vector (size_t k, SCM fill)
}
#undef FUNC_NAME
-SCM_DEFINE (scm_vector_copy, "vector-copy", 1, 0, 0,
- (SCM vec),
- "Return a copy of @var{vec}.")
-#define FUNC_NAME s_scm_vector_copy
+SCM_DEFINE (scm_vector_copy_partial, "vector-copy", 1, 2, 0,
+ (SCM vec, SCM start, SCM end),
+ "Returns a freshly allocated vector containing the elements\n"
+ "of @var{vec} between @var{start} and @var{end}.\n\n"
+ "@var{start} defaults to 0 and @var{end} defaults to the\n"
+ "length of @var{vec}.")
+#define FUNC_NAME s_scm_vector_copy_partial
{
- scm_t_array_handle handle;
- size_t i, len;
- ssize_t inc;
- const SCM *src;
- SCM result, *dst;
+ SCM result;
+ if (SCM_I_IS_VECTOR (vec))
+ {
+ size_t cstart = 0, cend = SCM_I_VECTOR_LENGTH (vec);
+
+ if (!SCM_UNBNDP (start))
+ {
+ cstart = scm_to_size_t (start);
+ SCM_ASSERT_RANGE (SCM_ARG2, start, cstart<=cend);
+
+ if (!SCM_UNBNDP (end))
+ {
+ size_t e = scm_to_size_t (end);
+ SCM_ASSERT_RANGE (SCM_ARG3, end, e>=cstart && e<=cend);
+ cend = e;
+ }
+ }
+
+ size_t len = cend-cstart;
+ result = make_vector (len);
+ memcpy (SCM_I_VECTOR_WELTS (result), SCM_I_VECTOR_ELTS (vec) + cstart,
+ len * sizeof(SCM));
+ }
+ else
+ {
+ scm_t_array_handle handle;
+ size_t i, len;
+ ssize_t inc;
+ const SCM *src;
+ SCM *dst;
+
+ src = scm_vector_elements (vec, &handle, &len, &inc);
+ scm_c_issue_deprecation_warning
+ ("Using vector-copy on arrays is deprecated. "
+ "Use array-copy instead.");
+
+ if (SCM_UNBNDP (start))
+ scm_misc_error (s_scm_vector_copy_partial, "Too many arguments", SCM_EOL);
+
+ result = make_vector (len);
+ dst = SCM_I_VECTOR_WELTS (result);
+ for (i = 0; i < len; i++, src += inc)
+ dst[i] = *src;
+
+ scm_array_handle_release (&handle);
+ }
+ return result;
+}
+#undef FUNC_NAME
- src = scm_vector_elements (vec, &handle, &len, &inc);
+SCM
+scm_vector_copy (SCM vec)
+{
+ return scm_vector_copy_partial (vec, SCM_UNDEFINED, SCM_UNDEFINED);
+}
- result = make_vector (len);
- dst = SCM_I_VECTOR_WELTS (result);
- for (i = 0; i < len; i++, src += inc)
- dst[i] = *src;
+SCM_DEFINE (scm_vector_copy_x, "vector-copy!", 3, 2, 0,
+ (SCM dst, SCM at, SCM src, SCM start, SCM end),
+ "Copy a block of elements from @var{src} to @var{dst}, both of which must be\n"
+ "vectors, starting in @var{dst} at @var{at} and starting in @var{src} at\n"
+ "@var{start} and ending at @var{end}.\n\n"
+ "It is an error for @var{dst} to have a length less than\n"
+ "@var{at} + (@var{end} - @var{start}). @var{at} and @var{start} default\n"
+ "to 0 and @var{end} defaults to the length of @var{src}.\n\n"
+ "The order in which elements are copied is unspecified, except that if the\n"
+ "source and destination overlap, copying takes place as if the source is\n"
+ "first copied into a temporary vector and then into the destination.")
+#define FUNC_NAME s_scm_vector_copy_x
+{
+ SCM_VALIDATE_MUTABLE_VECTOR (1, dst);
+ SCM_VALIDATE_VECTOR (3, src);
+ size_t src_org = 0;
+ size_t dst_org = scm_to_size_t (at);
+ size_t src_end = SCM_I_VECTOR_LENGTH (src);
+ size_t dst_end = SCM_I_VECTOR_LENGTH (dst);
- scm_array_handle_release (&handle);
+ if (!SCM_UNBNDP (start))
+ {
+ src_org = scm_to_size_t (start);
+ SCM_ASSERT_RANGE (SCM_ARG4, start, src_org<=src_end);
+
+ if (!SCM_UNBNDP (end))
+ {
+ size_t e = scm_to_size_t (end);
+ SCM_ASSERT_RANGE (SCM_ARG5, end, e>=src_org && e<=src_end);
+ src_end = e;
+ }
+ }
+ size_t len = src_end-src_org;
+ SCM_ASSERT_RANGE (SCM_ARG2, at, dst_org<=dst_end && len<=dst_end-dst_org);
- return result;
+ memmove (SCM_I_VECTOR_WELTS (dst) + dst_org, SCM_I_VECTOR_ELTS (src) + src_org,
+ len * sizeof(SCM));
+
+ return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE (scm_vector_to_list, "vector->list", 1, 0, 0,
- (SCM v),
- "Return a newly allocated list composed of the elements of @var{v}.\n"
+ (SCM vec),
+ "Return a newly allocated list composed of the elements of @var{vec}.\n"
"\n"
"@lisp\n"
"(vector->list '#(dah dah didah)) @result{} (dah dah didah)\n"
@@ -300,18 +377,33 @@ SCM_DEFINE (scm_vector_to_list, "vector->list", 1, 0, 0,
#define FUNC_NAME s_scm_vector_to_list
{
SCM res = SCM_EOL;
- const SCM *data;
- scm_t_array_handle handle;
- size_t i, count, len;
- ssize_t inc;
-
- data = scm_vector_elements (v, &handle, &len, &inc);
- for (i = (len - 1) * inc, count = 0;
- count < len;
- i -= inc, count++)
- res = scm_cons (data[i], res);
-
- scm_array_handle_release (&handle);
+
+ if (SCM_I_IS_VECTOR (vec))
+ {
+ ssize_t len = SCM_I_VECTOR_LENGTH (vec);
+ const SCM * data = SCM_I_VECTOR_ELTS (vec);
+ for (ssize_t i = len-1; i >= 0; --i)
+ res = scm_cons (data[i], res);
+ }
+ else
+ {
+ const SCM *data;
+ scm_t_array_handle handle;
+ size_t i, count, len;
+ ssize_t inc;
+
+ data = scm_vector_elements (vec, &handle, &len, &inc);
+ scm_c_issue_deprecation_warning
+ ("Using vector->list on arrays is deprecated. "
+ "Use array->list instead.");
+
+ for (i = (len - 1) * inc, count = 0;
+ count < len;
+ i -= inc, count++)
+ res = scm_cons (data[i], res);
+
+ scm_array_handle_release (&handle);
+ }
return res;
}
#undef FUNC_NAME
@@ -320,27 +412,24 @@ static SCM scm_vector_fill_partial_x (SCM vec, SCM fill, SCM start, SCM end);
SCM_DEFINE_STATIC (scm_vector_fill_partial_x, "vector-fill!", 2, 2, 0,
(SCM vec, SCM fill, SCM start, SCM end),
- "Assign the value of every location in vector @var{vec} between\n"
- "@var{start} and @var{end} to @var{fill}. @var{start} defaults\n"
+ "Assign the value of every location in vector @var{vec} in the range\n"
+ "[@var{start} ... @var{end}) to @var{fill}. @var{start} defaults\n"
"to 0 and @var{end} defaults to the length of @var{vec}. The value\n"
"returned by @code{vector-fill!} is unspecified.")
#define FUNC_NAME s_scm_vector_fill_partial_x
{
SCM_VALIDATE_MUTABLE_VECTOR(1, vec);
- SCM *data;
size_t i = 0;
- size_t len = SCM_I_VECTOR_LENGTH (vec);
-
- data = SCM_I_VECTOR_WELTS (vec);
+ size_t c_end = SCM_I_VECTOR_LENGTH (vec);
+ SCM *data = SCM_I_VECTOR_WELTS (vec);
if (!SCM_UNBNDP (start))
- i = scm_to_unsigned_integer (start, 0, len);
-
+ i = scm_to_unsigned_integer (start, 0, c_end);
if (!SCM_UNBNDP (end))
- len = scm_to_unsigned_integer (end, i, len);
+ c_end = scm_to_unsigned_integer (end, i, c_end);
- for (; i < len; ++i)
+ for (; i < c_end; ++i)
data[i] = fill;
return SCM_UNSPECIFIED;
@@ -380,31 +469,53 @@ SCM_DEFINE (scm_vector_move_left_x, "vector-move-left!", 5, 0, 0,
"@var{start1} is greater than @var{start2}.")
#define FUNC_NAME s_scm_vector_move_left_x
{
- scm_t_array_handle handle1, handle2;
- const SCM *elts1;
- SCM *elts2;
- size_t len1, len2;
- ssize_t inc1, inc2;
- size_t i, j, e;
-
- elts1 = scm_vector_elements (vec1, &handle1, &len1, &inc1);
- elts2 = scm_vector_writable_elements (vec2, &handle2, &len2, &inc2);
-
- i = scm_to_unsigned_integer (start1, 0, len1);
- e = scm_to_unsigned_integer (end1, i, len1);
- SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
- j = scm_to_unsigned_integer (start2, 0, len2);
- SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
-
- i *= inc1;
- e *= inc1;
- j *= inc2;
- for (; i < e; i += inc1, j += inc2)
- elts2[j] = elts1[i];
-
- scm_array_handle_release (&handle2);
- scm_array_handle_release (&handle1);
-
+ if (SCM_I_IS_VECTOR (vec1) && SCM_I_IS_VECTOR (vec2))
+ {
+ SCM_VALIDATE_MUTABLE_VECTOR (1, vec2);
+ const SCM *elts1 = SCM_I_VECTOR_ELTS (vec1);
+ SCM *elts2 = SCM_I_VECTOR_WELTS (vec2);
+ size_t len1 = SCM_I_VECTOR_LENGTH (vec1);
+ size_t len2 = SCM_I_VECTOR_LENGTH (vec2);
+
+ size_t i, j, e;
+ i = scm_to_unsigned_integer (start1, 0, len1);
+ e = scm_to_unsigned_integer (end1, i, len1);
+ SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
+ j = scm_to_unsigned_integer (start2, 0, len2);
+ SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
+ for (; i < e; ++i, ++j)
+ elts2[j] = elts1[i];
+ }
+ else
+ {
+ scm_t_array_handle handle1, handle2;
+ const SCM *elts1;
+ SCM *elts2;
+ size_t len1, len2;
+ ssize_t inc1, inc2;
+ size_t i, j, e;
+
+ elts1 = scm_vector_elements (vec1, &handle1, &len1, &inc1);
+ elts2 = scm_vector_writable_elements (vec2, &handle2, &len2, &inc2);
+ scm_c_issue_deprecation_warning
+ ("Using vector-move-left! on arrays is deprecated. "
+ "Use array-copy-in-order! instead.");
+
+ i = scm_to_unsigned_integer (start1, 0, len1);
+ e = scm_to_unsigned_integer (end1, i, len1);
+ SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
+ j = scm_to_unsigned_integer (start2, 0, len2);
+ SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
+
+ i *= inc1;
+ e *= inc1;
+ j *= inc2;
+ for (; i < e; i += inc1, j += inc2)
+ elts2[j] = elts1[i];
+
+ scm_array_handle_release (&handle2);
+ scm_array_handle_release (&handle1);
+ }
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
@@ -420,36 +531,65 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0,
"@var{start1} is less than @var{start2}.")
#define FUNC_NAME s_scm_vector_move_right_x
{
- scm_t_array_handle handle1, handle2;
- const SCM *elts1;
- SCM *elts2;
- size_t len1, len2;
- ssize_t inc1, inc2;
- size_t i, j, e;
-
- elts1 = scm_vector_elements (vec1, &handle1, &len1, &inc1);
- elts2 = scm_vector_writable_elements (vec2, &handle2, &len2, &inc2);
-
- i = scm_to_unsigned_integer (start1, 0, len1);
- e = scm_to_unsigned_integer (end1, i, len1);
- SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
- j = scm_to_unsigned_integer (start2, 0, len2);
- SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
-
- j += (e - i);
-
- i *= inc1;
- e *= inc1;
- j *= inc2;
- while (i < e)
+ if (SCM_I_IS_VECTOR (vec1) && SCM_I_IS_VECTOR (vec2))
{
- e -= inc1;
- j -= inc2;
- elts2[j] = elts1[e];
+ SCM_VALIDATE_MUTABLE_VECTOR (1, vec2);
+ const SCM *elts1 = SCM_I_VECTOR_ELTS (vec1);
+ SCM *elts2 = SCM_I_VECTOR_WELTS (vec2);
+ size_t len1 = SCM_I_VECTOR_LENGTH (vec1);
+ size_t len2 = SCM_I_VECTOR_LENGTH (vec2);
+
+ size_t i, j, e;
+ i = scm_to_unsigned_integer (start1, 0, len1);
+ e = scm_to_unsigned_integer (end1, i, len1);
+ SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
+ j = scm_to_unsigned_integer (start2, 0, len2);
+ SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
+ j += (e - i);
+
+ while (i < e)
+ {
+ --e;
+ --j;
+ elts2[j] = elts1[e];
+ }
+ }
+ else
+ {
+ scm_t_array_handle handle1, handle2;
+ const SCM *elts1;
+ SCM *elts2;
+ size_t len1, len2;
+ ssize_t inc1, inc2;
+ size_t i, j, e;
+
+ elts1 = scm_vector_elements (vec1, &handle1, &len1, &inc1);
+ elts2 = scm_vector_writable_elements (vec2, &handle2, &len2, &inc2);
+ scm_c_issue_deprecation_warning
+ ("Using vector-move-right! on arrays is deprecated. "
+ "Use array-copy-in-order! instead.");
+
+ i = scm_to_unsigned_integer (start1, 0, len1);
+ e = scm_to_unsigned_integer (end1, i, len1);
+ SCM_ASSERT_RANGE (SCM_ARG3, end1, (e-i) <= len2);
+ j = scm_to_unsigned_integer (start2, 0, len2);
+ SCM_ASSERT_RANGE (SCM_ARG5, start2, j <= len2 - (e - i));
+
+ j += (e - i);
+
+ i *= inc1;
+ e *= inc1;
+ j *= inc2;
+ while (i < e)
+ {
+ e -= inc1;
+ j -= inc2;
+ elts2[j] = elts1[e];
+ }
+
+ scm_array_handle_release (&handle2);
+ scm_array_handle_release (&handle1);
}
-
- scm_array_handle_release (&handle2);
- scm_array_handle_release (&handle1);
return SCM_UNSPECIFIED;
}
diff --git a/libguile/vectors.h b/libguile/vectors.h
index 41e2c8909..005999a2b 100644
--- a/libguile/vectors.h
+++ b/libguile/vectors.h
@@ -41,17 +41,18 @@ SCM_API SCM scm_vector_move_left_x (SCM vec1, SCM start1, SCM end1,
SCM_API SCM scm_vector_move_right_x (SCM vec1, SCM start1, SCM end1,
SCM vec2, SCM start2);
SCM_API SCM scm_vector_copy (SCM vec);
+SCM_API SCM scm_vector_copy_partial (SCM vec, SCM start, SCM end);
+SCM_API SCM scm_vector_copy_x (SCM dst, SCM at, SCM src, SCM start, SCM end);
SCM_API int scm_is_vector (SCM obj);
-SCM_API int scm_is_simple_vector (SCM obj);
SCM_API SCM scm_c_make_vector (size_t len, SCM fill);
SCM_API size_t scm_c_vector_length (SCM vec);
SCM_API SCM scm_c_vector_ref (SCM vec, size_t k);
SCM_API void scm_c_vector_set_x (SCM vec, size_t k, SCM obj);
-SCM_API const SCM *scm_vector_elements (SCM vec,
+SCM_API const SCM *scm_vector_elements (SCM array,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
-SCM_API SCM *scm_vector_writable_elements (SCM vec,
+SCM_API SCM *scm_vector_writable_elements (SCM array,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
@@ -65,7 +66,7 @@ SCM_API SCM *scm_vector_writable_elements (SCM vec,
SCM_ASSERT (scm_is_vector (v) && len == scm_c_vector_length (v), v, pos, FUNC_NAME); \
} while (0)
-/* Fast, non-checking accessors for simple vectors.
+/* Fast, non-checking accessors
*/
#define SCM_SIMPLE_VECTOR_LENGTH(x) SCM_I_VECTOR_LENGTH(x)
#define SCM_SIMPLE_VECTOR_REF(x,idx) ((SCM_I_VECTOR_ELTS(x))[idx])
@@ -87,9 +88,7 @@ SCM_API SCM *scm_vector_writable_elements (SCM vec,
#define SCM_I_VECTOR_WELTS(x) (SCM_CELL_OBJECT_LOC (x, 1))
#define SCM_I_VECTOR_LENGTH(x) (((size_t) SCM_CELL_WORD_0 (x)) >> 8)
-SCM_INTERNAL SCM scm_i_vector_equal_p (SCM x, SCM y);
-
-
+SCM_INTERNAL SCM scm_i_vector_equal_p (SCM x, SCM y);
SCM_INTERNAL void scm_init_vectors (void);
#endif /* SCM_VECTORS_H */
diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4
index c4e386d1f..a3ba25624 100644
--- a/m4/arpa_inet_h.m4
+++ b/m4/arpa_inet_h.m4
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 14
+# arpa_inet_h.m4 serial 17
dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Simon Josefsson and Bruno Haible
-AC_DEFUN([gl_HEADER_ARPA_INET],
+AC_DEFUN_ONCE([gl_ARPA_INET_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
AC_CHECK_HEADERS_ONCE([arpa/inet.h])
@@ -40,17 +40,32 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
]], [inet_ntop inet_pton])
])
+# gl_ARPA_INET_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_ARPA_INET_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
+])
+
AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
[
- GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP])
- GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4
index 6d8614258..17e2a20c5 100644
--- a/m4/dirent_h.m4
+++ b/m4/dirent_h.m4
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 16
+# dirent_h.m4 serial 19
dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Bruno Haible.
-AC_DEFUN([gl_DIRENT_H],
+AC_DEFUN_ONCE([gl_DIRENT_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
dnl <dirent.h> is always overridden, because of GNULIB_POSIXCHECK.
@@ -27,26 +27,41 @@ AC_DEFUN([gl_DIRENT_H],
]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir])
])
+# gl_DIRENT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_DIRENT_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_DIRENT_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REWINDDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSEDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DIRFD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPENDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALPHASORT])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+])
+
AC_DEFUN([gl_DIRENT_H_DEFAULTS],
[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
- GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR])
- GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR])
- GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR])
- GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR])
- GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
- GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR])
- GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR])
- GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR])
HAVE_READDIR=1; AC_SUBST([HAVE_READDIR])
diff --git a/m4/environ.m4 b/m4/environ.m4
index d97177086..ae5329108 100644
--- a/m4/environ.m4
+++ b/m4/environ.m4
@@ -1,4 +1,4 @@
-# environ.m4 serial 7
+# environ.m4 serial 8
dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -33,7 +33,8 @@ AC_DEFUN([gt_CHECK_VAR_DECL],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[$1
- extern struct { int foo; } $2;]],
+ typedef struct { int foo; } foo_t;
+ extern foo_t $2;]],
[[$2.foo = 1;]])],
[gt_cv_var=no],
[gt_cv_var=yes])])
diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4
index e63a82f10..aba44735d 100644
--- a/m4/fcntl_h.m4
+++ b/m4/fcntl_h.m4
@@ -1,4 +1,4 @@
-# serial 17
+# serial 20
# Configure fcntl.h.
dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Paul Eggert.
-AC_DEFUN([gl_FCNTL_H],
+AC_DEFUN_ONCE([gl_FCNTL_H],
[
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
AC_REQUIRE([gl_FCNTL_O_FLAGS])
@@ -26,25 +26,40 @@ AC_DEFUN([gl_FCNTL_H],
]], [fcntl openat])
])
+# gl_FCNTL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_FCNTL_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+])
+
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
[
- GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT])
- GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL])
- GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING])
- GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
- GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_CREAT=1; AC_SUBST([GNULIB_MDA_CREAT])
- GNULIB_MDA_OPEN=1; AC_SUBST([GNULIB_MDA_OPEN])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
diff --git a/m4/flock.m4 b/m4/flock.m4
index eb46642d8..e1e5fe030 100644
--- a/m4/flock.m4
+++ b/m4/flock.m4
@@ -1,4 +1,4 @@
-# flock.m4 serial 3
+# flock.m4 serial 4
dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FLOCK],
[
- AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
+ AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([flock])
if test $ac_cv_func_flock = no; then
HAVE_FLOCK=0
diff --git a/m4/fstat.m4 b/m4/fstat.m4
index 3b5b238fa..cdaca80da 100644
--- a/m4/fstat.m4
+++ b/m4/fstat.m4
@@ -1,4 +1,4 @@
-# fstat.m4 serial 7
+# fstat.m4 serial 8
dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_FSTAT],
# Prerequisites of lib/fstat.c and lib/stat-w32.c.
AC_DEFUN([gl_PREREQ_FSTAT], [
- AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+ AC_REQUIRE([gl_SYS_STAT_H])
AC_REQUIRE([gl_PREREQ_STAT_W32])
:
])
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index 97889a8b5..3f8e04f9b 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 33
+# getaddrinfo.m4 serial 34
dnl Copyright (C) 2004-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_GETADDRINFO],
[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
- AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H
+ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+ AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H
GETADDRINFO_LIB=
gai_saved_LIBS="$LIBS"
@@ -156,13 +156,13 @@ const char *gai_strerror(int);]])],
# Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c.
AC_DEFUN([gl_PREREQ_GETADDRINFO], [
AC_REQUIRE([gl_NETDB_H_DEFAULTS])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB
AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB
AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_SOCKET_FAMILIES])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
dnl Including sys/socket.h is wrong for Windows, but Windows does not
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index f2eff10de..c801b3de9 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 63
+# gnulib-common.m4 serial 67
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -85,12 +85,12 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0)
# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7)
# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6)
+# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
# ifdef _ICC
# define _GL_ATTR_may_alias 0
# else
# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3)
# endif
-# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
@@ -103,6 +103,12 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
#endif
+#ifdef __has_c_attribute
+# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
+#else
+# define _GL_HAS_C_ATTRIBUTE(attr) 0
+#endif
+
]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead.
[
#if _GL_HAS_ATTRIBUTE (alloc_size)
@@ -142,7 +148,20 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTRIBUTE_CONST
#endif
-#if 201710L < __STDC_VERSION__
+/* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers
+ that can be freed by passing them as the Ith argument to the
+ function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that
+ return pointers that can be freed via 'free'; it can be used
+ only after including stdlib.h. These macros cannot be used on
+ inline functions. */
+#if _GL_GNUC_PREREQ (11, 0)
+# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+#else
+# define _GL_ATTRIBUTE_DEALLOC(f, i)
+#endif
+#define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+
+#if _GL_HAS_C_ATTRIBUTE (deprecated)
# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
#elif _GL_HAS_ATTRIBUTE (deprecated)
# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
@@ -168,7 +187,7 @@ AC_DEFUN([gl_COMMON_BODY], [
#endif
/* FALLTHROUGH is special, because it always expands to something. */
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (fallthrough)
# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
#elif _GL_HAS_ATTRIBUTE (fallthrough)
# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
@@ -188,6 +207,12 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTRIBUTE_LEAF
#endif
+#if _GL_HAS_ATTRIBUTE (malloc)
+# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+#else
+# define _GL_ATTRIBUTE_MALLOC
+#endif
+
/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */
#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
@@ -195,24 +220,15 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTRIBUTE_MAY_ALIAS
#endif
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (maybe_unused)
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
-#elif _GL_HAS_ATTRIBUTE (unused)
-# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
#else
-# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
#endif
/* Earlier spellings of this macro. */
-#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
-#if _GL_HAS_ATTRIBUTE (malloc)
-# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-#else
-# define _GL_ATTRIBUTE_MALLOC
-#endif
-
-#if 201710L < __STDC_VERSION__
+#if _GL_HAS_C_ATTRIBUTE (nodiscard)
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
#elif _GL_HAS_ATTRIBUTE (warn_unused_result)
# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
@@ -270,11 +286,19 @@ AC_DEFUN([gl_COMMON_BODY], [
# define _GL_ATTRIBUTE_SENTINEL(pos)
#endif
+#if _GL_HAS_ATTRIBUTE (unused)
+# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#else
+# define _GL_ATTRIBUTE_UNUSED
+#endif
+/* Earlier spellings of this macro. */
+#define _GL_UNUSED _GL_ATTRIBUTE_UNUSED
+
]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
[
/* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */
#if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5)
-# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED
+# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
#else
# define _GL_UNUSED_LABEL
#endif
@@ -357,6 +381,16 @@ AC_DEFUN([gl_COMMON_BODY], [
export LIBC_FATAL_STDERR_
])
+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename])
+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue])
+# initializes the shell variable that indicates the presence of the given module
+# as a C preprocessor expression.
+AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE],
+[
+ GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2])
+ AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1])
+])
+
# gl_MODULE_INDICATOR_CONDITION
# expands to a C preprocessor expression that evaluates to 1 or 0, depending
# whether a gnulib module that has been requested shall be considered present
@@ -369,9 +403,9 @@ m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
[
gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
- [GNULIB_[]m4_translit([[$1]],
- [abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
+ [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]],
+ [abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
[gl_MODULE_INDICATOR_CONDITION])
])
@@ -656,6 +690,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
])
])
+# gl_CC_ALLOW_WARNINGS
+# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option
+# that reverts a preceding '-Werror' option, if available.
+# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang
+# and empty otherwise.
+AC_DEFUN([gl_CC_ALLOW_WARNINGS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_CACHE_CHECK([for C compiler option to allow warnings],
+ [gl_cv_cc_wallow],
+ [rm -f conftest*
+ echo 'int dummy;' > conftest.c
+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
+ dnl Test the number of error output lines, because AIX xlc accepts the
+ dnl option '-Wno-error', just to produce a warning
+ dnl "Option -Wno-error was incorrectly specified. The option will be ignored."
+ dnl afterwards.
+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+ gl_cv_cc_wallow='-Wno-error'
+ else
+ gl_cv_cc_wallow=none
+ fi
+ rm -f conftest*
+ ])
+ case "$gl_cv_cc_wallow" in
+ none) GL_CFLAG_ALLOW_WARNINGS='' ;;
+ *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;;
+ esac
+ AC_SUBST([GL_CFLAG_ALLOW_WARNINGS])
+])
+
+# gl_CXX_ALLOW_WARNINGS
+# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option
+# that reverts a preceding '-Werror' option, if available.
+AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
+[
+ dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
+ if test -n "$CXX" && test "$CXX" != no; then
+ AC_CACHE_CHECK([for C++ compiler option to allow warnings],
+ [gl_cv_cxx_wallow],
+ [rm -f conftest*
+ echo 'int dummy;' > conftest.cc
+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
+ dnl Test the number of error output lines, because AIX xlC accepts the
+ dnl option '-Wno-error', just to produce a warning
+ dnl "Option -Wno-error was incorrectly specified. The option will be ignored."
+ dnl afterwards.
+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+ gl_cv_cxx_wallow='-Wno-error'
+ else
+ gl_cv_cxx_wallow=none
+ fi
+ rm -f conftest*
+ ])
+ case "$gl_cv_cxx_wallow" in
+ none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
+ *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;;
+ esac
+ else
+ GL_CXXFLAG_ALLOW_WARNINGS=''
+ fi
+ AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS])
+])
+
dnl Expands to some code for use in .c programs that, on native Windows, defines
dnl the Microsoft deprecated alias function names to the underscore-prefixed
dnl actual function names. With this macro, these function names are available
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 1290d7589..0ae96ead7 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -142,6 +142,7 @@ AC_DEFUN([gl_EARLY],
# Code from module langinfo:
# Code from module largefile:
AC_REQUIRE([AC_SYS_LARGEFILE])
+ AC_REQUIRE([gl_YEAR2038_EARLY])
# Code from module ldexp:
# Code from module lib-symbol-versions:
# Code from module lib-symbol-visibility:
@@ -281,9 +282,11 @@ AC_DEFUN([gl_INIT],
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
m4_pushdef([gl_LIBSOURCES_LIST], [])
m4_pushdef([gl_LIBSOURCES_DIR], [])
+ m4_pushdef([GL_MACRO_PREFIX], [gl])
+ m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL])
gl_COMMON
gl_source_base='lib'
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([accept])
fi
@@ -291,9 +294,10 @@ AC_DEFUN([gl_INIT],
gl_FUNC_ACCEPT4
gl_SYS_SOCKET_MODULE_INDICATOR([accept4])
gl_FUNC_ALLOCA
- gl_HEADER_ARPA_INET
+ gl_ARPA_INET_H
+ gl_ARPA_INET_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([bind])
fi
@@ -317,7 +321,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([close])
fi
gl_UNISTD_MODULE_INDICATOR([close])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([connect])
fi
@@ -328,6 +332,7 @@ AC_DEFUN([gl_INIT],
fi
gl_MATH_MODULE_INDICATOR([copysign])
gl_DIRENT_H
+ gl_DIRENT_H_REQUIRE_DEFAULTS
gl_FUNC_DIRFD
if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \
|| test $REPLACE_DIRFD = 1; then
@@ -347,6 +352,7 @@ AC_DEFUN([gl_INIT],
gl_HEADER_ERRNO_H
AC_REQUIRE([gl_EXTERN_INLINE])
gl_FCNTL_H
+ gl_FCNTL_H_REQUIRE_DEFAULTS
AC_C_FLEXIBLE_ARRAY_MEMBER
gl_FLOAT_H
if test $REPLACE_FLOAT_LDBL = 1; then
@@ -360,7 +366,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([flock])
gl_PREREQ_FLOCK
fi
- gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
+ gl_SYS_FILE_MODULE_INDICATOR([flock])
AC_REQUIRE([gl_FUNC_FLOOR])
if test $REPLACE_FLOOR = 1; then
AC_LIBOBJ([floor])
@@ -409,17 +415,17 @@ AC_DEFUN([gl_INIT],
fi
gl_UNISTD_MODULE_INDICATOR([getlogin])
AC_REQUIRE([gl_LIB_GETLOGIN])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([getpeername])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([getsockname])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([getsockopt])
fi
@@ -439,6 +445,7 @@ AC_DEFUN([gl_INIT],
m4_ifdef([gl_ICONV_MODULE_INDICATOR],
[gl_ICONV_MODULE_INDICATOR([iconv])])
gl_ICONV_H
+ gl_ICONV_H_REQUIRE_DEFAULTS
gl_FUNC_ICONV_OPEN
if test $REPLACE_ICONV_OPEN = 1; then
AC_LIBOBJ([iconv_open])
@@ -461,6 +468,7 @@ AC_DEFUN([gl_INIT],
fi
gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
gl_INTTYPES_INCOMPLETE
+ gl_INTTYPES_H_REQUIRE_DEFAULTS
gl_ISFINITE
if test $REPLACE_ISFINITE = 1; then
AC_LIBOBJ([isfinite])
@@ -501,6 +509,7 @@ AC_DEFUN([gl_INIT],
fi
gl_MATH_MODULE_INDICATOR([isnanl])
gl_LANGINFO_H
+ gl_LANGINFO_H_REQUIRE_DEFAULTS
AC_REQUIRE([gl_LARGEFILE])
gl_FUNC_LDEXP
gl_LD_VERSION_SCRIPT
@@ -512,7 +521,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([link])
fi
gl_UNISTD_MODULE_INDICATOR([link])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([listen])
fi
@@ -522,6 +531,7 @@ AC_DEFUN([gl_INIT],
LOCALCHARSET_TESTS_ENVIRONMENT=
AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
gl_LOCALE_H
+ gl_LOCALE_H_REQUIRE_DEFAULTS
gl_FUNC_LOG1P
if test $HAVE_LOG1P = 0 || test $REPLACE_LOG1P = 1; then
AC_LIBOBJ([log1p])
@@ -541,15 +551,14 @@ AC_DEFUN([gl_INIT],
if test $REPLACE_MALLOC = 1; then
AC_LIBOBJ([malloc])
fi
- gl_MODULE_INDICATOR([malloc-gnu])
- gl_FUNC_MALLOC_POSIX
+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
if test $REPLACE_MALLOC = 1; then
AC_LIBOBJ([malloc])
fi
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
- gl_MODULE_INDICATOR([malloc-posix])
gl_MALLOCA
gl_MATH_H
+ gl_MATH_H_REQUIRE_DEFAULTS
gl_MINMAX
gl_FUNC_MKDIR
if test $REPLACE_MKDIR = 1; then
@@ -573,7 +582,8 @@ AC_DEFUN([gl_INIT],
fi
gl_MODULE_INDICATOR([msvc-nothrow])
gl_MULTIARCH
- gl_HEADER_NETDB
+ gl_NETDB_H
+ gl_NETDB_H_REQUIRE_DEFAULTS
gl_HEADER_NETINET_IN
AC_PROG_MKDIR_P
gl_FUNC_NL_LANGINFO
@@ -607,6 +617,7 @@ AC_DEFUN([gl_INIT],
fi
gl_POLL_MODULE_INDICATOR([poll])
gl_POLL_H
+ gl_POLL_H_REQUIRE_DEFAULTS
gl_FUNC_PUTENV
if test $REPLACE_PUTENV = 1; then
AC_LIBOBJ([putenv])
@@ -625,12 +636,12 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_READLINK
fi
gl_UNISTD_MODULE_INDICATOR([readlink])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([recv])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([recv])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([recvfrom])
fi
@@ -657,12 +668,12 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([select])
fi
gl_SYS_SELECT_MODULE_INDICATOR([select])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([send])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([send])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([sendto])
fi
@@ -672,25 +683,26 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([setenv])
fi
gl_STDLIB_MODULE_INDICATOR([setenv])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([setsockopt])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([shutdown])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
gl_SIGNAL_H
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ gl_SIGNAL_H_REQUIRE_DEFAULTS
+ AC_REQUIRE([gl_SYS_SOCKET_H])
if test "$ac_cv_header_winsock2_h" = yes; then
AC_LIBOBJ([socket])
fi
# When this module is used, sockets may actually occur as file descriptors,
# hence it is worth warning if the modules 'close' and 'ioctl' are not used.
- m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
- m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
+ m4_ifdef([gl_UNISTD_H_DEFAULTS], [gl_UNISTD_H_REQUIRE_DEFAULTS])
+ m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [gl_SYS_IOCTL_H_REQUIRE_DEFAULTS])
AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
if test "$ac_cv_header_winsock2_h" = yes; then
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
@@ -705,31 +717,67 @@ AC_DEFUN([gl_INIT],
gl_STDALIGN_H
AM_STDBOOL_H
gl_STDDEF_H
+ gl_STDDEF_H_REQUIRE_DEFAULTS
gl_STDINT_H
gl_STDIO_H
+ gl_STDIO_H_REQUIRE_DEFAULTS
+ dnl No need to create extra modules for these functions. Everyone who uses
+ dnl <stdio.h> likely needs them.
+ gl_STDIO_MODULE_INDICATOR([fscanf])
+ gl_MODULE_INDICATOR([fscanf])
+ gl_STDIO_MODULE_INDICATOR([scanf])
+ gl_MODULE_INDICATOR([scanf])
+ gl_STDIO_MODULE_INDICATOR([fgetc])
+ gl_STDIO_MODULE_INDICATOR([getc])
+ gl_STDIO_MODULE_INDICATOR([getchar])
+ gl_STDIO_MODULE_INDICATOR([fgets])
+ gl_STDIO_MODULE_INDICATOR([fread])
+ dnl No need to create extra modules for these functions. Everyone who uses
+ dnl <stdio.h> likely needs them.
+ gl_STDIO_MODULE_INDICATOR([fprintf])
+ gl_STDIO_MODULE_INDICATOR([printf])
+ gl_STDIO_MODULE_INDICATOR([vfprintf])
+ gl_STDIO_MODULE_INDICATOR([vprintf])
+ gl_STDIO_MODULE_INDICATOR([fputc])
+ gl_STDIO_MODULE_INDICATOR([putc])
+ gl_STDIO_MODULE_INDICATOR([putchar])
+ gl_STDIO_MODULE_INDICATOR([fputs])
+ gl_STDIO_MODULE_INDICATOR([puts])
+ gl_STDIO_MODULE_INDICATOR([fwrite])
gl_STDLIB_H
+ gl_STDLIB_H_REQUIRE_DEFAULTS
if test $gl_cond_libtool = false; then
gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV"
gl_libdeps="$gl_libdeps $LIBICONV"
fi
- gl_HEADER_STRING_H
- gl_HEADER_SYS_FILE_H
+ gl_STRING_H
+ gl_STRING_H_REQUIRE_DEFAULTS
+ gl_SYS_FILE_H
+ gl_SYS_FILE_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- AC_REQUIRE([gl_HEADER_SYS_SELECT])
+ gl_SYS_SELECT_H
+ gl_SYS_SELECT_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ gl_SYS_SOCKET_H
+ gl_SYS_SOCKET_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- gl_HEADER_SYS_STAT_H
+ gl_SYS_STAT_H
+ gl_SYS_STAT_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- gl_HEADER_SYS_TIME_H
+ gl_SYS_TIME_H
+ gl_SYS_TIME_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
gl_SYS_TIMES_H
+ gl_SYS_TIMES_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
gl_SYS_TYPES_H
+ gl_SYS_TYPES_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- gl_HEADER_SYS_UIO
+ gl_SYS_UIO_H
+ gl_SYS_UIO_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
- gl_HEADER_TIME_H
+ gl_TIME_H
+ gl_TIME_H_REQUIRE_DEFAULTS
gl_TIME_RZ
if test $HAVE_TIMEZONE_T = 0; then
AC_LIBOBJ([time_rz])
@@ -746,9 +794,11 @@ AC_DEFUN([gl_INIT],
fi
gl_MATH_MODULE_INDICATOR([trunc])
gl_UNISTD_H
+ gl_UNISTD_H_REQUIRE_DEFAULTS
gl_FUNC_VSNPRINTF
gl_STDIO_MODULE_INDICATOR([vsnprintf])
gl_WCHAR_H
+ gl_WCHAR_H_REQUIRE_DEFAULTS
gl_FUNC_WRITE
if test $REPLACE_WRITE = 1; then
AC_LIBOBJ([write])
@@ -771,7 +821,6 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
gl_gnulib_enabled_30838f5439487421042f2225bed3af76=false
gl_gnulib_enabled_hostent=false
- gl_gnulib_enabled_idx=false
gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21=false
gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=false
gl_gnulib_enabled_dbdf22868a5367f28bf18e0013ac6f8f=false
@@ -880,7 +929,9 @@ AC_SUBST([LTALLOCA])
func_gl_gnulib_m4code_dynarray ()
{
if ! $gl_gnulib_enabled_dynarray; then
+ AC_PROG_MKDIR_P
gl_gnulib_enabled_dynarray=true
+ func_gl_gnulib_m4code_37f71b604aa9c54446783d80f42fe547
func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467
fi
}
@@ -963,12 +1014,6 @@ AC_SUBST([LTALLOCA])
gl_gnulib_enabled_hostent=true
fi
}
- func_gl_gnulib_m4code_idx ()
- {
- if ! $gl_gnulib_enabled_idx; then
- gl_gnulib_enabled_idx=true
- fi
- }
func_gl_gnulib_m4code_b1df7117b479d2da59d76deba468ee21 ()
{
if ! $gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21; then
@@ -1181,7 +1226,6 @@ AC_SUBST([LTALLOCA])
AC_LIBOBJ([realloc])
fi
gl_STDLIB_MODULE_INDICATOR([realloc-posix])
- gl_MODULE_INDICATOR([realloc-posix])
gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=true
fi
}
@@ -1205,7 +1249,9 @@ AC_SUBST([LTALLOCA])
func_gl_gnulib_m4code_scratch_buffer ()
{
if ! $gl_gnulib_enabled_scratch_buffer; then
+ AC_PROG_MKDIR_P
gl_gnulib_enabled_scratch_buffer=true
+ func_gl_gnulib_m4code_37f71b604aa9c54446783d80f42fe547
func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467
func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
fi
@@ -1319,7 +1365,8 @@ AC_SUBST([LTALLOCA])
func_gl_gnulib_m4code_sys_random ()
{
if ! $gl_gnulib_enabled_sys_random; then
- gl_HEADER_SYS_RANDOM
+ gl_SYS_RANDOM_H
+ gl_SYS_RANDOM_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
gl_gnulib_enabled_sys_random=true
fi
@@ -1416,6 +1463,7 @@ AC_SUBST([LTALLOCA])
{
if ! $gl_gnulib_enabled_3dcce957eadc896e63ab5f137947b410; then
gl_WCTYPE_H
+ gl_WCTYPE_H_REQUIRE_DEFAULTS
gl_gnulib_enabled_3dcce957eadc896e63ab5f137947b410=true
fi
}
@@ -1431,9 +1479,6 @@ AC_SUBST([LTALLOCA])
func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c
fi
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
- func_gl_gnulib_m4code_idx
- fi
- if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467
fi
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
@@ -1584,9 +1629,6 @@ AC_SUBST([LTALLOCA])
func_gl_gnulib_m4code_sockets
fi
if test $HAVE_TIMEZONE_T = 0; then
- func_gl_gnulib_m4code_idx
- fi
- if test $HAVE_TIMEZONE_T = 0; then
func_gl_gnulib_m4code_time_r
fi
if test $HAVE_TIMEZONE_T = 0; then
@@ -1621,7 +1663,6 @@ AC_SUBST([LTALLOCA])
AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
AM_CONDITIONAL([gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76], [$gl_gnulib_enabled_30838f5439487421042f2225bed3af76])
AM_CONDITIONAL([gl_GNULIB_ENABLED_hostent], [$gl_gnulib_enabled_hostent])
- AM_CONDITIONAL([gl_GNULIB_ENABLED_idx], [$gl_gnulib_enabled_idx])
AM_CONDITIONAL([gl_GNULIB_ENABLED_b1df7117b479d2da59d76deba468ee21], [$gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21])
AM_CONDITIONAL([gl_GNULIB_ENABLED_3f0e593033d1fc2c127581960f641b66], [$gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66])
AM_CONDITIONAL([gl_GNULIB_ENABLED_dbdf22868a5367f28bf18e0013ac6f8f], [$gl_gnulib_enabled_dbdf22868a5367f28bf18e0013ac6f8f])
@@ -1673,6 +1714,8 @@ AC_SUBST([LTALLOCA])
m4_if(m4_sysval, [0], [],
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
])
+ m4_popdef([GL_MODULE_INDICATOR_PREFIX])
+ m4_popdef([GL_MACRO_PREFIX])
m4_popdef([gl_LIBSOURCES_DIR])
m4_popdef([gl_LIBSOURCES_LIST])
m4_popdef([AC_LIBSOURCES])
@@ -1699,6 +1742,8 @@ AC_SUBST([LTALLOCA])
m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
m4_pushdef([gltests_LIBSOURCES_LIST], [])
m4_pushdef([gltests_LIBSOURCES_DIR], [])
+ m4_pushdef([GL_MACRO_PREFIX], [gltests])
+ m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL])
gl_COMMON
gl_source_base='tests'
changequote(,)dnl
@@ -1720,6 +1765,8 @@ changequote([, ])dnl
m4_if(m4_sysval, [0], [],
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
])
+ m4_popdef([GL_MODULE_INDICATOR_PREFIX])
+ m4_popdef([GL_MACRO_PREFIX])
m4_popdef([gltests_LIBSOURCES_DIR])
m4_popdef([gltests_LIBSOURCES_LIST])
m4_popdef([AC_LIBSOURCES])
@@ -2265,6 +2312,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/wint_t.m4
m4/write.m4
m4/xsize.m4
+ m4/year2038.m4
m4/zzgnulib.m4
top/GNUmakefile
top/maint.mk
diff --git a/m4/hostent.m4 b/m4/hostent.m4
index 641d72fa3..f1390a32e 100644
--- a/m4/hostent.m4
+++ b/m4/hostent.m4
@@ -1,4 +1,4 @@
-# hostent.m4 serial 3
+# hostent.m4 serial 4
dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@ AC_DEFUN([gl_HOSTENT],
dnl - On BeOS, they are in libnet.
dnl - On native Windows, they are in ws2_32.dll.
dnl - Otherwise they are in libc.
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
HOSTENT_LIB=
gl_saved_libs="$LIBS"
AC_SEARCH_LIBS([gethostbyname], [nsl network net],
diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4
index ab8e2837a..294098829 100644
--- a/m4/iconv_h.m4
+++ b/m4/iconv_h.m4
@@ -1,10 +1,10 @@
-# iconv_h.m4 serial 12
+# iconv_h.m4 serial 15
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_ICONV_H],
+AC_DEFUN_ONCE([gl_ICONV_H],
[
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
@@ -24,22 +24,37 @@ AC_DEFUN([gl_ICONV_H],
dnl Unconditionally enables the replacement of <iconv.h>.
AC_DEFUN([gl_REPLACE_ICONV_H],
[
- AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+ gl_ICONV_H_REQUIRE_DEFAULTS
ICONV_H='iconv.h'
AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
])
+# gl_ICONV_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_ICONV_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_ICONV_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ICONV])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+])
+
AC_DEFUN([gl_ICONV_H_DEFAULTS],
[
m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
- GNULIB_ICONV=0; AC_SUBST([GNULIB_ICONV])
dnl Assume proper GNU behavior unless another module says otherwise.
ICONV_CONST=; AC_SUBST([ICONV_CONST])
REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index f56e94a88..64b1de5c4 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 32
+# inttypes.m4 serial 35
dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Derek Price, Bruno Haible.
dnl Test whether <inttypes.h> is supported or must be substituted.
-AC_DEFUN([gl_INTTYPES_H],
+AC_DEFUN_ONCE([gl_INTTYPES_H],
[
AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
gl_INTTYPES_PRI_SCN
@@ -136,19 +136,34 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
AC_SUBST([$1])
])
+# gl_INTTYPES_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_INTTYPES_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+])
+
AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
[
- GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS])
- GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV])
- GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX])
- GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS])
HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
diff --git a/m4/langinfo_h.m4 b/m4/langinfo_h.m4
index 950fe20af..87959f77a 100644
--- a/m4/langinfo_h.m4
+++ b/m4/langinfo_h.m4
@@ -1,10 +1,10 @@
-# langinfo_h.m4 serial 9
+# langinfo_h.m4 serial 12
dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_LANGINFO_H],
+AC_DEFUN_ONCE([gl_LANGINFO_H],
[
AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
@@ -104,18 +104,33 @@ int a = YESEXPR;
]], [nl_langinfo])
])
+# gl_LANGINFO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_LANGINFO_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
+])
+
AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
[
- GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index cadb16dc9..fbde5e664 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -22,7 +22,8 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
esac
])
-# The following implementation works around a problem in autoconf <= 2.69;
+# Work around a problem in Autoconf through at least 2.71 on glibc 2.34+
+# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69:
# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
# or configures them incorrectly in some cases.
m4_version_prereq([2.70], [], [
@@ -40,6 +41,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1]];[]dnl
])
+])# m4_version_prereq 2.70
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
@@ -54,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
[AC_LANG_PROGRAM([$5], [$6])],
[$3=no; break])
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
- [AC_LANG_PROGRAM([#define $1 $2
+ [AC_LANG_PROGRAM([#undef $1
+#define $1 $2
$5], [$6])],
[$3=$2; break])
$3=unknown
@@ -80,9 +83,8 @@ rm -rf conftest*[]dnl
AC_DEFUN([AC_SYS_LARGEFILE],
[AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
-if test "$enable_largefile" != no; then
-
- AC_CACHE_CHECK([for special C compiler options needed for large files],
+AS_IF([test "$enable_largefile" != no],
+ [AC_CACHE_CHECK([for special C compiler options needed for large files],
ac_cv_sys_largefile_CC,
[ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
@@ -107,15 +109,15 @@ if test "$enable_largefile" != no; then
ac_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.],
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
- if test $ac_cv_sys_file_offset_bits = unknown; then
- _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
- ac_cv_sys_large_files,
- [Define for large files, on AIX-style hosts.],
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])
- fi
-fi
+ AS_CASE([$ac_cv_sys_file_offset_bits],
+ [unknown],
+ [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1],
+ [ac_cv_sys_large_files],
+ [Define for large files, on AIX-style hosts.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])],
+ [64],
+ [gl_YEAR2038_BODY([])])])
])# AC_SYS_LARGEFILE
-])# m4_version_prereq 2.70
# Enable large files on systems where this is implemented by Gnulib, not by the
# system headers.
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index 70dbb7dcf..00c9fe9e5 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -11,7 +11,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
[
gl_CHECK_NEXT_HEADERS([limits.h])
- AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.],
+ AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.],
[gl_cv_header_limits_width],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
@@ -22,6 +22,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
long long llm = LLONG_MAX;
int wb = WORD_BIT;
int ullw = ULLONG_WIDTH;
+ int bw = BOOL_WIDTH;
]])],
[gl_cv_header_limits_width=yes],
[gl_cv_header_limits_width=no])])
diff --git a/m4/locale_h.m4 b/m4/locale_h.m4
index 7b50aa7a8..444a38178 100644
--- a/m4/locale_h.m4
+++ b/m4/locale_h.m4
@@ -1,13 +1,13 @@
-# locale_h.m4 serial 25
+# locale_h.m4 serial 28
dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_LOCALE_H],
+AC_DEFUN_ONCE([gl_LOCALE_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_*
@@ -129,22 +129,37 @@ AC_DEFUN([gl_LOCALE_T],
AC_SUBST([HAVE_XLOCALE_H])
])
+# gl_LOCALE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_LOCALE_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
+])
+
AC_DEFUN([gl_LOCALE_H_DEFAULTS],
[
- GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
- GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE])
- GNULIB_SETLOCALE_NULL=0; AC_SUBST([GNULIB_SETLOCALE_NULL])
- GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
- GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE])
HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index 32ab42ec0..972e808ab 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,21 +1,21 @@
-# malloc.m4 serial 22
+# malloc.m4 serial 27
dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# This is adapted with modifications from upstream Autoconf here:
-# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949
AC_DEFUN([_AC_FUNC_MALLOC_IF],
[
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
- AC_CACHE_CHECK([for GNU libc compatible malloc],
+ AC_CACHE_CHECK([whether malloc (0) returns nonnull],
[ac_cv_func_malloc_0_nonnull],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>
]],
- [[char *p = malloc (0);
+ [[void *p = malloc (0);
int result = !p;
free (p);
return result;]])
@@ -24,75 +24,151 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
[ac_cv_func_malloc_0_nonnull=no],
[case "$host_os" in
# Guess yes on platforms where we know the result.
- *-gnu* | gnu* | *-musl* | freebsd* | midnightbsd* | netbsd* | openbsd* \
- | hpux* | solaris* | cygwin* | mingw*)
+ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
+ | gnu* | *-musl* | midnightbsd* \
+ | hpux* | solaris* | cygwin* | mingw* | msys* )
ac_cv_func_malloc_0_nonnull="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses.
*) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;;
esac
])
])
- case "$ac_cv_func_malloc_0_nonnull" in
- *yes)
- $1
- ;;
- *)
- $2
- ;;
- esac
+ AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2])
])# _AC_FUNC_MALLOC_IF
# gl_FUNC_MALLOC_GNU
# ------------------
-# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
-# it is not.
+# Replace malloc if it is not compatible with GNU libc.
AC_DEFUN([gl_FUNC_MALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
- _AC_FUNC_MALLOC_IF(
- [AC_DEFINE([HAVE_MALLOC_GNU], [1],
- [Define to 1 if your system has a GNU libc compatible 'malloc'
- function, and to 0 otherwise.])],
- [AC_DEFINE([HAVE_MALLOC_GNU], [0])
- REPLACE_MALLOC=1
+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+ if test $REPLACE_MALLOC = 0; then
+ _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=1])
+ fi
+])
+
+# gl_FUNC_MALLOC_PTRDIFF
+# ----------------------
+# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX,
+# and replace malloc otherwise.
+AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF],
+[
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
+ test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1
+])
+
+# Test whether malloc, realloc, calloc refuse to create objects
+# larger than what can be expressed in ptrdiff_t.
+# Set gl_cv_func_malloc_gnu to yes or no accordingly.
+AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF],
+[
+ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe],
+ [gl_cv_malloc_ptrdiff],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdint.h>
+ ]],
+ [[/* 64-bit ptrdiff_t is so wide that no practical platform
+ can exceed it. */
+ #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0)
+
+ /* On rare machines where size_t fits in ptrdiff_t there
+ is no problem. */
+ #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX)
+
+ /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t
+ bounds even on 32-bit platforms. We don't know which
+ non-glibc systems are safe. */
+ #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__))
+
+ #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE
+ return 0;
+ #else
+ #error "malloc might not be ptrdiff_t safe"
+ syntax error
+ #endif
+ ]])],
+ [gl_cv_malloc_ptrdiff=yes],
+ [gl_cv_malloc_ptrdiff=no])
])
])
# gl_FUNC_MALLOC_POSIX
# --------------------
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
-# fails), and replace malloc if it is not.
+# fails, and doesn't mess up with ptrdiff_t overflow), and replace
+# malloc if it is not.
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- if test $gl_cv_func_malloc_posix = yes; then
+ if test "$gl_cv_func_malloc_posix" = yes; then
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
- [Define if the 'malloc' function is POSIX compliant.])
+ [Define if malloc, realloc, and calloc set errno on allocation failure.])
else
REPLACE_MALLOC=1
fi
])
-# Test whether malloc, realloc, calloc are POSIX compliant,
+# Test whether malloc, realloc, calloc set errno to ENOMEM on failure.
# Set gl_cv_func_malloc_posix to yes or no accordingly.
AC_DEFUN([gl_CHECK_MALLOC_POSIX],
[
- AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure],
[gl_cv_func_malloc_posix],
[
dnl It is too dangerous to try to allocate a large amount of memory:
dnl some systems go to their knees when you do that. So assume that
- dnl all Unix implementations of the function are POSIX compliant.
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[]],
- [[#if defined _WIN32 && ! defined __CYGWIN__
- choke me
- #endif
- ]])],
- [gl_cv_func_malloc_posix=yes],
- [gl_cv_func_malloc_posix=no])
+ dnl all Unix implementations of the function set errno on failure,
+ dnl except on those platforms where we have seen 'test-malloc-gnu',
+ dnl 'test-realloc-gnu', 'test-calloc-gnu' fail.
+ case "$host_os" in
+ mingw*)
+ gl_cv_func_malloc_posix=no ;;
+ irix* | solaris*)
+ dnl On IRIX 6.5, the three functions return NULL with errno unset
+ dnl when the argument is larger than PTRDIFF_MAX.
+ dnl On Solaris 11.3, the three functions return NULL with errno set
+ dnl to EAGAIN, not ENOMEM, when the argument is larger than
+ dnl PTRDIFF_MAX.
+ dnl Here is a test program:
+m4_divert_push([KILL])
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define ptrdiff_t long
+#ifndef PTRDIFF_MAX
+# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1))
+#endif
+
+int main ()
+{
+ void *p;
+
+ fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX);
+
+ errno = 0;
+ p = malloc ((unsigned long) PTRDIFF_MAX + 1);
+ fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+ errno = 0;
+ p = calloc (PTRDIFF_MAX / 2 + 1, 2);
+ fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+ errno = 0;
+ p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1);
+ fprintf (stderr, "p=%p errno=%d\n", p, errno);
+
+ return 0;
+}
+m4_divert_pop([KILL])
+ gl_cv_func_malloc_posix=no ;;
+ *)
+ gl_cv_func_malloc_posix=yes ;;
+ esac
])
])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index a9ba5e655..b3a10c3fb 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,10 +1,10 @@
-# math_h.m4 serial 122
+# math_h.m4 serial 125
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_MATH_H],
+AC_DEFUN_ONCE([gl_MATH_H],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([math.h])
@@ -53,119 +53,134 @@ AC_DEFUN([gl_MATH_H],
tanf tanl tanhf trunc truncf truncl])
])
+# gl_MATH_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_MATH_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_MATH_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATAN2F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEIL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSHF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2L])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1L])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOOR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMA])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMOD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGB])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10L])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1P])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2F])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2L])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POWF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDER])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J0], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J1], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_JN], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y0], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y1], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_YN], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+])
+
AC_DEFUN([gl_MATH_H_DEFAULTS],
[
- GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF])
- GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL])
- GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF])
- GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL])
- GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF])
- GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL])
- GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F])
- GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT])
- GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF])
- GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL])
- GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL])
- GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF])
- GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL])
- GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN])
- GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF])
- GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL])
- GNULIB_COSF=0; AC_SUBST([GNULIB_COSF])
- GNULIB_COSL=0; AC_SUBST([GNULIB_COSL])
- GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF])
- GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF])
- GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
- GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2])
- GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F])
- GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L])
- GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1])
- GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F])
- GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L])
- GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF])
- GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL])
- GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR])
- GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
- GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
- GNULIB_FMA=0; AC_SUBST([GNULIB_FMA])
- GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF])
- GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL])
- GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD])
- GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
- GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL])
- GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF])
- GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
- GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
- GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT])
- GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF])
- GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL])
- GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB])
- GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF])
- GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL])
- GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
- GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF])
- GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN])
- GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF])
- GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
- GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
- GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF])
- GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
- GNULIB_LOG=0; AC_SUBST([GNULIB_LOG])
- GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF])
- GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
- GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10])
- GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F])
- GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L])
- GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P])
- GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF])
- GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL])
- GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2])
- GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F])
- GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L])
- GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
- GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF])
- GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL])
- GNULIB_MODF=0; AC_SUBST([GNULIB_MODF])
- GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF])
- GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL])
- GNULIB_POWF=0; AC_SUBST([GNULIB_POWF])
- GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER])
- GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF])
- GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL])
- GNULIB_RINT=0; AC_SUBST([GNULIB_RINT])
- GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF])
- GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL])
- GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
- GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
- GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL])
- GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT])
- GNULIB_SINF=0; AC_SUBST([GNULIB_SINF])
- GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
- GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF])
- GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF])
- GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
- GNULIB_TANF=0; AC_SUBST([GNULIB_TANF])
- GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
- GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF])
- GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
- GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
- GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_J0=1; AC_SUBST([GNULIB_MDA_J0])
- GNULIB_MDA_J1=1; AC_SUBST([GNULIB_MDA_J1])
- GNULIB_MDA_JN=1; AC_SUBST([GNULIB_MDA_JN])
- GNULIB_MDA_Y0=1; AC_SUBST([GNULIB_MDA_Y0])
- GNULIB_MDA_Y1=1; AC_SUBST([GNULIB_MDA_Y1])
- GNULIB_MDA_YN=1; AC_SUBST([GNULIB_MDA_YN])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF])
HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL])
diff --git a/m4/memchr.m4 b/m4/memchr.m4
index 64470ded5..ca08192a6 100644
--- a/m4/memchr.m4
+++ b/m4/memchr.m4
@@ -1,4 +1,4 @@
-# memchr.m4 serial 17
+# memchr.m4 serial 18
dnl Copyright (C) 2002-2004, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
# Detect platform-specific bugs in some versions of glibc:
# memchr should not dereference anything with length 0
# https://bugzilla.redhat.com/show_bug.cgi?id=499689
diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4
index c5ee2af8c..f9d9ec8f3 100644
--- a/m4/mempcpy.m4
+++ b/m4/mempcpy.m4
@@ -1,4 +1,4 @@
-# mempcpy.m4 serial 11
+# mempcpy.m4 serial 12
dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_MEMPCPY],
dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
AC_CHECK_FUNCS([mempcpy])
if test $ac_cv_func_mempcpy = no; then
HAVE_MEMPCPY=0
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 245649e77..721189af5 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 35
+# serial 36
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -255,7 +255,7 @@ main ()
dnl Main macro of module 'mktime'.
AC_DEFUN([gl_FUNC_MKTIME],
[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4
index db84c787e..eb7c3b8b5 100644
--- a/m4/netdb_h.m4
+++ b/m4/netdb_h.m4
@@ -1,10 +1,10 @@
-# netdb_h.m4 serial 12
+# netdb_h.m4 serial 15
dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_HEADER_NETDB],
+AC_DEFUN_ONCE([gl_NETDB_H],
[
AC_REQUIRE([gl_NETDB_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([netdb.h])
@@ -21,18 +21,33 @@ AC_DEFUN([gl_HEADER_NETDB],
[getaddrinfo freeaddrinfo gai_strerror getnameinfo])
])
+# gl_NETDB_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_NETDB_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_NETDB_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETADDRINFO])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+])
+
AC_DEFUN([gl_NETDB_H_DEFAULTS],
[
- GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO])
HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO])
diff --git a/m4/poll_h.m4 b/m4/poll_h.m4
index 20692d866..1f0d7964a 100644
--- a/m4/poll_h.m4
+++ b/m4/poll_h.m4
@@ -1,4 +1,4 @@
-# poll_h.m4 serial 3
+# poll_h.m4 serial 6
dnl Copyright (C) 2010-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Bruno Haible.
-AC_DEFUN([gl_POLL_H],
+AC_DEFUN_ONCE([gl_POLL_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_POLL_H_DEFAULTS])
AC_CHECK_HEADERS_ONCE([poll.h])
@@ -31,18 +31,33 @@ AC_DEFUN([gl_POLL_H],
[poll])
])
+# gl_POLL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_POLL_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_POLL_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_POLL_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_POLL_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POLL])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_POLL_H_DEFAULTS])
+])
+
AC_DEFUN([gl_POLL_H_DEFAULTS],
[
- GNULIB_POLL=0; AC_SUBST([GNULIB_POLL])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_POLL=1; AC_SUBST([HAVE_POLL])
REPLACE_POLL=0; AC_SUBST([REPLACE_POLL])
diff --git a/m4/printf.m4 b/m4/printf.m4
index d8b352104..284c7c5d3 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 72
+# printf.m4 serial 73
dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -537,7 +537,7 @@ int main ()
&& strcmp (buf, "-0X6.488P-1 33") != 0
&& strcmp (buf, "-0XC.91P-2 33") != 0))
result |= 2;
- /* This catches a FreeBSD 6.1 bug: it doesn't round. */
+ /* This catches a FreeBSD 13.0 bug: it doesn't round. */
if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
|| (strcmp (buf, "0x1.83p+0 33") != 0
&& strcmp (buf, "0x3.05p-1 33") != 0
@@ -1690,6 +1690,7 @@ dnl
dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
+dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . .
dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . .
dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4
index f92846543..452fab18f 100644
--- a/m4/rawmemchr.m4
+++ b/m4/rawmemchr.m4
@@ -1,4 +1,4 @@
-# rawmemchr.m4 serial 2
+# rawmemchr.m4 serial 3
dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_RAWMEMCHR],
dnl Persuade glibc <string.h> to declare rawmemchr().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
AC_CHECK_FUNCS([rawmemchr])
if test $ac_cv_func_rawmemchr = no; then
HAVE_RAWMEMCHR=0
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index a80a02a6b..0abc4185e 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,21 +1,21 @@
-# realloc.m4 serial 20
+# realloc.m4 serial 24
dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# This is adapted with modifications from upstream Autoconf here:
-# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455
AC_DEFUN([_AC_FUNC_REALLOC_IF],
[
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
- AC_CACHE_CHECK([for GNU libc compatible realloc],
+ AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull],
[ac_cv_func_realloc_0_nonnull],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>
]],
- [[char *p = realloc (0, 0);
+ [[void *p = realloc (0, 0);
int result = !p;
free (p);
return result;]])
@@ -24,53 +24,40 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
[ac_cv_func_realloc_0_nonnull=no],
[case "$host_os" in
# Guess yes on platforms where we know the result.
- *-gnu* | gnu* | *-musl* | freebsd* | midnightbsd* | netbsd* | openbsd* \
- | hpux* | solaris* | cygwin* | mingw*)
+ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
+ | gnu* | *-musl* | midnightbsd* \
+ | hpux* | solaris* | cygwin* | mingw* | msys* )
ac_cv_func_realloc_0_nonnull="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses.
*) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;;
esac
])
])
- case "$ac_cv_func_realloc_0_nonnull" in
- *yes)
- $1
- ;;
- *)
- $2
- ;;
- esac
+ AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2])
])# AC_FUNC_REALLOC
# gl_FUNC_REALLOC_GNU
# -------------------
-# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
-# realloc if it is not.
+# Replace realloc if it is not compatible with GNU libc.
AC_DEFUN([gl_FUNC_REALLOC_GNU],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
- _AC_FUNC_REALLOC_IF(
- [AC_DEFINE([HAVE_REALLOC_GNU], [1],
- [Define to 1 if your system has a GNU libc compatible 'realloc'
- function, and to 0 otherwise.])],
- [AC_DEFINE([HAVE_REALLOC_GNU], [0])
- REPLACE_REALLOC=1
- ])
+ AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
+ if test $REPLACE_REALLOC = 0; then
+ _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1])
+ fi
])# gl_FUNC_REALLOC_GNU
# gl_FUNC_REALLOC_POSIX
# ---------------------
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
-# fails), and replace realloc if it is not.
+# fails, and doesn't mess up with ptrdiff_t overflow),
+# and replace realloc if it is not.
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- if test $gl_cv_func_malloc_posix = yes; then
- AC_DEFINE([HAVE_REALLOC_POSIX], [1],
- [Define if the 'realloc' function is POSIX compliant.])
- else
+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
+ if test $REPLACE_MALLOC = 1; then
REPLACE_REALLOC=1
fi
])
diff --git a/m4/regex.m4 b/m4/regex.m4
index 850c57222..1c7e562f6 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,4 +1,4 @@
-# serial 71
+# serial 73
# Copyright (C) 1996-2001, 2003-2021 Free Software Foundation, Inc.
#
@@ -246,7 +246,7 @@ AC_DEFUN([gl_REGEX],
& ~RE_CONTEXT_INVALID_DUP
& ~RE_NO_EMPTY_RANGES);
memset (&regex, 0, sizeof regex);
- s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, &regex);
+ s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, &regex);
if (s)
result |= 32;
else
@@ -264,14 +264,50 @@ AC_DEFUN([gl_REGEX],
back reference. */
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (&regex, 0, sizeof regex);
- s = re_compile_pattern ("0|()0|\\1|0", 10, &regex);
+ s = re_compile_pattern ("0|()0|\\\\1|0", 10, &regex);
if (!s)
- result |= 64;
+ {
+ memset (&regs, 0, sizeof regs);
+ i = re_search (&regex, "x", 1, 0, 1, &regs);
+ if (i != -1)
+ result |= 64;
+ if (0 <= i)
+ {
+ free (regs.start);
+ free (regs.end);
+ }
+ regfree (&regex);
+ }
else
{
if (strcmp (s, "Invalid back reference"))
result |= 64;
+ }
+
+ /* glibc bug 11053. */
+ re_set_syntax (RE_SYNTAX_POSIX_BASIC);
+ memset (&regex, 0, sizeof regex);
+ static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1";
+ s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, &regex);
+ if (s)
+ result |= 64;
+ else
+ {
+ memset (&regs, 0, sizeof regs);
+ static char const data[] = "a";
+ int datalen = sizeof data - 1;
+ i = re_search (&regex, data, datalen, 0, datalen, &regs);
+ if (i != 0)
+ result |= 64;
+ else if (regs.num_regs < 2)
+ result |= 64;
+ else if (! (regs.start[0] == 0 && regs.end[0] == 1))
+ result |= 64;
+ else if (! (regs.start[1] == 0 && regs.end[1] == 0))
+ result |= 64;
regfree (&regex);
+ free (regs.start);
+ free (regs.end);
}
#if 0
diff --git a/m4/select.m4 b/m4/select.m4
index c7409d204..72c068fa4 100644
--- a/m4/select.m4
+++ b/m4/select.m4
@@ -1,4 +1,4 @@
-# select.m4 serial 12
+# select.m4 serial 13
dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SELECT],
[
- AC_REQUIRE([gl_HEADER_SYS_SELECT])
+ AC_REQUIRE([gl_SYS_SELECT_H])
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_SOCKETS])
diff --git a/m4/servent.m4 b/m4/servent.m4
index 2dda17750..9bc3bcd4f 100644
--- a/m4/servent.m4
+++ b/m4/servent.m4
@@ -1,4 +1,4 @@
-# servent.m4 serial 3
+# servent.m4 serial 4
dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,7 @@ AC_DEFUN([gl_SERVENT],
dnl - On BeOS, they are in libnet.
dnl - On native Windows, they are in ws2_32.dll.
dnl - Otherwise they are in libc.
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
+ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
SERVENT_LIB=
gl_saved_libs="$LIBS"
AC_SEARCH_LIBS([getservbyname], [socket network net],
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
index ff9f0251f..8b938809b 100644
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,10 +1,10 @@
-# signal_h.m4 serial 19
+# signal_h.m4 serial 22
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_SIGNAL_H],
+AC_DEFUN_ONCE([gl_SIGNAL_H],
[
AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
@@ -52,22 +52,37 @@ AC_DEFUN([gl_CHECK_TYPE_SIGSET_T],
fi
])
+# gl_SIGNAL_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SIGNAL_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
[
- GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
- GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE])
- GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
- GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
- GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK])
diff --git a/m4/sockpfaf.m4 b/m4/sockpfaf.m4
index edae5d85c..17e14c7a6 100644
--- a/m4/sockpfaf.m4
+++ b/m4/sockpfaf.m4
@@ -1,4 +1,4 @@
-# sockpfaf.m4 serial 9
+# sockpfaf.m4 serial 10
dnl Copyright (C) 2004, 2006, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@ dnl From Bruno Haible.
AC_DEFUN([gl_SOCKET_FAMILIES],
[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
AC_CHECK_HEADERS_ONCE([netinet/in.h])
AC_CACHE_CHECK([for IPv4 sockets],
@@ -60,7 +60,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES],
AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
[
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+ AC_REQUIRE([gl_SYS_SOCKET_H])
AC_CHECK_HEADERS_ONCE([sys/un.h])
AC_CACHE_CHECK([for UNIX domain sockets],
diff --git a/m4/stat.m4 b/m4/stat.m4
index 66f6c8c5c..9bcdb72d6 100644
--- a/m4/stat.m4
+++ b/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 17
+# serial 18
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
#
@@ -69,7 +69,7 @@ AC_DEFUN([gl_FUNC_STAT],
# Prerequisites of lib/stat.c and lib/stat-w32.c.
AC_DEFUN([gl_PREREQ_STAT], [
- AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+ AC_REQUIRE([gl_SYS_STAT_H])
AC_REQUIRE([gl_PREREQ_STAT_W32])
:
])
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index cd666c4a5..1303d2e06 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,4 +1,4 @@
-# stddef_h.m4 serial 9
+# stddef_h.m4 serial 11
dnl Copyright (C) 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl A placeholder for <stddef.h>, for platforms that have issues.
-AC_DEFUN([gl_STDDEF_H],
+AC_DEFUN_ONCE([gl_STDDEF_H],
[
AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
AC_REQUIRE([gt_TYPE_WCHAR_T])
@@ -68,13 +68,28 @@ AC_DEFUN([gl_STDDEF_H],
fi
])
+# gl_STDDEF_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_STDDEF_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
+])
+
AC_DEFUN([gl_STDDEF_H_DEFAULTS],
[
dnl Assume proper GNU behavior unless another module says otherwise.
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index a785b44ed..2eb1652d8 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 58
+# stdint.m4 serial 60
dnl Copyright (C) 2001-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -170,7 +170,7 @@ struct s {
PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
&& PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
? 1 : -1;
- /* Detect bug in FreeBSD 6.0 / ia64. */
+ /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */
int check_SIG_ATOMIC:
SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
&& SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
@@ -527,7 +527,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
dnl requirement that wint_t is "unchanged by default argument promotions".
dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
dnl Set the variable BITSIZEOF_WINT_T accordingly.
- if test $GNULIB_OVERRIDES_WINT_T = 1; then
+ if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
BITSIZEOF_WINT_T=32
fi
])
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 4c3f24acc..e70438386 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,11 +1,12 @@
-# stdio_h.m4 serial 52
+# stdio_h.m4 serial 56
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_STDIO_H],
+AC_DEFUN_ONCE([gl_STDIO_H],
[
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AH_VERBATIM([MINGW_ANSI_STDIO],
[/* Use GNU style printf and scanf. */
#ifndef __USE_MINGW_ANSI_STDIO
@@ -13,7 +14,6 @@ AC_DEFUN([gl_STDIO_H],
#endif
])
AC_DEFINE([__USE_MINGW_ANSI_STDIO])
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_NEXT_HEADERS([stdio.h])
dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
@@ -40,17 +40,6 @@ AC_DEFUN([gl_STDIO_H],
attribute "__gnu_printf__" instead of "__printf__"])
fi
- dnl No need to create extra modules for these functions. Everyone who uses
- dnl <stdio.h> likely needs them.
- GNULIB_FSCANF=1
- gl_MODULE_INDICATOR([fscanf])
- GNULIB_SCANF=1
- gl_MODULE_INDICATOR([scanf])
- GNULIB_FGETC=1
- GNULIB_GETC=1
- GNULIB_GETCHAR=1
- GNULIB_FGETS=1
- GNULIB_FREAD=1
dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
dnl "expected source file, required through AC_LIBSOURCES, not found". It is
dnl also an optimization, to avoid performing a configure check whose result
@@ -64,18 +53,6 @@ AC_DEFUN([gl_STDIO_H],
fi
])
- dnl No need to create extra modules for these functions. Everyone who uses
- dnl <stdio.h> likely needs them.
- GNULIB_FPRINTF=1
- GNULIB_PRINTF=1
- GNULIB_VFPRINTF=1
- GNULIB_VPRINTF=1
- GNULIB_FPUTC=1
- GNULIB_PUTC=1
- GNULIB_PUTCHAR=1
- GNULIB_FPUTS=1
- GNULIB_PUTS=1
- GNULIB_FWRITE=1
dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
dnl "expected source file, required through AC_LIBSOURCES, not found". It is
dnl also an optimization, to avoid performing a configure check whose result
@@ -116,77 +93,92 @@ AC_DEFUN([gl_STDIO_H],
fi
])
+# gl_STDIO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_STDIO_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+])
+
AC_DEFUN([gl_STDIO_H_DEFAULTS],
[
- GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
- GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
- GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
- GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
- GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
- GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
- GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
- GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
- GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
- GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
- GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
- GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
- GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
- GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
- GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
- GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
- GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
- GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
- GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
- GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
- GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
- GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
- GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
- GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
- GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
- GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
- GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
- GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
- GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
- GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
- GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
- GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
- GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
- GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
- GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
- GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
- GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
- GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
- GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
- GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
- GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
- GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
- GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
- GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
- GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
- GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
- GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
- GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
- GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
- GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
- GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
- GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
- GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_FCLOSEALL=1; AC_SUBST([GNULIB_MDA_FCLOSEALL])
- GNULIB_MDA_FDOPEN=1; AC_SUBST([GNULIB_MDA_FDOPEN])
- GNULIB_MDA_FILENO=1; AC_SUBST([GNULIB_MDA_FILENO])
- GNULIB_MDA_GETW=1; AC_SUBST([GNULIB_MDA_GETW])
- GNULIB_MDA_PUTW=1; AC_SUBST([GNULIB_MDA_PUTW])
- GNULIB_MDA_TEMPNAM=1; AC_SUBST([GNULIB_MDA_TEMPNAM])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL])
HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 5fdb0a706..9c1d1c76c 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,10 +1,10 @@
-# stdlib_h.m4 serial 59
+# stdlib_h.m4 serial 63
dnl Copyright (C) 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_STDLIB_H],
+AC_DEFUN_ONCE([gl_STDLIB_H],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
gl_NEXT_HEADERS([stdlib.h])
@@ -46,63 +46,78 @@ AC_DEFUN([gl_STDLIB_H],
fi
])
+# gl_STDLIB_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_STDLIB_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+])
+
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
- GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
- GNULIB_ALIGNED_ALLOC=0; AC_SUBST([GNULIB_ALIGNED_ALLOC])
- GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
- GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
- GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
- GNULIB_FREE_POSIX=0; AC_SUBST([GNULIB_FREE_POSIX])
- GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG])
- GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
- GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
- GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
- GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
- GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
- GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
- GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
- GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
- GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
- GNULIB_POSIX_MEMALIGN=0;AC_SUBST([GNULIB_POSIX_MEMALIGN])
- GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
- GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
- GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
- GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
- GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R])
- GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM])
- GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
- GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY])
- GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
- GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
- GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
- GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
- GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
- GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
- GNULIB_STRTOL=0; AC_SUBST([GNULIB_STRTOL])
- GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD])
- GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
- GNULIB_STRTOUL=0; AC_SUBST([GNULIB_STRTOUL])
- GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
- GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
- GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
- GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
- GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_ECVT=1; AC_SUBST([GNULIB_MDA_ECVT])
- GNULIB_MDA_FCVT=1; AC_SUBST([GNULIB_MDA_FCVT])
- GNULIB_MDA_GCVT=1; AC_SUBST([GNULIB_MDA_GCVT])
- GNULIB_MDA_MKTEMP=1; AC_SUBST([GNULIB_MDA_MKTEMP])
- GNULIB_MDA_PUTENV=1; AC_SUBST([GNULIB_MDA_PUTENV])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC])
@@ -164,6 +179,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM])
REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
+ REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE])
diff --git a/m4/strdup.m4 b/m4/strdup.m4
index f6f421d94..5b6018ff2 100644
--- a/m4/strdup.m4
+++ b/m4/strdup.m4
@@ -1,4 +1,4 @@
-# strdup.m4 serial 14
+# strdup.m4 serial 15
dnl Copyright (C) 2002-2021 Free Software Foundation, Inc.
@@ -8,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRDUP],
[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
AC_CHECK_DECLS_ONCE([strdup])
if test $ac_cv_have_decl_strdup = no; then
HAVE_DECL_STRDUP=0
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRDUP],
AC_DEFUN([gl_FUNC_STRDUP_POSIX],
[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix != yes; then
REPLACE_STRDUP=1
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index a4cc5b437..80d1e5875 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -5,20 +5,15 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 29
+# serial 32
# Written by Paul Eggert.
-AC_DEFUN([gl_HEADER_STRING_H],
+AC_DEFUN_ONCE([gl_STRING_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_STRING_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_STRING_H_BODY],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
gl_NEXT_HEADERS([string.h])
dnl Check for declarations of anything we want to poison if the
@@ -33,62 +28,77 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
AC_REQUIRE([AC_C_RESTRICT])
])
+# gl_STRING_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_STRING_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
-AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STRING_H_DEFAULTS],
[
- GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO])
- GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
- GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
- GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
- GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
- GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
- GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
- GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
- GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
- GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
- GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
- GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
- GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
- GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
- GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
- GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
- GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
- GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
- GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
- GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
- GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
- GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
- GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
- GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
- GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
- GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
- GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
- GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
- GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
- GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
- GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
- GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
- GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
- GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
- GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
- GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
- GNULIB_STRERRORNAME_NP=0; AC_SUBST([GNULIB_STRERRORNAME_NP])
- GNULIB_SIGABBREV_NP=0; AC_SUBST([GNULIB_SIGABBREV_NP])
- GNULIB_SIGDESCR_NP=0; AC_SUBST([GNULIB_SIGDESCR_NP])
- GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
- GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_MEMCCPY=1; AC_SUBST([GNULIB_MDA_MEMCCPY])
- GNULIB_MDA_STRDUP=1; AC_SUBST([GNULIB_MDA_STRDUP])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO])
HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
diff --git a/m4/sys_file_h.m4 b/m4/sys_file_h.m4
index 99c2285dd..bcde4d70b 100644
--- a/m4/sys_file_h.m4
+++ b/m4/sys_file_h.m4
@@ -1,5 +1,5 @@
# Configure a replacement for <sys/file.h>.
-# serial 6
+# serial 9
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -8,9 +8,9 @@
# Written by Richard W.M. Jones.
-AC_DEFUN([gl_HEADER_SYS_FILE_H],
+AC_DEFUN_ONCE([gl_SYS_FILE_H],
[
- AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
+ AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS])
dnl <sys/file.h> is always overridden, because of GNULIB_POSIXCHECK.
gl_CHECK_NEXT_HEADERS([sys/file.h])
@@ -28,14 +28,29 @@ AC_DEFUN([gl_HEADER_SYS_FILE_H],
]], [flock])
])
-AC_DEFUN([gl_HEADER_SYS_FILE_MODULE_INDICATOR],
+# gl_SYS_FILE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
+AC_DEFUN([gl_SYS_FILE_MODULE_INDICATOR],
[
- AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
+ gl_SYS_FILE_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
-AC_DEFUN([gl_HEADER_SYS_FILE_H_DEFAULTS],
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_FILE_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOCK])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_FILE_H_DEFAULTS],
[
- GNULIB_FLOCK=0; AC_SUBST([GNULIB_FLOCK])
HAVE_FLOCK=1; AC_SUBST([HAVE_FLOCK])
])
diff --git a/m4/sys_random_h.m4 b/m4/sys_random_h.m4
index 45e0469ba..37bc31606 100644
--- a/m4/sys_random_h.m4
+++ b/m4/sys_random_h.m4
@@ -1,10 +1,10 @@
-# sys_random_h.m4 serial 5
+# sys_random_h.m4 serial 8
dnl Copyright (C) 2020-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_HEADER_SYS_RANDOM],
+AC_DEFUN_ONCE([gl_SYS_RANDOM_H],
[
AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
dnl <sys/random.h> is always overridden, because of GNULIB_POSIXCHECK.
@@ -35,18 +35,33 @@ AC_DEFUN([gl_HEADER_SYS_RANDOM],
[getrandom])
])
+# gl_SYS_RANDOM_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_RANDOM_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_RANDOM_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_RANDOM_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRANDOM])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_RANDOM_H_DEFAULTS],
[
- GNULIB_GETRANDOM=0; AC_SUBST([GNULIB_GETRANDOM])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_GETRANDOM=1; AC_SUBST([HAVE_GETRANDOM])
REPLACE_GETRANDOM=0; AC_SUBST([REPLACE_GETRANDOM])
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index 4b33d312e..2e7d140de 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,13 +1,13 @@
-# sys_select_h.m4 serial 20
+# sys_select_h.m4 serial 23
dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_HEADER_SYS_SELECT],
+AC_DEFUN_ONCE([gl_SYS_SELECT_H],
[
- AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+ AC_REQUIRE([AC_C_RESTRICT])
AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
[gl_cv_header_sys_select_h_selfcontained],
[
@@ -75,19 +75,34 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
]], [pselect select])
])
+# gl_SYS_SELECT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_SELECT_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_SELECT_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PSELECT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SELECT])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
[
- GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT])
- GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT])
REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT])
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index 503cb9668..5676a0d21 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 25
+# sys_socket_h.m4 serial 28
dnl Copyright (C) 2005-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson.
-AC_DEFUN([gl_HEADER_SYS_SOCKET],
+AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
[
AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
@@ -156,32 +156,47 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
AC_SUBST([HAVE_WS2TCPIP_H])
])
+# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_SOCKET_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
[
- GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET])
- GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT])
- GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT])
- GNULIB_BIND=0; AC_SUBST([GNULIB_BIND])
- GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
- GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
- GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT])
- GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN])
- GNULIB_RECV=0; AC_SUBST([GNULIB_RECV])
- GNULIB_SEND=0; AC_SUBST([GNULIB_SEND])
- GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM])
- GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO])
- GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT])
- GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN])
- GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4])
HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index 23cbdd28e..ac91d425b 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 38 -*- Autoconf -*-
+# sys_stat_h.m4 serial 41 -*- Autoconf -*-
dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Eric Blake.
dnl Provide a GNU-like <sys/stat.h>.
-AC_DEFUN([gl_HEADER_SYS_STAT_H],
+AC_DEFUN_ONCE([gl_SYS_STAT_H],
[
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
@@ -52,38 +52,53 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
AC_REQUIRE([AC_C_RESTRICT])
])
+# gl_SYS_STAT_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_STAT_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
[
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
- GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
- GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
- GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
- GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
- GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK])
- GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
- GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
- GNULIB_MKDIR=0; AC_SUBST([GNULIB_MKDIR])
- GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
- GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
- GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
- GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
- GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
- GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
- GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
- GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_CHMOD=1; AC_SUBST([GNULIB_MDA_CHMOD])
- GNULIB_MDA_MKDIR=1; AC_SUBST([GNULIB_MDA_MKDIR])
- GNULIB_MDA_UMASK=1; AC_SUBST([GNULIB_MDA_UMASK])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
index 64f133d51..c425a9639 100644
--- a/m4/sys_time_h.m4
+++ b/m4/sys_time_h.m4
@@ -1,5 +1,5 @@
# Configure a replacement for <sys/time.h>.
-# serial 9
+# serial 12
# Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -8,18 +8,13 @@
# Written by Paul Eggert and Martin Lambers.
-AC_DEFUN([gl_HEADER_SYS_TIME_H],
+AC_DEFUN_ONCE([gl_SYS_TIME_H],
[
dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
dnl statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
-[
+ AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS])
AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
AC_CHECK_HEADERS_ONCE([sys/time.h])
gl_CHECK_NEXT_HEADERS([sys/time.h])
@@ -89,18 +84,33 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
]], [gettimeofday])
])
+# gl_SYS_TIME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_TIME_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
-AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_TIME_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETTIMEOFDAY])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_SYS_TIME_H_DEFAULTS],
[
- GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY])
dnl Assume POSIX behavior unless another module says otherwise.
HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY])
HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL])
diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4
index b9daaa7ca..577ead66f 100644
--- a/m4/sys_times_h.m4
+++ b/m4/sys_times_h.m4
@@ -1,5 +1,5 @@
# Configure a replacement for <sys/times.h>.
-# serial 8
+# serial 11
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -8,7 +8,7 @@
# Written by Simon Josefsson.
-AC_DEFUN([gl_SYS_TIMES_H],
+AC_DEFUN_ONCE([gl_SYS_TIMES_H],
[
AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
@@ -36,16 +36,31 @@ AC_DEFUN([gl_SYS_TIMES_H],
]], [times])
])
+# gl_SYS_TIMES_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_TIMES_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_TIMES_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMES])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
[
- GNULIB_TIMES=0; AC_SUBST([GNULIB_TIMES])
HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS])
HAVE_TIMES=1; AC_SUBST([HAVE_TIMES])
])
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
index 2172c836d..6dd6fee10 100644
--- a/m4/sys_types_h.m4
+++ b/m4/sys_types_h.m4
@@ -1,4 +1,4 @@
-# sys_types_h.m4 serial 11
+# sys_types_h.m4 serial 13
dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,11 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN_ONCE([gl_SYS_TYPES_H],
[
+ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+
dnl Use sane struct stat types in OpenVMS 8.2 and later.
AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.])
- AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
gl_NEXT_HEADERS([sys/types.h])
dnl Ensure the type pid_t gets defined.
@@ -30,6 +31,17 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
AC_SUBST([WINDOWS_STAT_INODES])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
[
])
diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4
index 503de4d1f..fa176e0b6 100644
--- a/m4/sys_uio_h.m4
+++ b/m4/sys_uio_h.m4
@@ -1,10 +1,10 @@
-# sys_uio_h.m4 serial 1
+# sys_uio_h.m4 serial 3
dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_HEADER_SYS_UIO],
+AC_DEFUN_ONCE([gl_SYS_UIO_H],
[
AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
@@ -17,15 +17,30 @@ AC_DEFUN([gl_HEADER_SYS_UIO],
AC_SUBST([HAVE_SYS_UIO_H])
])
+# gl_SYS_UIO_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_SYS_UIO_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_SYS_UIO_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS], [
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+])
+
AC_DEFUN([gl_SYS_UIO_H_DEFAULTS],
[
])
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 8fc3dfd1f..37b797c18 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 30
+# threadlib.m4 serial 31
dnl Copyright (C) 2005-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -212,6 +212,27 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
LIBS=$save_LIBS
test $gl_pthread_api = yes && break
done
+ echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: LIBPTHREAD=$LIBPTHREAD" >&AS_MESSAGE_LOG_FD
+
+ gl_pthread_in_glibc=no
+ # On Linux with glibc >= 2.34, libc contains the fully functional
+ # pthread functions.
+ case "$host_os" in
+ linux*)
+ AC_EGREP_CPP([Lucky user],
+ [#include <features.h>
+ #ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2)
+ Lucky user
+ #endif
+ #endif
+ ],
+ [gl_pthread_in_glibc=yes],
+ [])
+ ;;
+ esac
+ echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
@@ -219,18 +240,22 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
# The program links fine without libpthread. But it may actually
# need to link with libpthread in order to create multiple threads.
AC_CHECK_LIB([pthread], [pthread_kill],
- [LIBPMULTITHREAD=-lpthread
- # On Solaris and HP-UX, most pthread functions exist also in libc.
- # Therefore pthread_in_use() needs to actually try to create a
- # thread: pthread_create from libc will fail, whereas
- # pthread_create will actually create a thread.
- # On Solaris 10 or newer, this test is no longer needed, because
- # libc contains the fully functional pthread functions.
- case "$host_os" in
- solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*)
- AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
- [Define if the pthread_in_use() detection is hard.])
- esac
+ [if test $gl_pthread_in_glibc = yes; then
+ LIBPMULTITHREAD=
+ else
+ LIBPMULTITHREAD=-lpthread
+ # On Solaris and HP-UX, most pthread functions exist also in libc.
+ # Therefore pthread_in_use() needs to actually try to create a
+ # thread: pthread_create from libc will fail, whereas
+ # pthread_create will actually create a thread.
+ # On Solaris 10 or newer, this test is no longer needed, because
+ # libc contains the fully functional pthread functions.
+ case "$host_os" in
+ solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*)
+ AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
+ [Define if the pthread_in_use() detection is hard.])
+ esac
+ fi
])
elif test $gl_pthread_api != yes; then
# Some library is needed. Try libpthread and libc_r.
@@ -246,6 +271,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
LIBPMULTITHREAD=-lc_r])
fi
fi
+ echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
fi
AC_MSG_CHECKING([whether POSIX threads API is available])
AC_MSG_RESULT([$gl_pthread_api])
@@ -311,7 +337,8 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
dnl glibc >= 2.29 has thrd_create in libpthread.
dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
dnl on libpthread (for the symbol 'pthread_mutexattr_gettype').
- dnl AIX >= 7.1 and Solaris >= 11.4 have thrd_create in libc.
+ dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
+ dnl libc.
AC_CHECK_FUNCS([thrd_create])
if test $ac_cv_func_thrd_create = yes; then
LIBSTDTHREAD=
@@ -481,7 +508,10 @@ AC_DEFUN([gl_THREADLIB_BODY],
gl_threads_api=posix
AC_DEFINE([USE_POSIX_THREADS], [1],
[Define if the POSIX multithreading library can be used.])
- if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
+ if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then
+ AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
+ [Define if references to the POSIX multithreading library are satisfied by libc.])
+ else
if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
[Define if references to the POSIX multithreading library should be made weak.])
@@ -576,7 +606,9 @@ dnl flavours option weak result
dnl --------------- --------- --------- -------- ---------
dnl Linux 2.4/glibc posix -lpthread Y OK
dnl
-dnl GNU Hurd/glibc posix
+dnl Linux/glibc 2.34 posix Y OK
+dnl
+dnl GNU Hurd/glibc posix -lpthread Y OK
dnl
dnl Ubuntu 14.04 posix -pthread Y OK
dnl
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index b6a1aa3bc..b57474b48 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc.
-# serial 15
+# serial 18
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -10,16 +10,11 @@
# Written by Paul Eggert and Jim Meyering.
-AC_DEFUN([gl_HEADER_TIME_H],
+AC_DEFUN_ONCE([gl_TIME_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_TIME_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_TIME_H_BODY],
-[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
gl_NEXT_HEADERS([time.h])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
@@ -111,30 +106,45 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
])
+# gl_TIME_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_TIME_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_TIME_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
-AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_TIME_H_DEFAULTS],
[
- GNULIB_CTIME=0; AC_SUBST([GNULIB_CTIME])
- GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME])
- GNULIB_LOCALTIME=0; AC_SUBST([GNULIB_LOCALTIME])
- GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
- GNULIB_STRFTIME=0; AC_SUBST([GNULIB_STRFTIME])
- GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
- GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
- GNULIB_TIMESPEC_GET=0; AC_SUBST([GNULIB_TIMESPEC_GET])
- GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
- GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ])
- GNULIB_TZSET=0; AC_SUBST([GNULIB_TZSET])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_TZSET=1; AC_SUBST([GNULIB_MDA_TZSET])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R])
HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index 713e93ac2..2d49b64f1 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -12,7 +12,7 @@ AC_DEFUN([gl_TIME_R],
dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([AC_C_RESTRICT])
dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
diff --git a/m4/time_rz.m4 b/m4/time_rz.m4
index 34ef0bab4..c5e85dc62 100644
--- a/m4/time_rz.m4
+++ b/m4/time_rz.m4
@@ -10,7 +10,7 @@ dnl Written by Paul Eggert.
AC_DEFUN([gl_TIME_RZ],
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([AC_STRUCT_TIMEZONE])
# On Mac OS X 10.6, localtime loops forever with some time_t values.
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 098c857e7..58123beb0 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,4 +1,4 @@
-# timegm.m4 serial 12
+# timegm.m4 serial 13
dnl Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_TIMEGM],
[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
REPLACE_TIMEGM=0
AC_CHECK_FUNCS_ONCE([timegm])
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index 8eaf41f41..8a4f28557 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,4 +1,4 @@
-# serial 15
+# serial 16
# Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -9,7 +9,7 @@
AC_DEFUN([gl_FUNC_TZSET],
[
- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
REPLACE_TZSET=0
case "$host_os" in
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 0f26fb908..0ce4ea451 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 85
+# unistd_h.m4 serial 89
dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Simon Josefsson, Bruno Haible.
-AC_DEFUN([gl_UNISTD_H],
+AC_DEFUN_ONCE([gl_UNISTD_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([unistd.h])
@@ -59,100 +59,116 @@ AC_DEFUN([gl_UNISTD_H],
fi
])
+# gl_UNISTD_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_UNISTD_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+])
+
AC_DEFUN([gl_UNISTD_H_DEFAULTS],
[
- GNULIB_ACCESS=0; AC_SUBST([GNULIB_ACCESS])
- GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR])
- GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
- GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
- GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE])
- GNULIB_DUP=0; AC_SUBST([GNULIB_DUP])
- GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
- GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
- GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
- GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
- GNULIB_EXECL=0; AC_SUBST([GNULIB_EXECL])
- GNULIB_EXECLE=0; AC_SUBST([GNULIB_EXECLE])
- GNULIB_EXECLP=0; AC_SUBST([GNULIB_EXECLP])
- GNULIB_EXECV=0; AC_SUBST([GNULIB_EXECV])
- GNULIB_EXECVE=0; AC_SUBST([GNULIB_EXECVE])
- GNULIB_EXECVP=0; AC_SUBST([GNULIB_EXECVP])
- GNULIB_EXECVPE=0; AC_SUBST([GNULIB_EXECVPE])
- GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
- GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
- GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
- GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC])
- GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
- GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
- GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
- GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
- GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
- GNULIB_GETENTROPY=0; AC_SUBST([GNULIB_GETENTROPY])
- GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
- GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
- GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
- GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
- GNULIB_GETOPT_POSIX=0; AC_SUBST([GNULIB_GETOPT_POSIX])
- GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
- GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS])
- GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
- GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
- GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY])
- GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
- GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
- GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
- GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
- GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
- GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
- GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
- GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
- GNULIB_READ=0; AC_SUBST([GNULIB_READ])
- GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
- GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
- GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
- GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME])
- GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
- GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
- GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
- GNULIB_TRUNCATE=0; AC_SUBST([GNULIB_TRUNCATE])
- GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
- GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
- GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
- GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
- GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
- GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
- GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_ACCESS=1; AC_SUBST([GNULIB_MDA_ACCESS])
- GNULIB_MDA_CHDIR=1; AC_SUBST([GNULIB_MDA_CHDIR])
- GNULIB_MDA_CLOSE=1; AC_SUBST([GNULIB_MDA_CLOSE])
- GNULIB_MDA_DUP=1; AC_SUBST([GNULIB_MDA_DUP])
- GNULIB_MDA_DUP2=1; AC_SUBST([GNULIB_MDA_DUP2])
- GNULIB_MDA_EXECL=1; AC_SUBST([GNULIB_MDA_EXECL])
- GNULIB_MDA_EXECLE=1; AC_SUBST([GNULIB_MDA_EXECLE])
- GNULIB_MDA_EXECLP=1; AC_SUBST([GNULIB_MDA_EXECLP])
- GNULIB_MDA_EXECV=1; AC_SUBST([GNULIB_MDA_EXECV])
- GNULIB_MDA_EXECVE=1; AC_SUBST([GNULIB_MDA_EXECVE])
- GNULIB_MDA_EXECVP=1; AC_SUBST([GNULIB_MDA_EXECVP])
- GNULIB_MDA_EXECVPE=1; AC_SUBST([GNULIB_MDA_EXECVPE])
- GNULIB_MDA_GETCWD=1; AC_SUBST([GNULIB_MDA_GETCWD])
- GNULIB_MDA_GETPID=1; AC_SUBST([GNULIB_MDA_GETPID])
- GNULIB_MDA_ISATTY=1; AC_SUBST([GNULIB_MDA_ISATTY])
- GNULIB_MDA_LSEEK=1; AC_SUBST([GNULIB_MDA_LSEEK])
- GNULIB_MDA_READ=1; AC_SUBST([GNULIB_MDA_READ])
- GNULIB_MDA_RMDIR=1; AC_SUBST([GNULIB_MDA_RMDIR])
- GNULIB_MDA_SWAB=1; AC_SUBST([GNULIB_MDA_SWAB])
- GNULIB_MDA_UNLINK=1; AC_SUBST([GNULIB_MDA_UNLINK])
- GNULIB_MDA_WRITE=1; AC_SUBST([GNULIB_MDA_WRITE])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE])
diff --git a/m4/visibility.m4 b/m4/visibility.m4
index 8f27a122d..d161bd7f7 100644
--- a/m4/visibility.m4
+++ b/m4/visibility.m4
@@ -1,4 +1,4 @@
-# visibility.m4 serial 7
+# visibility.m4 serial 8
dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -59,6 +59,10 @@ AC_DEFUN([gl_VISIBILITY],
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
void dummyfunc (void);
+ int hiddenvar;
+ int exportedvar;
+ int hiddenfunc (void) { return 51; }
+ int exportedfunc (void) { return 1225736919; }
void dummyfunc (void) {}
]],
[[]])],
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
index 59c55fcda..818b3192e 100644
--- a/m4/wchar_h.m4
+++ b/m4/wchar_h.m4
@@ -7,9 +7,9 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar_h.m4 serial 50
+# wchar_h.m4 serial 53
-AC_DEFUN([gl_WCHAR_H],
+AC_DEFUN_ONCE([gl_WCHAR_H],
[
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
@@ -125,60 +125,75 @@ Configuration aborted.])
fi
])
+# gl_WCHAR_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_WCHAR_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+])
+
AC_DEFUN([gl_WCHAR_H_DEFAULTS],
[
- GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
- GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
- GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
- GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
- GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
- GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
- GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
- GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
- GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
- GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
- GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
- GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR])
- GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP])
- GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY])
- GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE])
- GNULIB_WMEMPCPY=0; AC_SUBST([GNULIB_WMEMPCPY])
- GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET])
- GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN])
- GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN])
- GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY])
- GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY])
- GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY])
- GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY])
- GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT])
- GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT])
- GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP])
- GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP])
- GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP])
- GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP])
- GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL])
- GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM])
- GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP])
- GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR])
- GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR])
- GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN])
- GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN])
- GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK])
- GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR])
- GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK])
- GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH])
- GNULIB_WCSFTIME=0; AC_SUBST([GNULIB_WCSFTIME])
- dnl Support Microsoft deprecated alias function names by default.
- GNULIB_MDA_WCSDUP=1; AC_SUBST([GNULIB_MDA_WCSDUP])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4
index 1ab0bc985..7d7421277 100644
--- a/m4/wctype_h.m4
+++ b/m4/wctype_h.m4
@@ -1,4 +1,4 @@
-# wctype_h.m4 serial 26
+# wctype_h.m4 serial 30
dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
@@ -9,7 +9,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Paul Eggert.
-AC_DEFUN([gl_WCTYPE_H],
+AC_DEFUN_ONCE([gl_WCTYPE_H],
[
AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
@@ -62,7 +62,7 @@ AC_DEFUN([gl_WCTYPE_H],
fi
AC_SUBST([HAVE_WCTYPE_H])
- if test $GNULIB_OVERRIDES_WINT_T = 1; then
+ if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
REPLACE_ISWCNTRL=1
else
case "$gl_cv_func_iswcntrl_works" in
@@ -157,24 +157,39 @@ AC_DEFUN([gl_WCTYPE_H],
])
])
+# gl_WCTYPE_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_WCTYPE_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
+])
+
AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
[
- GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK])
- GNULIB_ISWDIGIT=0; AC_SUBST([GNULIB_ISWDIGIT])
- GNULIB_ISWXDIGIT=0; AC_SUBST([GNULIB_ISWXDIGIT])
- GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE])
- GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE])
- GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS])
- GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK])
HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T])
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
index 2fc7467f4..a49c50813 100644
--- a/m4/wint_t.m4
+++ b/m4/wint_t.m4
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 10
+# wint_t.m4 serial 11
dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -34,14 +34,14 @@ AC_DEFUN([gt_TYPE_WINT_T],
[gl_cv_type_wint_t_large_enough=yes],
[gl_cv_type_wint_t_large_enough=no])])
if test $gl_cv_type_wint_t_large_enough = no; then
- GNULIB_OVERRIDES_WINT_T=1
+ GNULIBHEADERS_OVERRIDE_WINT_T=1
else
- GNULIB_OVERRIDES_WINT_T=0
+ GNULIBHEADERS_OVERRIDE_WINT_T=0
fi
else
- GNULIB_OVERRIDES_WINT_T=0
+ GNULIBHEADERS_OVERRIDE_WINT_T=0
fi
- AC_SUBST([GNULIB_OVERRIDES_WINT_T])
+ AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])
])
dnl Prerequisites of the 'wint_t' override.
diff --git a/m4/year2038.m4 b/m4/year2038.m4
new file mode 100644
index 000000000..da0f8d730
--- /dev/null
+++ b/m4/year2038.m4
@@ -0,0 +1,124 @@
+# year2038.m4 serial 7
+dnl Copyright (C) 2017-2021 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Attempt to ensure that 'time_t' can go past the year 2038 and that
+dnl the functions 'time', 'stat', etc. work with post-2038 timestamps.
+
+AC_DEFUN([gl_YEAR2038_EARLY],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case "$host_os" in
+ mingw*)
+ AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1],
+ [For 64-bit time_t on 32-bit mingw.])
+ ;;
+ esac
+])
+
+# gl_YEAR2038_TEST_INCLUDES
+# -------------------------
+AC_DEFUN([gl_YEAR2038_TEST_INCLUDES],
+[[
+ #include <time.h>
+ /* Check that time_t can represent 2**32 - 1 correctly. */
+ #define LARGE_TIME_T \\
+ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))
+ int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535
+ && LARGE_TIME_T % 65537 == 0)
+ ? 1 : -1];
+]])
+
+# gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE)
+-----------------------------------------
+AC_DEFUN([gl_YEAR2038_BODY],
+[
+ AC_ARG_ENABLE([year2038],
+ [ --disable-year2038 omit support for timestamps past the year 2038])
+ AS_IF([test "$enable_year2038" != no],
+ [
+ dnl On many systems, time_t is already a 64-bit type.
+ dnl On those systems where time_t is still 32-bit, it requires kernel
+ dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux,
+ dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM.
+ dnl
+ dnl On native Windows, the system include files define types __time32_t
+ dnl and __time64_t. By default, time_t is an alias of
+ dnl - __time32_t on 32-bit mingw,
+ dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8).
+ dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an
+ dnl alias of __time64_t.
+ dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of
+ dnl __time32_t.
+ AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])],
+ [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no])
+ ])
+ if test "$gl_cv_type_time_t_y2038" = no; then
+ AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64],
+ [gl_cv_type_time_t_bits_macro],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[#define _TIME_BITS 64
+ #define _FILE_OFFSET_BITS 64
+ ]gl_YEAR2038_TEST_INCLUDES])],
+ [gl_cv_type_time_t_bits_macro=yes],
+ [gl_cv_type_time_t_bits_macro=no])
+ ])
+ if test "$gl_cv_type_time_t_bits_macro" = yes; then
+ AC_DEFINE([_TIME_BITS], [64],
+ [Number of bits in a timestamp, on hosts where this is settable.])
+ dnl AC_SYS_LARGFILE also defines this; it's OK if we do too.
+ AC_DEFINE([_FILE_OFFSET_BITS], [64],
+ [Number of bits in a file offset, on hosts where this is settable.])
+ gl_cv_type_time_t_y2038=yes
+ fi
+ fi
+ if test $gl_cv_type_time_t_y2038 = no; then
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef _USE_32BIT_TIME_T
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [AC_MSG_FAILURE(
+ [The 'time_t' type stops working after January 2038.
+ Remove _USE_32BIT_TIME_T from the compiler flags.])],
+ [# If not cross-compiling and $1 says we should check,
+ # and 'touch' works with a large timestamp, then evidently wider time_t
+ # is desired and supported, so fail and ask the builder to fix the
+ # problem. Otherwise, just warn the builder.
+ m4_ifval([$1],
+ [if test $cross_compiling = no \
+ && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then
+ case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in
+ *'Feb 7 2106'* | *'Feb 7 17:10'*)
+ AC_MSG_FAILURE(
+ [The 'time_t' type stops working after January 2038,
+ and your system appears to support a wider 'time_t'.
+ Try configuring with 'CC="${CC} -m64"'.
+ To build with a 32-bit time_t anyway (not recommended),
+ configure with '--disable-year2038'.]);;
+ esac
+ rm -f conftest.time
+ fi])
+ if test "$gl_warned_about_y2038" != yes; then
+ AC_MSG_WARN(
+ [The 'time_t' type stops working after January 2038,
+ and this package needs a wider 'time_t' type
+ if there is any way to access timestamps after that.
+ Configure with 'CC="${CC} -m64"' perhaps?])
+ gl_warned_about_y2038=yes
+ fi
+ ])
+ fi])
+])
+
+AC_DEFUN([gl_YEAR2038],
+[
+ gl_YEAR2038_BODY([require-year2038-safe])
+])
diff --git a/maint.mk b/maint.mk
index ae3a8170a..6a3ea9606 100644
--- a/maint.mk
+++ b/maint.mk
@@ -1409,7 +1409,7 @@ announcement_mail_headers_alpha = \
announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha)
announcement_mail_headers_beta = $(announcement_mail_headers_alpha)
-announcement_mail_Cc_ ?= $(announcement_mail_Cc_$(release-type))
+announcement_Cc_ ?= $(announcement_Cc_$(release-type))
announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type))
announcement: NEWS ChangeLog $(rel-files)
# Not $(AM_V_GEN) since the output of this command serves as
@@ -1426,7 +1426,6 @@ announcement: NEWS ChangeLog $(rel-files)
--bootstrap-tools=$(bootstrap-tools) \
$$(case ,$(bootstrap-tools), in (*,gnulib,*) \
echo --gnulib-version=$(gnulib-version);; esac) \
- --no-print-checksums \
$(addprefix --url-dir=, $(url_dir_list))
.PHONY: release-commit
diff --git a/module/Makefile.am b/module/Makefile.am
index b440946f2..d340005da 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -53,6 +53,7 @@ SOURCES = \
language/cps/cse.scm \
language/cps/dce.scm \
language/cps/devirtualize-integers.scm \
+ language/cps/dump.scm \
language/cps/elide-arity-checks.scm \
language/cps/effects-analysis.scm \
language/cps/graphs.scm \
@@ -90,10 +91,12 @@ SOURCES = \
language/tree-il/effects.scm \
language/tree-il/eta-expand.scm \
language/tree-il/fix-letrec.scm \
+ language/tree-il/inlinable-exports.scm \
language/tree-il/letrectify.scm \
language/tree-il/optimize.scm \
language/tree-il/peval.scm \
language/tree-il/primitives.scm \
+ language/tree-il/resolve-free-vars.scm \
language/tree-il/spec.scm \
\
ice-9/and-let-star.scm \
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 944061707..2323b1ec5 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -2513,7 +2513,8 @@ name extensions listed in %load-extensions."
public-interface
filename
next-unique-id
- (replacements #:no-setter))))
+ (replacements #:no-setter)
+ inlinable-exports)))
;; make-module &opt size uses binder
@@ -2539,7 +2540,7 @@ initial uses list, or binding procedure."
'()
(make-weak-key-hash-table) #f
(make-hash-table) #f #f #f 0
- (make-hash-table)))
+ (make-hash-table) #f))
@@ -3380,7 +3381,8 @@ error if selected binding does not exist in the used module."
(define* (define-module* name
#:key filename pure version (imports '()) (exports '())
(replacements '()) (re-exports '()) (re-export-replacements '())
- (autoloads '()) (duplicates #f) transformer declarative?)
+ (autoloads '()) (duplicates #f) transformer declarative?
+ inlinable-exports)
(define (list-of pred l)
(or (null? l)
(and (pair? l) (pred (car l)) (list-of pred (cdr l)))))
@@ -3446,6 +3448,12 @@ error if selected binding does not exist in the used module."
(sym (car (last-pair transformer))))
(set-module-transformer! module (module-ref iface sym))))
+ (when inlinable-exports
+ (unless (procedure? inlinable-exports)
+ (error "expected inlinable-exports to be a procedure" inlinable-exports))
+ (set-module-inlinable-exports! (module-public-interface module)
+ inlinable-exports))
+
(run-hook module-defined-hook module)
module))
@@ -3481,7 +3489,7 @@ error if selected binding does not exist in the used module."
#:warning "Failed to autoload ~a in ~a:\n" sym name))))
(module-constructor (make-hash-table 0) '() b #f #f name 'autoload #f
(make-hash-table 0) '() (make-weak-value-hash-table) #f
- (make-hash-table 0) #f #f #f 0 (make-hash-table 0))))
+ (make-hash-table 0) #f #f #f 0 (make-hash-table 0) #f)))
(define (module-autoload! module . args)
"Have @var{module} automatically load the module named @var{name} when one
diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index dd6f49089..ac6aa6316 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -307,10 +307,10 @@
(else (values s (easy-flag s))))))))
(define (clean name)
- (let ((last-char-index (1- (string-length name))))
- (if (char=? #\/ (string-ref name last-char-index))
- (substring name 0 last-char-index)
- name)))
+ (let ((end (- (string-length name) 1)))
+ (if (and (positive? end) (char=? #\/ (string-ref name end)))
+ (substring name 0 end)
+ name)))
(define (ftw filename proc . options)
(let* ((visited? (visited?-proc (cond ((memq 'hash-size options) => cadr)
diff --git a/module/ice-9/match.upstream.scm b/module/ice-9/match.upstream.scm
index b1fc371b8..ff5e535db 100644
--- a/module/ice-9/match.upstream.scm
+++ b/module/ice-9/match.upstream.scm
@@ -210,6 +210,12 @@
;; performance can be found at
;; http://synthcode.com/scheme/match-cond-expand.scm
;;
+;; 2021/06/21 - fix for `(a ...)' patterns where `a' is already bound
+;; (thanks to Andy Wingo)
+;; 2020/09/04 - [OMITTED IN GUILE] perf fix for `not`; rename `..=', `..=', `..1' per SRFI 204
+;; 2020/08/21 - [OMITTED IN GUILE] fixing match-letrec with unhygienic insertion
+;; 2020/07/06 - [OMITTED IN GUILE] adding `..=' and `..=' patterns; fixing ,@ patterns
+;; 2016/10/05 - [OMITTED IN GUILE] treat keywords as literals, not identifiers, in Chicken
;; 2016/03/06 - fixing named match-let (thanks to Stefan Israelsson Tampe)
;; 2015/05/09 - fixing bug in var extraction of quasiquote patterns
;; 2014/11/24 - [OMITTED IN GUILE] adding Gauche's `@' pattern for named record field matching
@@ -509,9 +515,9 @@
((_ v p () g+s (sk ...) fk i ((id id-ls) ...))
(match-check-identifier p
;; simplest case equivalent to (p ...), just bind the list
- (let ((p v))
- (if (list? p)
- (sk ... i)
+ (let ((w v))
+ (if (list? w)
+ (match-one w p g+s (sk ...) fk i)
fk))
;; simple case, match all elements of the list
(let loop ((ls v) (id-ls '()) ...)
@@ -525,30 +531,47 @@
fk i)))
(else
fk)))))
- ((_ v p r g+s (sk ...) fk i ((id id-ls) ...))
- ;; general case, trailing patterns to match, keep track of the
- ;; remaining list length so we don't need any backtracking
+ ((_ v p r g+s sk fk (i ...) ((id id-ls) ...))
(match-verify-no-ellipsis
r
- (let* ((tail-len (length 'r))
- (ls v)
- (len (and (list? ls) (length ls))))
- (if (or (not len) (< len tail-len))
- fk
- (let loop ((ls ls) (n len) (id-ls '()) ...)
- (cond
+ (match-bound-identifier-memv
+ p
+ (i ...)
+ ;; p is bound, match the list up to the known length, then
+ ;; match the trailing patterns
+ (let loop ((ls v) (expect p))
+ (cond
+ ((null? expect)
+ (match-one ls r (#f #f) sk fk (i ...)))
+ ((pair? ls)
+ (let ((w (car ls))
+ (e (car expect)))
+ (if (equal? (car ls) (car expect))
+ (match-drop-ids (loop (cdr ls) (cdr expect)))
+ fk)))
+ (else
+ fk)))
+ ;; general case, trailing patterns to match, keep track of the
+ ;; remaining list length so we don't need any backtracking
+ (let* ((tail-len (length 'r))
+ (ls v)
+ (len (and (list? ls) (length ls))))
+ (if (or (not len) (< len tail-len))
+ fk
+ (let loop ((ls ls) (n len) (id-ls '()) ...)
+ (cond
((= n tail-len)
(let ((id (reverse id-ls)) ...)
- (match-one ls r (#f #f) (sk ...) fk i)))
+ (match-one ls r (#f #f) sk fk (i ... id ...))))
((pair? ls)
(let ((w (car ls)))
(match-one w p ((car ls) (set-car! ls))
(match-drop-ids
(loop (cdr ls) (- n 1) (cons id id-ls) ...))
fk
- i)))
+ (i ...))))
(else
- fk)))))))))
+ fk))))))))))
;; This is just a safety check. Although unlike syntax-rules we allow
;; trailing patterns after an ellipsis, we explicitly disable multiple
@@ -915,3 +938,17 @@
;; otherwise x is a non-symbol datum
((sym? y sk fk) fk))))
(sym? abracadabra success-k failure-k)))))
+
+(define-syntax match-bound-identifier-memv
+ (syntax-rules ()
+ ((match-bound-identifier-memv a (id ...) sk fk)
+ (match-check-identifier
+ a
+ (let-syntax
+ ((memv?
+ (syntax-rules (id ...)
+ ((memv? a sk2 fk2) fk2)
+ ((memv? anything-else sk2 fk2) sk2))))
+ (memv? random-sym-to-match sk fk))
+ fk))))
+
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index 663d9275a..bd4bd6723 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -2157,6 +2157,7 @@
(lambda ()
(gen-syntax src #'(e1 e2 ...) r maps ellipsis? mod))
(lambda (e maps) (values (gen-vector e) maps))))
+ (x (eq? (syntax->datum #'x) #nil) (values '(quote #nil) maps))
(() (values '(quote ()) maps))
(_ (values `(quote ,e) maps))))))
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index ac407739f..283933064 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -556,12 +556,15 @@
(string->symbol
(list->string
(let lp ((saw-brace? #f))
- (let ((ch (next-not-eof)))
+ (let lp/inner ((ch (next-not-eof))
+ (saw-brace? saw-brace?))
(cond
(saw-brace?
(if (eqv? ch #\#)
'()
- (cons #\} (lp #f))))
+ ;; Don't eat CH, see
+ ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>.
+ (cons #\} (lp/inner ch #f))))
((eqv? ch #\})
(lp #t))
((eqv? ch #\\)
diff --git a/module/language/cps/cse.scm b/module/language/cps/cse.scm
index 55cf5490e..3c67a043a 100644
--- a/module/language/cps/cse.scm
+++ b/module/language/cps/cse.scm
@@ -360,9 +360,9 @@ for a label, it isn't known to be constant at that label."
(_ bool))
(match (and (< pred succ) (intmap-ref out pred))
(($ $kargs _ _ ($ $branch kf kt src 'eq-constant? c (v)))
- (if (eqv? kt succ)
- (adjoin-constant consts v c)
- consts))
+ (if (eqv? kf succ)
+ consts
+ (adjoin-constant consts v c)))
(_ consts)))))))
(define (propagate-analysis analysis label out)
@@ -735,7 +735,7 @@ for a label, it isn't known to be constant at that label."
;; post-order, so the intmap-fold will visit definitions before
;; uses.
(let* ((effects (synthesize-definition-effects (compute-effects conts)))
- (clobbers (compute-clobber-map effects))
+ (clobbers (compute-clobber-map conts effects))
(succs (compute-successors conts kfun))
(preds (invert-graph succs))
(avail (compute-available-expressions succs kfun clobbers))
diff --git a/module/language/cps/dump.scm b/module/language/cps/dump.scm
new file mode 100644
index 000000000..d5217fe23
--- /dev/null
+++ b/module/language/cps/dump.scm
@@ -0,0 +1,317 @@
+;;; Continuation-passing style (CPS) intermediate language (IL)
+
+;; Copyright (C) 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Free Software Foundation, Inc.
+
+;;;; This 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 3 of the License, or (at your option) any later version.
+;;;;
+;;;; This 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 this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+;;; Commentary:
+;;;
+;;; Helper facilities for working with CPS.
+;;;
+;;; Code:
+
+(define-module (language cps dump)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (language cps)
+ #:use-module (language cps intset)
+ #:use-module (language cps intmap)
+ #:use-module (language cps graphs)
+ #:use-module (language cps utils)
+ #:export (dump))
+
+;; ideas: unused vars print as _
+;; print all labels
+;; call bb headers with values
+;; annotate blocks with available bindings? live bindings?
+;; how to print calls...
+;; dot graph
+
+(define (cont-successors cont)
+ (match cont
+ (($ $kargs _ _ term)
+ (match term
+ (($ $continue k) (list k))
+ (($ $branch kf kt) (list kf kt))
+ (($ $switch kf kt*) (cons kf kt*))
+ (($ $prompt k kh) (list k kh))
+ (($ $throw) '())))
+ (($ $kclause _ kbody kalternate)
+ (if kalternate
+ (list kbody kalternate)
+ (list kbody)))
+ (($ $kfun src meta self ktail kentry)
+ (list ktail kentry))
+ (($ $kreceive arity kargs) (list kargs))
+ (($ $ktail) '())))
+
+(define (compute-block-entries cps kfun body all-labels?)
+ (if all-labels?
+ body
+ (let ((preds (compute-predecessors cps kfun #:labels body)))
+ ;; Conts whose predecessor count is not 1 start blocks.
+ (define (add-entry label blocks)
+ (match (intmap-ref preds label)
+ ((_) blocks)
+ (_ (intset-add! blocks label))))
+ ;; Continuations of branches start blocks.
+ (define (add-exits label blocks)
+ (fold1 (lambda (succ blocks)
+ (intset-add! blocks succ))
+ (match (cont-successors (intmap-ref cps label))
+ ((_) '())
+ (succs succs))
+ blocks))
+ (persistent-intset
+ (intset-fold
+ (lambda (label blocks)
+ (add-exits label (add-entry label blocks)))
+ body
+ empty-intset)))))
+
+(define (collect-blocks cps entries)
+ (define (collect-block entry)
+ (let ((cont (intmap-ref cps entry)))
+ (acons entry cont
+ (match (cont-successors (intmap-ref cps entry))
+ ((succ)
+ (if (intset-ref entries succ)
+ '()
+ (collect-block succ)))
+ (_ '())))))
+ (persistent-intmap
+ (intset-fold
+ (lambda (start blocks)
+ (intmap-add! blocks start (collect-block start)))
+ entries
+ empty-intmap)))
+
+(define (compute-block-succs blocks)
+ (intmap-map (lambda (entry conts)
+ (match conts
+ (((_ . _) ... (exit . cont))
+ (fold1 (lambda (succ succs)
+ (intset-add succs succ))
+ (cont-successors cont)
+ empty-intset))))
+ blocks))
+
+(define (dump-block cps port labelled-conts)
+ (define (format-label label) (format #f "L~a" label))
+ (define (format-name name) (if name (symbol->string name) "_"))
+ (define (format-var var) (format #f "v~a" var))
+ (define (format-loc src)
+ (and src
+ (format #f "~a:~a:~a"
+ (or (assq-ref src 'filename) "<unknown>")
+ (1+ (assq-ref src 'line))
+ (assq-ref src 'column))))
+ (define (arg-list strs) (string-join strs ", "))
+ (define (false-if-empty str) (if (string-null? str) #f str))
+ (define (format-arity arity)
+ (match arity
+ (($ $arity req opt rest kw aok?)
+ (arg-list
+ `(,@(map format-name req)
+ ,@(map (lambda (name)
+ (format #f "[~a]" (format-name name)))
+ opt)
+ ,@(map (match-lambda
+ ((kw name var)
+ (format #f "~a" kw)))
+ kw)
+ ,@(if aok? '("[#:allow-other-keys]") '())
+ ,@(if rest
+ (list (string-append (format-name rest) "..."))
+ '()))))))
+ (define (format-primcall op param args)
+ (format #f "~a~@[[~s]~](~a)" op param (arg-list (map format-var args))))
+ (define (format-exp exp)
+ (match exp
+ (($ $const val)
+ (format #f "const ~s" val))
+ (($ $prim name)
+ (format #f "prim ~s" name))
+ (($ $fun body)
+ (format #f "fun ~a" (format-label body)))
+ (($ $rec names syms funs)
+ (format #f "rec(~a)" (arg-list (map format-exp funs))))
+ (($ $const-fun label)
+ (format #f "const-fun ~a" (format-label label)))
+ (($ $code label)
+ (format #f "code ~a" (format-label label)))
+ (($ $call proc args)
+ (format #f "call ~a(~a)"
+ (format-var proc) (arg-list (map format-var args))))
+ (($ $callk k proc args)
+ (format #f "callk ~a(~a)" (format-label k)
+ (arg-list
+ (cons (if proc (format-var proc) "_")
+ (map format-var args)))))
+ (($ $primcall name param args)
+ (format-primcall name param args))
+ (($ $values args)
+ (arg-list (map format-var args)))))
+ (define (dump-annotation ann src)
+ (when (or ann src)
+ (format port "~45t ; ~@[~a ~]" ann)
+ (when src
+ (let* ((src (format-loc src))
+ (col (- 80 4 (string-length src))))
+ (format port "~vt at ~a" col src))))
+ (newline port))
+ (define (dump-definition src names vars fmt . args)
+ (define (take formatter val)
+ (cond
+ ((not val) #f)
+ ((string? val) (false-if-empty val))
+ ((null? val) #f)
+ (else (arg-list (map formatter val)))))
+ (let ((names (take format-name names))
+ (vars (take format-var vars)))
+ (format port " ~@[~a := ~]~?" vars fmt args)
+ (dump-annotation names src)))
+ (define (dump-statement src ann fmt . args)
+ (format port " ~?" fmt args)
+ (dump-annotation (and ann (false-if-empty ann)) src))
+ (define (dump-block-header label cont)
+ (match cont
+ (($ $kargs names vars)
+ (format port "~a(~a):"
+ (format-label label)
+ (arg-list (map format-var vars)))
+ (dump-annotation (false-if-empty (arg-list (map format-name names)))
+ #f))
+ (($ $ktail)
+ (values))
+ (($ $kfun src meta self ktail kentry)
+ (let ((name (assq-ref meta 'name)))
+ (format port "~a:" (format-label label))
+ (dump-annotation name src)))
+ ((or ($ $kreceive) ($ $kclause))
+ (format port "~a:\n" (format-label label)))))
+ (define (dump-block-body label cont)
+ (match cont
+ (($ $kargs _ _ ($ $continue k src exp))
+ (match (intmap-ref cps k)
+ (($ $kargs names vars)
+ (dump-definition src names vars "~a" (format-exp exp)))
+ (_
+ (dump-definition src #f #f "~a" (format-exp exp)))))
+ (($ $kreceive arity kargs)
+ (match (intmap-ref cps kargs)
+ (($ $kargs names vars)
+ (dump-definition #f names vars
+ "receive(~a)" (format-arity arity)))))
+ (($ $ktail)
+ (values))
+ (($ $kclause arity kbody #f)
+ (match (intmap-ref cps kbody)
+ (($ $kargs names vars)
+ (dump-definition #f names vars
+ "receive(~a)" (format-arity arity)))))))
+ (define (dump-block-exit label cont)
+ (match cont
+ (($ $kargs _ _ term)
+ (match term
+ (($ $continue k src exp)
+ (match (intmap-ref cps k)
+ (($ $ktail)
+ (match exp
+ (($ $values vals)
+ (dump-statement src #f
+ "return ~a" (arg-list (map format-var vals))))
+ (_
+ (dump-statement src #f
+ "tail ~a" (format-exp exp)))))
+ (_
+ (dump-statement src #f
+ "~a(~a)" (format-label k) (format-exp exp)))))
+ (($ $branch kf kt src op param args)
+ (dump-statement src #f
+ "~a ? ~a() : ~a()"
+ (format-primcall op param args)
+ (format-label kt)
+ (format-label kf)))
+ (($ $switch kf kt* src arg)
+ (dump-statement src #f
+ "[~a]~a() or ~a()"
+ (arg-list (map format-label kt*))
+ (format-var arg)
+ (format-label kf)))
+ (($ $prompt k kh src escape? tag)
+ (dump-statement src #f
+ "~a(prompt(kh:~a,~a tag:~a)"
+ (format-label k)
+ (format-label kh)
+ (if escape? ", escape-only" "")
+ (format-var tag)))
+ (($ $throw src op param args)
+ (dump-statement src #f
+ "throw ~a" (format-primcall op param args)))))
+ (($ $kreceive arity kargs)
+ (dump-statement #f #f
+ "~a(receive(~a))"
+ (format-label kargs)
+ (format-arity arity)))
+ (($ $kfun src meta self ktail kentry)
+ (for-each (match-lambda
+ ((k . v)
+ (unless (eq? k 'name)
+ (format port " meta: ~a: ~s\n" k v))))
+ meta)
+ ;; (format port " tail: ~a:\n" (format-label ktail))
+ (when self
+ (format port " ~a := self\n" (format-var self)))
+ (format port " ~a(...)\n" (format-label kentry)))
+ (($ $kclause arity kbody kalt)
+ (dump-statement #f #f
+ "~a(receive(~a))~@[or ~a()~]\n"
+ (format-label kbody)
+ (format-arity arity)
+ (and=> kalt format-label)))
+ (($ $ktail)
+ (values))))
+ (match labelled-conts
+ (((label . cont) . _)
+ (dump-block-header label cont)))
+ (let lp ((labelled-conts labelled-conts))
+ (match labelled-conts
+ (((label . cont))
+ (dump-block-exit label cont))
+ (((label . cont) . labelled-conts)
+ (dump-block-body label cont)
+ (lp labelled-conts)))))
+
+(define (dump-function cps port kfun body all-labels?)
+ (define entries (compute-block-entries cps kfun body all-labels?))
+ (define blocks (collect-blocks cps entries))
+ (define block-succs (compute-block-succs blocks))
+ (define block-order (compute-reverse-post-order block-succs kfun))
+ (for-each (lambda (entry)
+ (dump-block cps port (intmap-ref blocks entry)))
+ block-order)
+ (values))
+
+(define* (dump cps #:key
+ (port (current-output-port))
+ (entry (intmap-next cps))
+ (all-labels? #f))
+ (let ((functions (compute-reachable-functions cps entry)))
+ (intmap-fold (lambda (kfun body)
+ (unless (eqv? kfun entry) (newline port))
+ (dump-function cps port kfun body all-labels?))
+ functions)))
diff --git a/module/language/cps/effects-analysis.scm b/module/language/cps/effects-analysis.scm
index 365c280c1..cdbc50159 100644
--- a/module/language/cps/effects-analysis.scm
+++ b/module/language/cps/effects-analysis.scm
@@ -221,7 +221,7 @@
(logior &all-effect-kinds (&object &unknown-memory-kinds))))
(define-inlinable (causes-effect? x effects)
- (not (zero? (logand x effects))))
+ (logtest x effects))
(define-inlinable (causes-all-effects? x)
(eqv? x &all-effects))
@@ -238,13 +238,78 @@ is or might be a read or a write to the same location as A."
;; A negative field indicates "the whole object".
;; Non-negative fields indicate only part of the object.
(or (< a 0) (< b 0) (= a b))))))
- (and (not (zero? (logand a &write)))
- (not (zero? (logand b (logior &read &write))))
+ (and (logtest a &write)
+ (logtest b (logior &read &write))
(locations-same?)))
-(define (compute-clobber-map effects)
+(define (compute-known-allocations conts effects)
+ "Return a map of ACCESS-LABEL to ALLOC-LABEL, indicating stores to and
+loads from objects created at known allocation sites."
+ ;; VAR -> ALLOC map of defining allocations, where ALLOC is a label or
+ ;; #f. Possibly sparse.
+ (define allocations
+ (intmap-fold
+ (lambda (label fx out)
+ (match (intmap-ref conts label)
+ (($ $kargs _ _ ($ $continue k))
+ (match (intmap-ref conts k)
+ (($ $kargs (_) (var))
+ (intmap-add out var
+ (and (not (causes-all-effects? fx))
+ (logtest fx &allocation)
+ label)
+ (lambda (old new) #f)))
+ (_ out)))
+ (_ out)))
+ effects empty-intmap))
+
+ (persistent-intmap
+ (intmap-fold
+ (lambda (label fx out)
+ (cond
+ ((causes-all-effects? fx) out)
+ ((logtest fx (logior &read &write))
+ (match (intmap-ref conts label)
+ ;; Assume that instructions which cause a known set of effects
+ ;; and which
+ (($ $kargs names vars
+ ($ $continue k src
+ ($ $primcall name param (obj . args))))
+ (match (intmap-ref allocations obj (lambda (_) #f))
+ (#f out)
+ (allocation-label
+ (intmap-add! out label allocation-label))))
+ (_ out)))
+ (else out)))
+ effects empty-intmap)))
+
+(define (compute-clobber-map conts effects)
"For the map LABEL->EFFECTS, compute a map LABEL->LABELS indicating
the LABELS that are clobbered by the effects of LABEL."
+ (define known-allocations (compute-known-allocations conts effects))
+ (define (filter-may-alias write-label clobbered-labels)
+ ;; We may be able to remove some entries from CLOBBERED-LABELS, if
+ ;; we can prove they are not aliased by WRITE-LABEL.
+ (match (intmap-ref known-allocations write-label (lambda (_) #f))
+ (#f
+ ;; We don't know what object WRITE-LABEL refers to; can't refine.
+ clobbered-labels)
+ (clobber-alloc
+ (intset-fold
+ (lambda (clobbered-label clobbered-labels)
+ (match (intmap-ref known-allocations clobbered-label (lambda (_) #f))
+ (#f
+ ;; We don't know what object CLOBBERED-LABEL refers to;
+ ;; can't refine.
+ clobbered-labels)
+ (clobbered-alloc
+ ;; We know that WRITE-LABEL and CLOBBERED-LABEL refer to
+ ;; known allocations. The write will only clobber the read
+ ;; if the two allocations are the same.
+ (if (eqv? clobber-alloc clobbered-alloc)
+ clobbered-labels
+ (intset-remove clobbered-labels clobbered-label)))))
+ clobbered-labels clobbered-labels))))
(let ((clobbered-by-write (make-hash-table)))
(intmap-fold
(lambda (label fx)
@@ -269,9 +334,11 @@ the LABELS that are clobbered by the effects of LABEL."
effects)
(intmap-map (lambda (label fx)
(if (causes-effect? fx &write)
- (hashv-ref clobbered-by-write
- (ash fx (- &effect-kind-bits))
- empty-intset)
+ (filter-may-alias
+ label
+ (hashv-ref clobbered-by-write
+ (ash fx (- &effect-kind-bits))
+ empty-intset))
empty-intset))
effects)))
diff --git a/module/language/cps/graphs.scm b/module/language/cps/graphs.scm
index 8be36c84d..abdca76c9 100644
--- a/module/language/cps/graphs.scm
+++ b/module/language/cps/graphs.scm
@@ -1,6 +1,6 @@
;;; Continuation-passing style (CPS) intermediate language (IL)
-;; Copyright (C) 2013-2015, 2017-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2015, 2017-2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
;;; Code:
(define-module (language cps graphs)
+ #:use-module (ice-9 control)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (language cps intset)
@@ -33,6 +34,7 @@
intmap-map
intmap-keys
invert-bijection invert-partition
+ rename-keys rename-intset rename-graph
intset->intmap
intmap-select
worklist-fold
@@ -43,7 +45,9 @@
compute-reverse-post-order
compute-strongly-connected-components
compute-sorted-strongly-connected-components
- solve-flow-equations))
+ compute-reverse-control-flow-order
+ solve-flow-equations
+ compute-live-variables))
(define-inlinable (fold1 f l s0)
(let lp ((l l) (s0 s0))
@@ -162,6 +166,32 @@ intset of successors, return a graph SUCC->PRED...."
succs
(intmap-map (lambda (label _) empty-intset) succs)))
+(define (rename-keys map old->new)
+ "Return a fresh intmap containing F(K) -> V for K and V in MAP, where
+F is looking up K in the intmap OLD->NEW."
+ (persistent-intmap
+ (intmap-fold (lambda (k v out)
+ (intmap-add! out (intmap-ref old->new k) v))
+ map
+ empty-intmap)))
+
+(define (rename-intset set old->new)
+ "Return a fresh intset of F(K) for K in SET, where F is looking up K
+in the intmap OLD->NEW."
+ (intset-fold (lambda (old set) (intset-add set (intmap-ref old->new old)))
+ set empty-intset))
+
+(define (rename-graph graph old->new)
+ "Return a fresh intmap containing F(K) -> intset(F(V)...) for K and
+intset(V...) in GRAPH, where F is looking up K in the intmap OLD->NEW."
+ (persistent-intmap
+ (intmap-fold (lambda (pred succs out)
+ (intmap-add! out
+ (intmap-ref old->new pred)
+ (rename-intset succs old->new)))
+ graph
+ empty-intmap)))
+
(define (compute-strongly-connected-components succs start)
"Given a LABEL->SUCCESSOR... graph, compute a SCC->LABEL... map
partitioning the labels into strongly connected components (SCCs)."
@@ -232,6 +262,37 @@ connected components in sorted order."
(((? (lambda (id) (eqv? id start))) . ids)
(map (lambda (id) (intmap-ref components id)) ids))))
+(define (compute-reverse-control-flow-order preds)
+ "Return a LABEL->ORDER bijection where ORDER is a contiguous set of
+integers starting from 0 and incrementing in sort order. There is a
+precondition that labels in PREDS are already renumbered in reverse post
+order."
+ (define (has-back-edge? preds)
+ (let/ec return
+ (intmap-fold (lambda (label labels)
+ (intset-fold (lambda (pred)
+ (if (<= label pred)
+ (return #t)
+ (values)))
+ labels)
+ (values))
+ preds)
+ #f))
+ (if (has-back-edge? preds)
+ ;; This is more involved than forward control flow because not all
+ ;; live labels are reachable from the tail.
+ (persistent-intmap
+ (fold2 (lambda (component order n)
+ (intset-fold (lambda (label order n)
+ (values (intmap-add! order label n)
+ (1+ n)))
+ component order n))
+ (reverse (compute-sorted-strongly-connected-components preds))
+ empty-intmap 0))
+ ;; Just reverse forward control flow.
+ (let ((max (intmap-prev preds)))
+ (intmap-map (lambda (label labels) (- max label)) preds))))
+
(define (intset-pop set)
(match (intset-next set)
(#f (values set #f))
@@ -274,3 +335,26 @@ SUBTRACT, ADD, and MEET operates on that state."
(run (intset-union worklist changed) in out)))
(values (persistent-intmap in)
(persistent-intmap out)))))))
+
+(define (compute-live-variables preds defs uses)
+ "Compute and return two values mapping LABEL->VAR..., where VAR... are
+the definitions that are live before and after LABEL, as intsets."
+ (let* ((old->new (compute-reverse-control-flow-order preds))
+ (init (persistent-intmap (intmap-fold
+ (lambda (old new init)
+ (intmap-add! init new empty-intset))
+ old->new empty-intmap))))
+ (call-with-values
+ (lambda ()
+ (solve-flow-equations (rename-graph preds old->new)
+ init init
+ (rename-keys defs old->new)
+ (rename-keys uses old->new)
+ intset-subtract intset-union intset-union))
+ (lambda (in out)
+ ;; As a reverse control-flow problem, the values flowing into a
+ ;; node are actually the live values after the node executes.
+ ;; Funny, innit? So we return them in the reverse order.
+ (let ((new->old (invert-bijection old->new)))
+ (values (rename-keys out new->old)
+ (rename-keys in new->old)))))))
diff --git a/module/language/cps/slot-allocation.scm b/module/language/cps/slot-allocation.scm
index ff32e1ae1..253776769 100644
--- a/module/language/cps/slot-allocation.scm
+++ b/module/language/cps/slot-allocation.scm
@@ -30,6 +30,7 @@
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (language cps)
+ #:use-module (language cps graphs)
#:use-module (language cps utils)
#:use-module (language cps intmap)
#:use-module (language cps intset)
@@ -121,94 +122,6 @@
(define (lookup-nlocals allocation)
(allocation-frame-size allocation))
-(define-syntax-rule (persistent-intmap2 exp)
- (call-with-values (lambda () exp)
- (lambda (a b)
- (values (persistent-intmap a) (persistent-intmap b)))))
-
-(define (compute-defs-and-uses cps)
- "Return two LABEL->VAR... maps indicating values defined at and used
-by a label, respectively."
- (define (vars->intset vars)
- (fold (lambda (var set) (intset-add set var)) empty-intset vars))
- (persistent-intmap2
- (intmap-fold
- (lambda (label cont defs uses)
- (define (get-defs k)
- (match (intmap-ref cps k)
- (($ $kargs names vars) (vars->intset vars))
- (_ empty-intset)))
- (define (return d u)
- (values (intmap-add! defs label d)
- (intmap-add! uses label u)))
- (match cont
- (($ $kfun src meta self tail clause)
- (return (intset-union
- (if clause (get-defs clause) empty-intset)
- (if self (intset self) empty-intset))
- empty-intset))
- (($ $kargs _ _ ($ $continue k src exp))
- (match exp
- ((or ($ $const) ($ $const-fun) ($ $code))
- (return (get-defs k) empty-intset))
- (($ $call proc args)
- (return (get-defs k) (intset-add (vars->intset args) proc)))
- (($ $callk _ proc args)
- (let ((args (vars->intset args)))
- (return (get-defs k) (if proc (intset-add args proc) args))))
- (($ $primcall name param args)
- (return (get-defs k) (vars->intset args)))
- (($ $values args)
- (return (get-defs k) (vars->intset args)))))
- (($ $kargs _ _ ($ $branch kf kt src op param args))
- (return empty-intset (vars->intset args)))
- (($ $kargs _ _ ($ $switch kf kt* src arg))
- (return empty-intset (intset arg)))
- (($ $kargs _ _ ($ $prompt k kh src escape? tag))
- (return empty-intset (intset tag)))
- (($ $kargs _ _ ($ $throw src op param args))
- (return empty-intset (vars->intset args)))
- (($ $kclause arity body alt)
- (return (get-defs body) empty-intset))
- (($ $kreceive arity kargs)
- (return (get-defs kargs) empty-intset))
- (($ $ktail)
- (return empty-intset empty-intset))))
- cps
- empty-intmap
- empty-intmap)))
-
-(define (compute-reverse-control-flow-order preds)
- "Return a LABEL->ORDER bijection where ORDER is a contiguous set of
-integers starting from 0 and incrementing in sort order. There is a
-precondition that labels in PREDS are already renumbered in reverse post
-order."
- (define (has-back-edge? preds)
- (let/ec return
- (intmap-fold (lambda (label labels)
- (intset-fold (lambda (pred)
- (if (<= label pred)
- (return #t)
- (values)))
- labels)
- (values))
- preds)
- #f))
- (if (has-back-edge? preds)
- ;; This is more involved than forward control flow because not all
- ;; live labels are reachable from the tail.
- (persistent-intmap
- (fold2 (lambda (component order n)
- (intset-fold (lambda (label order n)
- (values (intmap-add! order label n)
- (1+ n)))
- component order n))
- (reverse (compute-sorted-strongly-connected-components preds))
- empty-intmap 0))
- ;; Just reverse forward control flow.
- (let ((max (intmap-prev preds)))
- (intmap-map (lambda (label labels) (- max label)) preds))))
-
(define* (add-prompt-control-flow-edges conts succs #:key complete?)
"For all prompts in DFG in the range [MIN-LABEL, MIN-LABEL +
LABEL-COUNT), invoke F with arguments PROMPT, HANDLER, and BODY for each
@@ -272,51 +185,6 @@ body continuation in the prompt."
conts
succs))
-(define (rename-keys map old->new)
- (persistent-intmap
- (intmap-fold (lambda (k v out)
- (intmap-add! out (intmap-ref old->new k) v))
- map
- empty-intmap)))
-
-(define (rename-intset set old->new)
- (intset-fold (lambda (old set) (intset-add set (intmap-ref old->new old)))
- set empty-intset))
-
-(define (rename-graph graph old->new)
- (persistent-intmap
- (intmap-fold (lambda (pred succs out)
- (intmap-add! out
- (intmap-ref old->new pred)
- (rename-intset succs old->new)))
- graph
- empty-intmap)))
-
-(define (compute-live-variables cps defs uses)
- "Compute and return two values mapping LABEL->VAR..., where VAR... are
-the definitions that are live before and after LABEL, as intsets."
- (let* ((succs (add-prompt-control-flow-edges cps (compute-successors cps)))
- (preds (invert-graph succs))
- (old->new (compute-reverse-control-flow-order preds))
- (init (persistent-intmap (intmap-fold
- (lambda (old new init)
- (intmap-add! init new empty-intset))
- old->new empty-intmap))))
- (call-with-values
- (lambda ()
- (solve-flow-equations (rename-graph preds old->new)
- init init
- (rename-keys defs old->new)
- (rename-keys uses old->new)
- intset-subtract intset-union intset-union))
- (lambda (in out)
- ;; As a reverse control-flow problem, the values flowing into a
- ;; node are actually the live values after the node executes.
- ;; Funny, innit? So we return them in the reverse order.
- (let ((new->old (invert-bijection old->new)))
- (values (rename-keys out new->old)
- (rename-keys in new->old)))))))
-
(define (compute-needs-slot cps defs uses)
(define (get-defs k) (intmap-ref defs k))
(define (get-uses label) (intmap-ref uses label))
@@ -746,84 +614,14 @@ are comparable with eqv?. A tmp slot may be used."
(persistent-intmap
(intmap-fold-right allocate-lazy cps slots)))
-(define (compute-var-representations cps)
- (define (get-defs k)
- (match (intmap-ref cps k)
- (($ $kargs names vars) vars)
- (_ '())))
- (intmap-fold
- (lambda (label cont representations)
- (match cont
- (($ $kargs _ _ ($ $continue k _ exp))
- (match (get-defs k)
- (() representations)
- ((var)
- (match exp
- (($ $values (arg))
- (intmap-add representations var
- (intmap-ref representations arg)))
- (($ $primcall (or 'scm->f64 'load-f64 's64->f64
- 'f32-ref 'f64-ref
- 'fadd 'fsub 'fmul 'fdiv 'fsqrt 'fabs
- 'ffloor 'fceiling
- 'fsin 'fcos 'ftan 'fasin 'facos 'fatan 'fatan2))
- (intmap-add representations var 'f64))
- (($ $primcall (or 'scm->u64 'scm->u64/truncate 'load-u64
- 's64->u64
- 'assume-u64
- 'uadd 'usub 'umul
- 'ulogand 'ulogior 'ulogxor 'ulogsub 'ursh 'ulsh
- 'uadd/immediate 'usub/immediate 'umul/immediate
- 'ursh/immediate 'ulsh/immediate
- 'u8-ref 'u16-ref 'u32-ref 'u64-ref
- 'word-ref 'word-ref/immediate
- 'untag-char))
- (intmap-add representations var 'u64))
- (($ $primcall (or 'untag-fixnum
- 'assume-s64
- 'scm->s64 'load-s64 'u64->s64
- 'srsh 'srsh/immediate
- 's8-ref 's16-ref 's32-ref 's64-ref))
- (intmap-add representations var 's64))
- (($ $primcall (or 'pointer-ref/immediate
- 'tail-pointer-ref/immediate))
- (intmap-add representations var 'ptr))
- (($ $code)
- (intmap-add representations var 'u64))
- (_
- (intmap-add representations var 'scm))))
- (vars
- (match exp
- (($ $values args)
- (fold (lambda (arg var representations)
- (intmap-add representations var
- (intmap-ref representations arg)))
- representations args vars))))))
- (($ $kargs _ _ (or ($ $branch) ($ $switch) ($ $prompt) ($ $throw)))
- representations)
- (($ $kfun src meta self tail entry)
- (let ((representations (if self
- (intmap-add representations self 'scm)
- representations)))
- (fold1 (lambda (var representations)
- (intmap-add representations var 'scm))
- (get-defs entry) representations)))
- (($ $kclause arity body alt)
- (fold1 (lambda (var representations)
- (intmap-add representations var 'scm))
- (get-defs body) representations))
- (($ $kreceive arity kargs)
- (fold1 (lambda (var representations)
- (intmap-add representations var 'scm))
- (get-defs kargs) representations))
- (($ $ktail) representations)))
- cps
- empty-intmap))
-
(define* (allocate-slots cps #:key (precolor-calls? #t))
(let*-values (((defs uses) (compute-defs-and-uses cps))
((representations) (compute-var-representations cps))
- ((live-in live-out) (compute-live-variables cps defs uses))
+ ((live-in live-out)
+ (let* ((succs (compute-successors cps))
+ (succs+ (add-prompt-control-flow-edges cps succs))
+ (preds (invert-graph succs+)))
+ (compute-live-variables preds defs uses)))
((needs-slot) (compute-needs-slot cps defs uses))
((lazy) (if precolor-calls?
(compute-lazy-vars cps live-in live-out defs
diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index 7657bf409..d3be176bf 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -2014,7 +2014,7 @@ maximum, where type is a bitset as a fixnum."
(match (intmap-ref conts k)
(($ $kargs _ defs)
(infer-primcall types 0 name param args
- (match defs ((var) var) (() #f))))
+ (match defs ((var) var) (_ #f))))
(_
;; (pk 'warning-no-restrictions name)
types))))
diff --git a/module/language/cps/utils.scm b/module/language/cps/utils.scm
index c72c04434..2b0c91c4b 100644
--- a/module/language/cps/utils.scm
+++ b/module/language/cps/utils.scm
@@ -1,6 +1,6 @@
;;; Continuation-passing style (CPS) intermediate language (IL)
-;; Copyright (C) 2013, 2014, 2015, 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -43,7 +43,9 @@
compute-successors
compute-predecessors
compute-idoms
- compute-dom-edges)
+ compute-dom-edges
+ compute-defs-and-uses
+ compute-var-representations)
#:re-export (fold1 fold2
trivial-intset
intmap-map
@@ -302,42 +304,6 @@ intset."
(intmap-fold adjoin-idom preds-map idoms))
empty-intmap)))
-;; Precondition: For each function in CONTS, the continuation names are
-;; topologically sorted.
-(define (compute-idoms conts kfun)
- ;; This is the iterative O(n^2) fixpoint algorithm, originally from
- ;; Allen and Cocke ("Graph-theoretic constructs for program flow
- ;; analysis", 1972). See the discussion in Cooper, Harvey, and
- ;; Kennedy's "A Simple, Fast Dominance Algorithm", 2001.
- (let ((preds-map (compute-predecessors conts kfun)))
- (define (compute-idom idoms preds)
- (define (idom-ref label)
- (intmap-ref idoms label (lambda (_) #f)))
- (match preds
- (() -1)
- ((pred) pred) ; Shortcut.
- ((pred . preds)
- (define (common-idom d0 d1)
- ;; We exploit the fact that a reverse post-order is a
- ;; topological sort, and so the idom of a node is always
- ;; numerically less than the node itself.
- (let lp ((d0 d0) (d1 d1))
- (cond
- ;; d0 or d1 can be false on the first iteration.
- ((not d0) d1)
- ((not d1) d0)
- ((= d0 d1) d0)
- ((< d0 d1) (lp d0 (idom-ref d1)))
- (else (lp (idom-ref d0) d1)))))
- (fold1 common-idom preds pred))))
- (define (adjoin-idom label preds idoms)
- (let ((idom (compute-idom idoms preds)))
- ;; Don't use intmap-add! here.
- (intmap-add idoms label idom (lambda (old new) new))))
- (fixpoint (lambda (idoms)
- (intmap-fold adjoin-idom preds-map idoms))
- empty-intmap)))
-
;; Compute a vector containing, for each node, a list of the nodes that
;; it immediately dominates. These are the "D" edges in the DJ tree.
(define (compute-dom-edges idoms)
@@ -351,3 +317,135 @@ intset."
idoms
empty-intmap)))
+(define (compute-defs-and-uses cps)
+ "Return two LABEL->VAR... maps indicating values defined at and used
+by a label, respectively."
+ (define (vars->intset vars)
+ (fold (lambda (var set) (intset-add set var)) empty-intset vars))
+ (define-syntax-rule (persistent-intmap2 exp)
+ (call-with-values (lambda () exp)
+ (lambda (a b)
+ (values (persistent-intmap a) (persistent-intmap b)))))
+ (persistent-intmap2
+ (intmap-fold
+ (lambda (label cont defs uses)
+ (define (get-defs k)
+ (match (intmap-ref cps k)
+ (($ $kargs names vars) (vars->intset vars))
+ (_ empty-intset)))
+ (define (return d u)
+ (values (intmap-add! defs label d)
+ (intmap-add! uses label u)))
+ (match cont
+ (($ $kfun src meta self tail clause)
+ (return (intset-union
+ (if clause (get-defs clause) empty-intset)
+ (if self (intset self) empty-intset))
+ empty-intset))
+ (($ $kargs _ _ ($ $continue k src exp))
+ (match exp
+ ((or ($ $const) ($ $const-fun) ($ $code))
+ (return (get-defs k) empty-intset))
+ (($ $call proc args)
+ (return (get-defs k) (intset-add (vars->intset args) proc)))
+ (($ $callk _ proc args)
+ (let ((args (vars->intset args)))
+ (return (get-defs k) (if proc (intset-add args proc) args))))
+ (($ $primcall name param args)
+ (return (get-defs k) (vars->intset args)))
+ (($ $values args)
+ (return (get-defs k) (vars->intset args)))))
+ (($ $kargs _ _ ($ $branch kf kt src op param args))
+ (return empty-intset (vars->intset args)))
+ (($ $kargs _ _ ($ $switch kf kt* src arg))
+ (return empty-intset (intset arg)))
+ (($ $kargs _ _ ($ $prompt k kh src escape? tag))
+ (return empty-intset (intset tag)))
+ (($ $kargs _ _ ($ $throw src op param args))
+ (return empty-intset (vars->intset args)))
+ (($ $kclause arity body alt)
+ (return (get-defs body) empty-intset))
+ (($ $kreceive arity kargs)
+ (return (get-defs kargs) empty-intset))
+ (($ $ktail)
+ (return empty-intset empty-intset))))
+ cps
+ empty-intmap
+ empty-intmap)))
+
+(define (compute-var-representations cps)
+ (define (get-defs k)
+ (match (intmap-ref cps k)
+ (($ $kargs names vars) vars)
+ (_ '())))
+ (intmap-fold
+ (lambda (label cont representations)
+ (match cont
+ (($ $kargs _ _ ($ $continue k _ exp))
+ (match (get-defs k)
+ (() representations)
+ ((var)
+ (match exp
+ (($ $values (arg))
+ (intmap-add representations var
+ (intmap-ref representations arg)))
+ (($ $primcall (or 'scm->f64 'load-f64 's64->f64
+ 'f32-ref 'f64-ref
+ 'fadd 'fsub 'fmul 'fdiv 'fsqrt 'fabs
+ 'ffloor 'fceiling
+ 'fsin 'fcos 'ftan 'fasin 'facos 'fatan 'fatan2))
+ (intmap-add representations var 'f64))
+ (($ $primcall (or 'scm->u64 'scm->u64/truncate 'load-u64
+ 's64->u64
+ 'assume-u64
+ 'uadd 'usub 'umul
+ 'ulogand 'ulogior 'ulogxor 'ulogsub 'ursh 'ulsh
+ 'uadd/immediate 'usub/immediate 'umul/immediate
+ 'ursh/immediate 'ulsh/immediate
+ 'u8-ref 'u16-ref 'u32-ref 'u64-ref
+ 'word-ref 'word-ref/immediate
+ 'untag-char))
+ (intmap-add representations var 'u64))
+ (($ $primcall (or 'untag-fixnum
+ 'assume-s64
+ 'scm->s64 'load-s64 'u64->s64
+ 'srsh 'srsh/immediate
+ 's8-ref 's16-ref 's32-ref 's64-ref))
+ (intmap-add representations var 's64))
+ (($ $primcall (or 'pointer-ref/immediate
+ 'tail-pointer-ref/immediate))
+ (intmap-add representations var 'ptr))
+ (($ $code)
+ (intmap-add representations var 'u64))
+ (_
+ (intmap-add representations var 'scm))))
+ (vars
+ (match exp
+ (($ $values args)
+ (fold (lambda (arg var representations)
+ (intmap-add representations var
+ (intmap-ref representations arg)))
+ representations args vars))))))
+ (($ $kargs _ _ (or ($ $branch) ($ $switch) ($ $prompt) ($ $throw)))
+ representations)
+ (($ $kfun src meta self tail entry)
+ (let* ((representations (if self
+ (intmap-add representations self 'scm)
+ representations))
+ (defs (get-defs entry))
+ (reprs (or (assq-ref meta 'arg-representations)
+ (map (lambda (_) 'scm) defs))))
+ (fold (lambda (var repr representations)
+ (intmap-add representations var repr))
+ representations defs reprs)))
+ (($ $kclause arity body alt)
+ (fold1 (lambda (var representations)
+ (intmap-add representations var 'scm))
+ (get-defs body) representations))
+ (($ $kreceive arity kargs)
+ (fold1 (lambda (var representations)
+ (intmap-add representations var 'scm))
+ (get-defs kargs) representations))
+ (($ $ktail) representations)))
+ cps
+ empty-intmap))
diff --git a/module/language/tree-il/compile-bytecode.scm b/module/language/tree-il/compile-bytecode.scm
index c495d2ae6..87d903c10 100644
--- a/module/language/tree-il/compile-bytecode.scm
+++ b/module/language/tree-il/compile-bytecode.scm
@@ -459,10 +459,10 @@
v)))
;; Transform "ash" to lsh / rsh.
- (($ <primcall> src 'ash (x ($ <const> src (? exact-integer? y))))
+ (($ <primcall> src 'ash (x ($ <const> src* (? exact-integer? y))))
(if (negative? y)
- (make-primcall src 'lsh (list x (make-const src (- y))))
- (make-primcall src 'rsh (list x (make-const src y)))))
+ (make-primcall src 'rsh (list x (make-const src* (- y))))
+ (make-primcall src 'lsh (list x (make-const src* y)))))
;; (throw key subr msg (list x) (list x))
(($ <primcall> src 'throw
diff --git a/module/language/tree-il/compile-cps.scm b/module/language/tree-il/compile-cps.scm
index ffc8308a6..918e9044a 100644
--- a/module/language/tree-il/compile-cps.scm
+++ b/module/language/tree-il/compile-cps.scm
@@ -1581,6 +1581,15 @@ use as the proc slot."
(letk ktail ($kargs ('tail) (tail) ,head))
($ (build-list ktail src vals))))))
+(define (sanitize-meta meta)
+ (match meta
+ (() '())
+ (((k . v) . meta)
+ (let ((meta (sanitize-meta meta)))
+ (case k
+ ((arg-representations) meta)
+ (else (acons k v meta)))))))
+
;;; The conversion from Tree-IL to CPS essentially wraps every
;;; expression in a $kreceive, which models the Tree-IL semantics that
;;; extra values are simply truncated. In CPS, this means that the
@@ -1865,7 +1874,7 @@ use as the proc slot."
(letv self)
(letk ktail ($ktail))
(let$ kclause (convert-clauses body ktail))
- (letk kfun ($kfun fun-src meta self ktail kclause))
+ (letk kfun ($kfun fun-src (sanitize-meta meta) self ktail kclause))
(let$ k (adapt-arity k fun-src 1))
(build-term ($continue k fun-src ($fun kfun))))
(let ((scope-id (fresh-scope-id)))
diff --git a/module/language/tree-il/inlinable-exports.scm b/module/language/tree-il/inlinable-exports.scm
new file mode 100644
index 000000000..8ea5725f3
--- /dev/null
+++ b/module/language/tree-il/inlinable-exports.scm
@@ -0,0 +1,869 @@
+;;; Attaching inlinable definitions of exported bindings to modules
+;;; Copyright (C) 2021
+;;; Free Software Foundation, Inc.
+;;;
+;;; This 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 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; This 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 this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+
+
+(define-module (language tree-il inlinable-exports)
+ #:use-module (ice-9 control)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 binary-ports)
+ #:use-module (language tree-il)
+ #:use-module (language tree-il primitives)
+ #:use-module (language tree-il fix-letrec)
+ #:use-module (language scheme compile-tree-il)
+ #:use-module ((srfi srfi-1) #:select (filter-map))
+ #:use-module (srfi srfi-9)
+ #:use-module (system syntax)
+ #:use-module (rnrs bytevectors)
+ #:export (inlinable-exports))
+
+;;;
+;;; Inlining, as implemented by peval, is the mother of all
+;;; optimizations. It opens up space for other optimizations to work,
+;;; such as constant folding, conditional branch folding, and so on.
+;;;
+;;; Inlining works naturally for lexical bindings. Inlining of
+;;; top-level binding is facilitated by letrectification, which turns
+;;; top-level definition sequences to letrec*. Here we facilitate
+;;; inlining across module boundaries, so that module boundaries aren't
+;;; necessarily optimization boundaries.
+;;;
+;;; The high-level idea is to attach a procedure to the module being
+;;; compiled, which when called with a name of an export of that module
+;;; will return a Tree-IL expression that can be copied into the use
+;;; site. There are two parts: first we determine the set of inlinable
+;;; bindings, and then we compile that mapping to a procedure and attach
+;;; it to the program being compiled.
+;;;
+;;; Because we don't want inter-module inlining to inhibit intra-module
+;;; inlining, this pass is designed to run late in the Tree-IL
+;;; optimization pipeline -- after letrectification, after peval, and so
+;;; on. Unfortunately this does mean that we have to sometimes
+;;; pattern-match to determine higher-level constructs from lower-level
+;;; residual code, for example to map back from
+;;; module-ensure-local-variable! + %variable-set! to toplevel-define,
+;;; as reduced by letrectification. Ah well.
+;;;
+;;; Ultimately we want to leave the decision to peval as to what to
+;;; inline or not to inline, based on its size and effort counters. But
+;;; still we do need to impose some limits -- there's no sense in
+;;; copying a large constant from one module to another, for example.
+;;; Similarly there's no sense in copying a very large procedure.
+;;; Inspired by peval, we bound size growth via a counter that will
+;;; abort an inlinable attempt if the term is too large.
+;;;
+;;; Note that there are some semantic limitations -- you wouldn't want
+;;; to copy a mutable value, nor would you want to copy a closure with
+;;; free variables.
+;;;
+;;; Once the set of inlinables is determined, we copy them and rename
+;;; their lexicals. Any reference to an exported binding by lexical
+;;; variable is rewritten in terms of a reference to the exported
+;;; binding.
+;;;
+;;; The result is then compiled to a procedure, which internally has a
+;;; small interpreter for a bytecode, along with a set of constants.
+;;; The assumption is that most of the constants will be written to the
+;;; object file anyway, so we aren't taking up more space there. Any
+;;; non-immediate is built on demand, so we limit the impact of
+;;; including inlinable definitions on load-time relocations,
+;;; allocations, and heap space.
+;;;
+
+(define (compute-assigned-lexicals exp)
+ (define assigned-lexicals '())
+ (define (add-assigned-lexical! var)
+ (set! assigned-lexicals (cons var assigned-lexicals)))
+ ((make-tree-il-folder)
+ exp
+ (lambda (exp)
+ (match exp
+ (($ <lexical-set> _ _ var _)
+ (add-assigned-lexical! var)
+ (values))
+ (_ (values))))
+ (lambda (exp)
+ (values)))
+ assigned-lexicals)
+
+(define (compute-assigned-toplevels exp)
+ (define assigned-toplevels '())
+ (define (add-assigned-toplevel! mod name)
+ (set! assigned-toplevels (acons mod name assigned-toplevels)))
+ ((make-tree-il-folder)
+ exp
+ (lambda (exp)
+ (match exp
+ (($ <toplevel-set> _ mod name _)
+ (add-assigned-toplevel! mod name)
+ (values))
+ (($ <module-set> src mod name public? exp)
+ (unless public?
+ (add-assigned-toplevel! mod name))
+ (values))
+ (_ (values))))
+ (lambda (exp)
+ (values)))
+ assigned-toplevels)
+
+;;; FIXME: Record all bindings in a module, to know whether a
+;;; toplevel-ref is an import or not. If toplevel-ref to imported
+;;; variable, transform to module-ref or primitive-ref. New pass before
+;;; peval.
+
+(define (compute-module-bindings exp)
+ (define assigned-lexicals (compute-assigned-lexicals exp))
+ (define assigned-toplevels (compute-assigned-toplevels exp))
+ (define module-definitions '())
+ (define lexicals (make-hash-table))
+ (define module-lexicals '())
+ (define variable-lexicals '())
+ (define binding-lexicals '())
+ (define binding-values '())
+ (define (add-module-definition! mod args)
+ (set! module-definitions (acons mod args module-definitions)))
+ (define (add-lexical! var val)
+ (unless (memq var assigned-lexicals)
+ (hashq-set! lexicals var val)))
+ (define (add-module-lexical! var mod)
+ (unless (memq var assigned-lexicals)
+ (set! module-lexicals (acons var mod module-lexicals))))
+ (define (add-variable-lexical! var mod name)
+ (unless (memq var assigned-lexicals)
+ (set! variable-lexicals (acons var (cons mod name) variable-lexicals))))
+ (define (add-binding-lexical! var mod name)
+ (unless (memq var assigned-lexicals)
+ (set! binding-lexicals (acons var (cons mod name) binding-lexicals))))
+ (define (add-binding-value! mod name val)
+ (set! binding-values (acons (cons mod name) val binding-values)))
+
+ (define (record-bindings! mod gensyms vals)
+ (for-each
+ (lambda (var val)
+ (add-lexical! var val)
+ (match val
+ (($ <call> _ ($ <module-ref> _ '(guile) 'define-module* #f)
+ (($ <const> _ mod) . args))
+ (add-module-definition! mod args)
+ (add-module-lexical! var mod))
+ (($ <primcall> _ 'current-module ())
+ (when mod
+ (add-module-lexical! var mod)))
+ (($ <primcall> _ 'module-ensure-local-variable!
+ (($ <lexical-ref> _ _ mod-var) ($ <const> _ name)))
+ (let ((mod (assq-ref module-lexicals mod-var)))
+ (when mod
+ (add-variable-lexical! var mod name))))
+ (_ #f)))
+ gensyms vals))
+
+ ;; Thread a conservative idea of what the current module is through
+ ;; the visit. Visiting an expression returns the name of the current
+ ;; module when the expression completes, or #f if unknown. Record the
+ ;; define-module* forms, if any, and note any assigned or
+ ;; multiply-defined variables. Record definitions by matching
+ ;; toplevel-define forms, but also by matching separate
+ ;; module-ensure-local-variable! + %variable-set, as residualized by
+ ;; letrectification.
+ (define (visit exp) (visit/mod exp #f))
+ (define (visit* exps)
+ (unless (null? exps)
+ (visit (car exps))
+ (visit* (cdr exps))))
+ (define (visit+ exps mod)
+ (match exps
+ (() mod)
+ ((exp . exps)
+ (let lp ((mod' (visit/mod exp mod)) (exps exps))
+ (match exps
+ (() mod')
+ ((exp . exps)
+ (lp (and (equal? mod' (visit/mod exp mod)) mod')
+ exps)))))))
+ (define (visit/mod exp mod)
+ (match exp
+ ((or ($ <void>) ($ <const>) ($ <primitive-ref>) ($ <lexical-ref>)
+ ($ <module-ref>) ($ <toplevel-ref>))
+ mod)
+
+ (($ <call> _ ($ <module-ref> _ '(guile) 'set-current-module #f)
+ (($ <lexical-ref> _ _ var)))
+ (assq-ref module-lexicals var))
+
+ (($ <primcall> src '%variable-set! (($ <lexical-ref> _ _ var)
+ val))
+ (match (assq-ref variable-lexicals var)
+ ((mod . name)
+ (add-binding-value! mod name val)
+ ;; Also record lexical for eta-expanded bindings.
+ (match val
+ (($ <lambda> _ _
+ ($ <lambda-case> _ req #f #f #f () (arg ...)
+ ($ <call> _
+ (and eta ($ <lexical-ref> _ _ var))
+ (($ <lexical-ref> _ _ arg) ...))
+ #f))
+ (add-binding-lexical! var mod name))
+ (($ <lambda> _ _
+ ($ <lambda-case> _ req #f (not #f) #f () (arg ...)
+ ($ <primcall> _ 'apply
+ ((and eta ($ <lexical-ref> _ _ var))
+ ($ <lexical-ref> _ _ arg) ...))
+ #f))
+ (add-binding-lexical! var mod name))
+ (($ <lexical-ref> _ _ var)
+ (add-binding-lexical! var mod name))
+ (_ #f)))
+ (_ #f))
+ (visit/mod val mod))
+
+ (($ <call> _ proc args)
+ (visit proc)
+ (visit* args)
+ #f)
+
+ (($ <primcall> _ _ args)
+ ;; There is no primcall that sets the current module.
+ (visit+ args mod))
+
+ (($ <conditional> src test consequent alternate)
+ (visit+ (list consequent alternate) (visit/mod test mod)))
+
+ (($ <lexical-set> src name gensym exp)
+ (visit/mod exp mod))
+
+ (($ <toplevel-set> src mod name exp)
+ (visit/mod exp mod))
+
+ (($ <module-set> src mod name public? exp)
+ (visit/mod exp mod))
+
+ (($ <toplevel-define> src mod name exp)
+ (add-binding-value! mod name exp)
+ (visit/mod exp mod))
+
+ (($ <lambda> src meta body)
+ (when body (visit body))
+ mod)
+
+ (($ <lambda-case> src req opt rest kw inits gensyms body alternate)
+ (visit* inits)
+ (visit body)
+ (when alternate (visit alternate))
+ (values))
+
+ (($ <seq> src head tail)
+ (visit/mod tail (visit/mod head mod)))
+
+ (($ <let> src names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <letrec> src in-order? names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <fix> src names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <let-values> src exp body)
+ (visit/mod body (visit/mod exp mod))
+ #f)
+
+ (($ <prompt> src escape-only? tag body handler)
+ (visit tag)
+ (visit body)
+ (visit handler)
+ #f)
+
+ (($ <abort> src tag args tail)
+ (visit tag)
+ (visit* args)
+ (visit tail)
+ #f)))
+
+ (visit exp)
+ (values module-definitions lexicals binding-lexicals binding-values))
+
+;; - define inlinable? predicate:
+;; exported && declarative && only references public vars && not too big
+;;
+;; - public := exported from a module, at -O2 and less.
+;; at -O3 and higher public just means defined in any module.
+(define (inlinable-exp mod exports lexicals binding-lexicals exp)
+ (define fresh-var!
+ (let ((counter 0))
+ (lambda ()
+ (let ((name (string-append "t" (number->string counter))))
+ (set! counter (1+ counter))
+ (string->symbol name)))))
+ (define (fresh-vars vars)
+ (match vars
+ (() '())
+ ((_ . vars) (cons (fresh-var!) (fresh-vars vars)))))
+ (define (add-bound-vars old new bound)
+ (match (vector old new)
+ (#(() ()) bound)
+ (#((old . old*) (new . new*))
+ (add-bound-vars old* new* (acons old new bound)))))
+ (let/ec return
+ (define (abort!) (return #f))
+ (define count!
+ ;; Same as default operator size limit for peval.
+ (let ((counter 40))
+ (lambda ()
+ (set! counter (1- counter))
+ (when (zero? counter) (abort!)))))
+ (define (residualize-module-private-ref src mod' name)
+ ;; TODO: At -O3, we could residualize a private
+ ;; reference. But that could break peoples'
+ ;; expectations.
+ (abort!))
+ (define (eta-reduce exp)
+ ;; Undo the result of eta-expansion pass.
+ (match exp
+ (($ <lambda> _ _
+ ($ <lambda-case> _ req #f #f #f () (sym ...)
+ ($ <call> _
+ (and eta ($ <lexical-ref>)) (($ <lexical-ref> _ _ sym) ...))
+ #f))
+ eta)
+ (($ <lambda> _ _
+ ($ <lambda-case> _ req #f (not #f) #f () (sym ...)
+ ($ <primcall> _ 'apply
+ ((and eta ($ <lexical-ref>)) ($ <lexical-ref> _ _ sym) ...))
+ #f))
+ eta)
+ (_ exp)))
+
+ (let copy ((exp (eta-reduce exp)) (bound '()) (in-lambda? #f))
+ (define (recur exp) (copy exp bound in-lambda?))
+ (count!)
+ (match exp
+ ((or ($ <void>) ($ <primitive-ref>) ($ <module-ref>))
+ exp)
+
+ (($ <const> src val)
+ (match val
+ ;; Don't copy values that could be "too big".
+ ((? string?) exp) ; Oddly, (array? "") => #t.
+ ((or (? pair?) (? syntax?) (? array?))
+ (abort!))
+ (_ exp)))
+
+ (($ <lexical-ref> src name var)
+ (cond
+ ;; Rename existing lexicals.
+ ((assq-ref bound var)
+ => (lambda (var)
+ (make-lexical-ref src name var)))
+ ;; A free variable reference to a lambda, outside a lambda.
+ ;; Could be the lexical-ref residualized by letrectification.
+ ;; Copy and rely on size limiter to catch runaways.
+ ((and (not in-lambda?) (lambda? (hashq-ref lexicals var)))
+ (recur (hashq-ref lexicals var)))
+ ((not in-lambda?)
+ ;; No advantage to "inline" a toplevel to another toplevel.
+ (abort!))
+ ;; Some letrectified toplevels will be bound to lexical
+ ;; variables, but unless the module has sealed private
+ ;; bindings, there may be an associated top-level variable
+ ;; as well.
+ ((assq-ref binding-lexicals var)
+ => (match-lambda
+ ((mod' . name)
+ (cond
+ ((and (equal? mod' mod) (assq-ref exports name))
+ => (lambda (public-name)
+ (make-module-ref src mod public-name #t)))
+ (else
+ (residualize-module-private-ref src mod' name))))))
+ ;; A free variable reference. If it's in the program at this
+ ;; point, that means that peval didn't see fit to copy it, so
+ ;; there's no point in trying to do so here.
+ (else (abort!))))
+
+ (($ <toplevel-ref> src mod' name)
+ (cond
+ ;; Rewrite private references to exported bindings into public
+ ;; references. Peval can decide whether to continue inlining
+ ;; or not.
+ ((and (equal? mod mod') (assq-ref exports name))
+ => (lambda (public-name)
+ (make-module-ref src mod public-name #t)))
+ (else
+ (residualize-module-private-ref src mod' name))))
+
+ (($ <call> src proc args)
+ (unless in-lambda? (abort!))
+ (make-call src (recur proc) (map recur args)))
+
+ (($ <primcall> src name args)
+ (unless in-lambda? (abort!))
+ (make-primcall src name (map recur args)))
+
+ (($ <conditional> src test consequent alternate)
+ (unless in-lambda? (abort!))
+ (make-conditional src (recur test)
+ (recur consequent) (recur alternate)))
+
+ (($ <lexical-set> src name var exp)
+ (unless in-lambda? (abort!))
+ (cond
+ ((assq-ref bound var)
+ => (lambda (var)
+ (make-lexical-set src name var (recur exp))))
+ (else
+ (abort!))))
+
+ ((or ($ <toplevel-set>)
+ ($ <module-set>)
+ ($ <toplevel-define>))
+ (abort!))
+
+ (($ <lambda> src meta body)
+ ;; Remove any lengthy docstring.
+ (let ((meta (filter-map (match-lambda
+ (('documentation . _) #f)
+ (pair pair))
+ meta)))
+ (make-lambda src meta (and body (copy body bound #t)))))
+
+ (($ <lambda-case> src req opt rest kw inits vars body alternate)
+ (unless in-lambda? (abort!))
+ (let* ((vars* (fresh-vars vars))
+ (bound (add-bound-vars vars vars* bound)))
+ (define (recur* exp) (copy exp bound #t))
+ (make-lambda-case src req opt rest
+ (match kw
+ (#f #f)
+ ((aok? . kws)
+ (cons aok?
+ (map
+ (match-lambda
+ ((kw name var)
+ (list kw name (assq-ref var bound))))
+ kws))))
+ (map recur* inits)
+ vars*
+ (recur* body)
+ (and alternate (recur alternate)))))
+
+ (($ <seq> src head tail)
+ (unless in-lambda? (abort!))
+ (make-seq src (recur head) (recur tail)))
+
+ (($ <let> src names vars vals body)
+ (unless in-lambda? (abort!))
+ (let* ((vars* (fresh-vars vars))
+ (bound (add-bound-vars vars vars* bound)))
+ (define (recur* exp) (copy exp bound #t))
+ (make-let src names vars* (map recur vals) (recur* body))))
+
+ (($ <letrec> src in-order? names vars vals body)
+ (unless in-lambda? (abort!))
+ (let* ((vars* (fresh-vars vars))
+ (bound (add-bound-vars vars vars* bound)))
+ (define (recur* exp) (copy exp bound #t))
+ (make-letrec src in-order? names vars* (map recur* vals)
+ (recur* body))))
+
+ (($ <fix> src names vars vals body)
+ (unless in-lambda? (abort!))
+ (let* ((vars* (fresh-vars vars))
+ (bound (add-bound-vars vars vars* bound)))
+ (define (recur* exp) (copy exp bound #t))
+ (make-fix src names vars* (map recur* vals)
+ (recur* body))))
+
+ (($ <let-values> src exp body)
+ (unless in-lambda? (abort!))
+ (make-let-values src (recur exp) (recur body)))
+
+ (($ <prompt> src escape-only? tag body handler)
+ (unless in-lambda? (abort!))
+ (make-prompt src escape-only?
+ (recur tag) (recur body) (recur handler)))
+
+ (($ <abort> src tag args tail)
+ (unless in-lambda? (abort!))
+ (make-abort src (recur tag) (map recur args) (recur tail)))))))
+
+(define (compute-inlinable-bindings exp)
+ "Traverse @var{exp}, extracting module-level definitions."
+
+ (define-values (modules lexicals binding-lexicals bindings)
+ (compute-module-bindings exp))
+
+ (define (kwarg-ref args kw kt kf)
+ (let lp ((args args))
+ (match args
+ (() (kf))
+ ((($ <const> _ (? keyword? kw')) val . args)
+ (if (eq? kw' kw)
+ (kt val)
+ (lp args)))
+ ((_ _ . args)
+ (lp args)))))
+ (define (kwarg-ref/const args kw kt kf)
+ (kwarg-ref args kw
+ (lambda (exp)
+ (match exp
+ (($ <const> _ val') (kt val'))
+ (_ (kf))))
+ kf))
+ (define (has-constant-initarg? args kw val)
+ (kwarg-ref/const args kw
+ (lambda (val')
+ (equal? val val'))
+ (lambda () #f)))
+
+ ;; Collect declarative modules defined once in this compilation unit.
+ (define modules-with-inlinable-exports
+ (let lp ((defs modules) (not-inlinable '()) (inlinable '()))
+ (match defs
+ (() inlinable)
+ (((mod . args) . defs)
+ (cond ((member mod not-inlinable)
+ (lp defs not-inlinable inlinable))
+ ((or (assoc mod defs) ;; doubly defined?
+ (not (has-constant-initarg? args #:declarative? #t)))
+ (lp defs (cons mod not-inlinable) inlinable))
+ (else
+ (lp defs not-inlinable (cons mod inlinable))))))))
+
+ ;; Omit multiply-defined bindings, and definitions not in declarative
+ ;; modules.
+ (define non-declarative-definitions
+ (let lp ((bindings bindings) (non-declarative '()))
+ (match bindings
+ (() non-declarative)
+ ((((and mod+name (mod . name)) . val) . bindings)
+ (cond
+ ((member mod+name non-declarative)
+ (lp bindings non-declarative))
+ ((or (assoc mod+name bindings)
+ (not (member mod modules-with-inlinable-exports)))
+ (lp bindings (cons mod+name non-declarative)))
+ (else
+ (lp bindings non-declarative)))))))
+
+ (define exports
+ (map (lambda (module)
+ (define args (assoc-ref modules module))
+ ;; Return list of (PRIVATE-NAME . PUBLIC-NAME) pairs.
+ (define (extract-exports kw)
+ (kwarg-ref/const args kw
+ (lambda (val)
+ (map (match-lambda
+ ((and pair (private . public)) pair)
+ (name (cons name name)))
+ val))
+ (lambda () '())))
+ (cons module
+ (append (extract-exports #:exports)
+ (extract-exports #:replacements))))
+ modules-with-inlinable-exports))
+
+ ;; Compute ((PRIVATE-NAME . PUBLIC-NAME) . VALUE) pairs for each
+ ;; module with inlinable bindings, for exported bindings only.
+ (define inlinable-candidates
+ (map
+ (lambda (module)
+ (define name-pairs (assoc-ref exports module))
+ (define (name-pair private-name)
+ (assq private-name name-pairs))
+ (cons module
+ (filter-map
+ (match-lambda
+ (((and mod+name (mod . name)) . val)
+ (and (equal? module mod)
+ (not (member mod+name non-declarative-definitions))
+ (and=> (name-pair name)
+ (lambda (pair) (cons pair val))))))
+ bindings)))
+ modules-with-inlinable-exports))
+
+ (define inlinables
+ (filter-map
+ (match-lambda
+ ((mod . exports)
+ (let ((name-pairs (map car exports)))
+ (match (filter-map
+ (match-lambda
+ (((private . public) . val)
+ (match (inlinable-exp mod name-pairs lexicals
+ binding-lexicals val)
+ (#f #f)
+ (val (cons public val)))))
+ exports)
+ (() #f)
+ (exports (cons mod exports))))))
+ inlinable-candidates))
+
+ inlinables)
+
+(define (put-uleb port val)
+ (let lp ((val val))
+ (let ((next (ash val -7)))
+ (if (zero? next)
+ (put-u8 port val)
+ (begin
+ (put-u8 port (logior #x80 (logand val #x7f)))
+ (lp next))))))
+
+(define (known-vtable vtable)
+ (define-syntax-rule (tree-il-case vt ...)
+ (cond
+ ((eq? vtable vt) (values '(language tree-il) 'vt))
+ ...
+ (else (values #f #f))))
+ (tree-il-case <void>
+ <const>
+ <primitive-ref>
+ <lexical-ref>
+ <lexical-set>
+ <module-ref>
+ <module-set>
+ <toplevel-ref>
+ <toplevel-set>
+ <toplevel-define>
+ <conditional>
+ <call>
+ <primcall>
+ <seq>
+ <lambda>
+ <lambda-case>
+ <let>
+ <letrec>
+ <fix>
+ <let-values>
+ <prompt>
+ <abort>))
+
+(define-record-type <encoding>
+ (%make-encoding constants vtables pair-code vector-code symbol-code next-code)
+ encoding?
+ (constants constants)
+ (vtables vtables)
+ (pair-code pair-code set-pair-code!)
+ (vector-code vector-code set-vector-code!)
+ (symbol-code symbol-code set-symbol-code!)
+ (next-code next-code set-next-code!))
+
+(define (make-encoding)
+ (%make-encoding (make-hash-table) (make-hash-table) #f #f #f 0))
+
+(define (vtable-nfields vtable)
+ (define vtable-index-size 5) ; FIXME: pull from struct.h
+ (struct-ref/unboxed vtable vtable-index-size))
+
+(define (build-encoding! term encoding)
+ (define (next-code!)
+ (let ((code (next-code encoding)))
+ (set-next-code! encoding (1+ code))
+ code))
+
+ (define (intern-constant! x)
+ (unless (hash-ref (constants encoding) x)
+ (hash-set! (constants encoding) x (next-code!))))
+ (define (intern-vtable! x)
+ (unless (hashq-ref (vtables encoding) x)
+ (hashq-set! (vtables encoding) x (next-code!))))
+ (define (ensure-pair-code!)
+ (unless (pair-code encoding)
+ (set-pair-code! encoding (next-code!))))
+ (define (ensure-vector-code!)
+ (unless (vector-code encoding)
+ (set-vector-code! encoding (next-code!))))
+ (define (ensure-symbol-code!)
+ (unless (symbol-code encoding)
+ (set-symbol-code! encoding (next-code!))))
+
+ (let visit ((term term))
+ (cond
+ ((pair? term)
+ (ensure-pair-code!)
+ (visit (car term))
+ (visit (cdr term)))
+ ((vector? term)
+ (ensure-vector-code!)
+ (visit (vector-length term))
+ (let lp ((i 0))
+ (when (< i (vector-length term))
+ (visit (vector-ref term i))
+ (lp (1+ i)))))
+ ((symbol? term)
+ (ensure-symbol-code!)
+ (visit (symbol->string term)))
+ ((struct? term)
+ (let ((vtable (struct-vtable term)))
+ (unless (known-vtable vtable)
+ (error "struct of unknown type" term))
+ (intern-vtable! vtable)
+ (let ((nfields (vtable-nfields vtable)))
+ (let lp ((i 0))
+ (when (< i nfields)
+ (visit (struct-ref term i))
+ (lp (1+ i)))))))
+ (else
+ (intern-constant! term)))))
+
+(define (compute-decoder encoding)
+ (define (pair-clause code)
+ `((eq? code ,code)
+ (let* ((car (lp))
+ (cdr (lp)))
+ (cons car cdr))))
+ (define (vector-clause code)
+ `((eq? code ,code)
+ (let* ((len (lp))
+ (v (make-vector len)))
+ (let init ((i 0))
+ (when (< i len)
+ (vector-set! v i (lp))
+ (init (1+ i))))
+ v)))
+ (define (symbol-clause code)
+ `((eq? code ,code)
+ (string->symbol (lp))))
+ (define (vtable-clause vtable code)
+ (call-with-values (lambda () (known-vtable vtable))
+ (lambda (mod name)
+ (let ((fields (map (lambda (i) (string->symbol (format #f "f~a" i)))
+ (iota (vtable-nfields vtable)))))
+ `((eq? code ,code)
+ (let* (,@(map (lambda (field) `(,field (lp))) fields))
+ (make-struct/no-tail (@ ,mod ,name) ,@fields)))))))
+ (define (constant-clause constant code)
+ `((eq? code ,code) ',constant))
+
+ `(lambda (bv)
+ (define pos 0)
+ (define (next-u8!)
+ (let ((u8 (bytevector-u8-ref bv pos)))
+ (set! pos (1+ pos))
+ u8))
+ (define (next-uleb!)
+ ,(if (< (next-code encoding) #x80)
+ ;; No need for uleb decoding in this case.
+ '(next-u8!)
+ ;; FIXME: We have a maximum code length and probably we
+ ;; should just inline the corresponding decoder instead of
+ ;; looping.
+ '(let lp ((n 0) (shift 0))
+ (let ((b (next-u8!)))
+ (if (zero? (logand b #x80))
+ (logior (ash b shift) n)
+ (lp (logior (ash (logxor #x80 b) shift) n)
+ (+ shift 7)))))))
+ (let lp ()
+ (let ((code (next-uleb!)))
+ (cond
+ ,@(if (pair-code encoding)
+ (list (pair-clause (pair-code encoding)))
+ '())
+ ,@(if (vector-code encoding)
+ (list (vector-clause (vector-code encoding)))
+ '())
+ ,@(if (symbol-code encoding)
+ (list (symbol-clause (symbol-code encoding)))
+ '())
+ ,@(hash-map->list vtable-clause (vtables encoding))
+ ,@(hash-map->list constant-clause (constants encoding))
+ (else (error "bad code" code)))))))
+
+(define (encode term encoding)
+ (call-with-output-bytevector
+ (lambda (port)
+ (define (put x) (put-uleb port x))
+ (let visit ((term term))
+ (cond
+ ((pair? term)
+ (put (pair-code encoding))
+ (visit (car term))
+ (visit (cdr term)))
+ ((vector? term)
+ (put (vector-code encoding))
+ (visit (vector-length term))
+ (let lp ((i 0))
+ (when (< i (vector-length term))
+ (visit (vector-ref term i))
+ (lp (1+ i)))))
+ ((symbol? term)
+ (put (symbol-code encoding))
+ (visit (symbol->string term)))
+ ((struct? term)
+ (let* ((vtable (struct-vtable term))
+ (nfields (vtable-nfields vtable)))
+ (put (hashq-ref (vtables encoding) vtable))
+ (let lp ((i 0))
+ (when (< i nfields)
+ (visit (struct-ref term i))
+ (lp (1+ i))))))
+ (else
+ (put (hash-ref (constants encoding) term))))))))
+
+(define (compute-encoding bindings)
+ (let ((encoding (make-encoding)))
+ (for-each (match-lambda
+ ((name . expr) (build-encoding! expr encoding)))
+ bindings)
+ (let ((encoded (map (match-lambda
+ ((name . expr) (cons name (encode expr encoding))))
+ bindings)))
+ `(lambda (name)
+ (define decode ,(compute-decoder encoding))
+ (cond
+ ,@(map (match-lambda
+ ((name . bv)
+ `((eq? name ',name) (decode ,bv))))
+ encoded)
+ (else #f))))))
+
+(define encoding-module (current-module))
+(define (compile-inlinable-exports bindings)
+ (let ((exp (compute-encoding bindings)))
+ (fix-letrec
+ (expand-primitives
+ (resolve-primitives
+ (compile-tree-il exp encoding-module '())
+ encoding-module)))))
+
+(define (attach-inlinables exp inlinables)
+ (post-order
+ (lambda (exp)
+ (match exp
+ (($ <call> src (and proc ($ <module-ref> _ '(guile) 'define-module* #f))
+ ((and m ($ <const> _ mod)) . args))
+ (cond
+ ((assoc-ref inlinables mod)
+ => (lambda (bindings)
+ (let ((inlinables (compile-inlinable-exports bindings)))
+ (make-call src proc
+ (cons* m
+ (make-const #f #:inlinable-exports)
+ inlinables
+ args)))))
+ (else exp)))
+ (exp exp)))
+ exp))
+
+(define (inlinable-exports exp)
+ (attach-inlinables exp (compute-inlinable-bindings exp)))
diff --git a/module/language/tree-il/letrectify.scm b/module/language/tree-il/letrectify.scm
index c27e75e60..60d057ffd 100644
--- a/module/language/tree-il/letrectify.scm
+++ b/module/language/tree-il/letrectify.scm
@@ -1,6 +1,6 @@
;;; transformation of top-level bindings into letrec*
-;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -252,6 +252,24 @@
(add-statement src init (make-void src))))
mod-vars)))))))
+ (($ <let> src names vars vals body)
+ (let lp ((names names) (vars vars) (vals vals) (mod-vars mod-vars))
+ (match (vector names vars vals)
+ (#(() () ())
+ (values (visit-expr body) mod-vars))
+ (#((name . names) (var . vars) (val . vals))
+ (let* ((val (visit-expr val))
+ (mod-vars
+ (match val
+ (($ <call> _
+ ($ <module-ref> _ '(guile) 'define-module* #f)
+ (($ <const> _ mod) . args))
+ (acons mod var mod-vars))
+ (_ mod-vars))))
+ (let-values (((exp mod-vars) (lp names vars vals mod-vars)))
+ (values (add-binding name var val exp)
+ mod-vars)))))))
+
(($ <seq> src head tail)
(let*-values (((head mod-vars) (visit-top-level head mod-vars))
((tail mod-vars) (visit-top-level tail mod-vars)))
diff --git a/module/language/tree-il/optimize.scm b/module/language/tree-il/optimize.scm
index c080bbbc2..b1d8b8294 100644
--- a/module/language/tree-il/optimize.scm
+++ b/module/language/tree-il/optimize.scm
@@ -1,6 +1,6 @@
;;; Tree-il optimizer
-;; Copyright (C) 2009, 2010-2015, 2018-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2010-2015, 2018-2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -39,22 +39,27 @@
'proc)))))
(let ((verify (or (lookup #:verify-tree-il? debug verify-tree-il)
(lambda (exp) exp)))
+ (modulify (lookup #:resolve-free-vars? resolve-free-vars))
(resolve (lookup #:resolve-primitives? primitives resolve-primitives))
(expand (lookup #:expand-primitives? primitives expand-primitives))
(letrectify (lookup #:letrectify? letrectify))
(seal? (assq-ref opts #:seal-private-bindings?))
+ (xinline? (assq-ref opts #:cross-module-inlining?))
(peval (lookup #:partial-eval? peval))
- (eta-expand (lookup #:eta-expand? eta-expand)))
+ (eta-expand (lookup #:eta-expand? eta-expand))
+ (inlinables (lookup #:inlinable-exports? inlinable-exports)))
(define-syntax-rule (run-pass! (proc exp arg ...))
(when proc (set! exp (verify (proc exp arg ...)))))
(lambda (exp env)
(verify exp)
+ (run-pass! (modulify exp))
(run-pass! (resolve exp env))
(run-pass! (expand exp))
(run-pass! (letrectify exp #:seal-private-bindings? seal?))
(run-pass! (fix-letrec exp))
- (run-pass! (peval exp env))
+ (run-pass! (peval exp env #:cross-module-inlining? xinline?))
(run-pass! (eta-expand exp))
+ (run-pass! (inlinables exp))
exp)))
(define (optimize x env opts)
diff --git a/module/language/tree-il/peval.scm b/module/language/tree-il/peval.scm
index 123b40384..d910088c9 100644
--- a/module/language/tree-il/peval.scm
+++ b/module/language/tree-il/peval.scm
@@ -368,7 +368,8 @@
(operand-size-limit 20)
(value-size-limit 10)
(effort-limit 500)
- (recursive-effort-limit 100))
+ (recursive-effort-limit 100)
+ (cross-module-inlining? #f))
"Partially evaluate EXP in compilation environment CENV, with
top-level bindings from ENV and return the resulting expression."
@@ -431,14 +432,54 @@ top-level bindings from ENV and return the resulting expression."
(define (lexical-refcount sym)
(var-refcount (lookup-var sym)))
+ (define (splice-expression exp)
+ (define vars (make-hash-table))
+ (define (rename! old*)
+ (match old*
+ (() '())
+ ((old . old*)
+ (cons (let ((new (gensym "t")))
+ (hashq-set! vars old new)
+ new)
+ (rename! old*)))))
+ (define (new-name old) (hashq-ref vars old))
+ (define renamed
+ (pre-order
+ (match-lambda
+ (($ <lexical-ref> src name gensym)
+ (make-lexical-ref src name (new-name gensym)))
+ (($ <lexical-set> src name gensym exp)
+ (make-lexical-set src name (new-name gensym) exp))
+ (($ <lambda-case> src req opt rest kw init gensyms body alt)
+ (let ((gensyms (rename! gensyms)))
+ (make-lambda-case src req opt rest
+ (match kw
+ ((aok? (kw name sym) ...)
+ (cons aok?
+ (map (lambda (kw name sym)
+ (list kw name (new-name sym)))
+ kw name sym)))
+ (#f #f))
+ init gensyms body alt)))
+ (($ <let> src names gensyms vals body)
+ (make-let src names (rename! gensyms) vals body))
+ (($ <letrec>)
+ (error "unexpected letrec"))
+ (($ <fix> src names gensyms vals body)
+ (make-fix src names (rename! gensyms) vals body))
+ (exp exp))
+ exp))
+ (set! store (build-var-table renamed store))
+ renamed)
+
(define (with-temporaries src exps refcount can-copy? k)
(let* ((pairs (map (match-lambda
- ((and exp (? can-copy?))
- (cons #f exp))
- (exp
- (let ((sym (gensym "tmp ")))
- (record-new-temporary! 'tmp sym refcount)
- (cons sym exp))))
+ ((and exp (? can-copy?))
+ (cons #f exp))
+ (exp
+ (let ((sym (gensym "tmp ")))
+ (record-new-temporary! 'tmp sym refcount)
+ (cons sym exp))))
exps))
(tmps (filter car pairs)))
(match tmps
@@ -449,9 +490,9 @@ top-level bindings from ENV and return the resulting expression."
(map car tmps)
(map cdr tmps)
(k (map (match-lambda
- ((#f . val) val)
- ((sym . _)
- (make-lexical-ref #f 'tmp sym)))
+ ((#f . val) val)
+ ((sym . _)
+ (make-lexical-ref #f 'tmp sym)))
pairs)))))))
(define (make-begin0 src first second)
@@ -506,14 +547,14 @@ top-level bindings from ENV and return the resulting expression."
(define (apply-primitive name args)
;; todo: further optimize commutative primitives
(catch #t
- (lambda ()
- (call-with-values
- (lambda ()
- (apply (module-ref the-scm-module name) args))
- (lambda results
- (values #t results))))
- (lambda _
- (values #f '()))))
+ (lambda ()
+ (call-with-values
+ (lambda ()
+ (apply (module-ref the-scm-module name) args))
+ (lambda results
+ (values #t results))))
+ (lambda _
+ (values #f '()))))
(define (make-values src values)
(match values
((single) single) ; 1 value
@@ -1027,8 +1068,45 @@ top-level bindings from ENV and return the resulting expression."
(make-primitive-ref src name)
exp))
exp)))
- (($ <module-ref>)
- exp)
+ (($ <module-ref> src module name public?)
+ (cond
+ ((and cross-module-inlining?
+ public?
+ (and=> (resolve-interface module)
+ (lambda (module)
+ (and=> (module-inlinable-exports module)
+ (lambda (proc) (proc name))))))
+ => (lambda (inlined)
+ ;; Similar logic to lexical-ref, but we can't enumerate
+ ;; uses, and don't know about aliases.
+ (log 'begin-xm-copy exp inlined)
+ (cond
+ ((eq? ctx 'effect)
+ (log 'xm-effect)
+ (make-void #f))
+ ((eq? ctx 'call)
+ ;; Don't propagate copies if we are residualizing a call.
+ (log 'residualize-xm-call exp)
+ exp)
+ ((or (const? inlined) (void? inlined) (primitive-ref? inlined))
+ ;; Always propagate simple values that cannot lead to
+ ;; code bloat.
+ (log 'copy-xm-const)
+ (for-tail inlined))
+ ;; Inline in operator position if it's a lambda that's
+ ;; small enough. Normally the inlinable-exports pass
+ ;; will only make small lambdas available for inlining,
+ ;; but you never know.
+ ((and (eq? ctx 'operator) (lambda? inlined)
+ (small-expression? inlined operator-size-limit))
+ (log 'copy-xm-operator exp inlined)
+ (splice-expression inlined))
+ (else
+ (log 'xm-copy-failed)
+ ;; Could copy small lambdas in value context. Something
+ ;; to revisit.
+ exp))))
+ (else exp)))
(($ <module-set> src mod name public? exp)
(make-module-set src mod name public? (for-value exp)))
(($ <toplevel-define> src mod name exp)
@@ -1146,55 +1224,55 @@ top-level bindings from ENV and return the resulting expression."
(with-temporaries
src (list w u) 2 constant-expression?
(match-lambda
- ((w u)
- (make-seq
- src
+ ((w u)
(make-seq
src
- (make-conditional
+ (make-seq
src
- ;; fixme: introduce logic to fold thunk?
- (make-primcall src 'thunk? (list u))
- (make-call src w '())
- (make-primcall
- src 'throw
- (list
- (make-const #f 'wrong-type-arg)
- (make-const #f "dynamic-wind")
- (make-const #f "Wrong type (expecting thunk): ~S")
- (make-primcall #f 'list (list u))
- (make-primcall #f 'list (list u)))))
- (make-primcall src 'wind (list w u)))
- (make-begin0 src
- (make-call src thunk '())
- (make-seq src
- (make-primcall src 'unwind '())
- (make-call src u '())))))))))
+ (make-conditional
+ src
+ ;; fixme: introduce logic to fold thunk?
+ (make-primcall src 'thunk? (list u))
+ (make-call src w '())
+ (make-primcall
+ src 'throw
+ (list
+ (make-const #f 'wrong-type-arg)
+ (make-const #f "dynamic-wind")
+ (make-const #f "Wrong type (expecting thunk): ~S")
+ (make-primcall #f 'list (list u))
+ (make-primcall #f 'list (list u)))))
+ (make-primcall src 'wind (list w u)))
+ (make-begin0 src
+ (make-call src thunk '())
+ (make-seq src
+ (make-primcall src 'unwind '())
+ (make-call src u '())))))))))
(($ <primcall> src 'with-fluid* (f v thunk))
(for-tail
(with-temporaries
src (list f v thunk) 1 constant-expression?
(match-lambda
- ((f v thunk)
- (make-seq src
- (make-primcall src 'push-fluid (list f v))
- (make-begin0 src
- (make-call src thunk '())
- (make-primcall src 'pop-fluid '()))))))))
+ ((f v thunk)
+ (make-seq src
+ (make-primcall src 'push-fluid (list f v))
+ (make-begin0 src
+ (make-call src thunk '())
+ (make-primcall src 'pop-fluid '()))))))))
(($ <primcall> src 'with-dynamic-state (state thunk))
(for-tail
(with-temporaries
src (list state thunk) 1 constant-expression?
(match-lambda
- ((state thunk)
- (make-seq src
- (make-primcall src 'push-dynamic-state (list state))
- (make-begin0 src
- (make-call src thunk '())
- (make-primcall src 'pop-dynamic-state
- '()))))))))
+ ((state thunk)
+ (make-seq src
+ (make-primcall src 'push-dynamic-state (list state))
+ (make-begin0 src
+ (make-call src thunk '())
+ (make-primcall src 'pop-dynamic-state
+ '()))))))))
(($ <primcall> src 'values exps)
(cond
@@ -1379,7 +1457,7 @@ top-level bindings from ENV and return the resulting expression."
(((? equality-primitive?) (and a ($ <const>)) b)
(for-tail (make-primcall src name (list b a))))
(((? equality-primitive?) ($ <lexical-ref> _ _ sym)
- ($ <lexical-ref> _ _ sym))
+ ($ <lexical-ref> _ _ sym))
(for-tail (make-const src #t)))
(('logbit? ($ <const> src2
@@ -1660,8 +1738,8 @@ top-level bindings from ENV and return the resulting expression."
($ <lambda-case> _ (_ . _) _ _ _ _ (k . _) body #f))
(not (tree-il-any
(match-lambda
- (($ <lexical-ref> _ _ (? (cut eq? <> k))) #t)
- (_ #f))
+ (($ <lexical-ref> _ _ (? (cut eq? <> k))) #t)
+ (_ #f))
body)))
(else #f)))
(if (and (not escape-only?) (escape-only-handler? handler))
diff --git a/module/language/tree-il/primitives.scm b/module/language/tree-il/primitives.scm
index 1cc7907a8..7f3746b4f 100644
--- a/module/language/tree-il/primitives.scm
+++ b/module/language/tree-il/primitives.scm
@@ -48,6 +48,7 @@
memq memv
= < > <= >= zero? positive? negative?
+ * - / 1- 1+ quotient remainder modulo exact->inexact
+ expt
ash logand logior logxor lognot logtest logbit?
sqrt abs floor ceiling sin cos tan asin acos atan
not
@@ -171,7 +172,7 @@
`(values
eq? eqv? equal?
= < > <= >= zero? positive? negative?
- ash logand logior logxor lognot logtest logbit?
+ expt ash logand logior logxor lognot logtest logbit?
+ * - / 1- 1+ sqrt abs quotient remainder modulo exact->inexact
floor ceiling sin cos tan asin acos atan
not
diff --git a/module/language/tree-il/resolve-free-vars.scm b/module/language/tree-il/resolve-free-vars.scm
new file mode 100644
index 000000000..3d4eb2bb0
--- /dev/null
+++ b/module/language/tree-il/resolve-free-vars.scm
@@ -0,0 +1,282 @@
+;;; Resolving free top-level references to modules
+;;; Copyright (C) 2021
+;;; Free Software Foundation, Inc.
+;;;
+;;; This 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 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; This 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 this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+
+
+(define-module (language tree-il resolve-free-vars)
+ #:use-module (ice-9 match)
+ #:use-module (language tree-il)
+ #:use-module ((srfi srfi-1) #:select (filter-map))
+ #:export (resolve-free-vars))
+
+(define (compute-assigned-lexicals exp)
+ (define assigned-lexicals '())
+ (define (add-assigned-lexical! var)
+ (set! assigned-lexicals (cons var assigned-lexicals)))
+ ((make-tree-il-folder)
+ exp
+ (lambda (exp)
+ (match exp
+ (($ <lexical-set> _ _ var _)
+ (add-assigned-lexical! var)
+ (values))
+ (_ (values))))
+ (lambda (exp)
+ (values)))
+ assigned-lexicals)
+
+(define (make-resolver mod local-definitions)
+ ;; Given that module A imports B and C, and X is free in A,
+ ;; unfortunately there are a few things preventing us from knowing
+ ;; whether the binding proceeds from B or C, just based on the text:
+ ;;
+ ;; - Renamers are evaluated at run-time.
+ ;; - Just using B doesn't let us know what definitions are in B.
+ ;;
+ ;; So instead of using the source program to determine where a binding
+ ;; comes from, we use the first-class module interface.
+ (define (imported-resolver iface)
+ (let ((public-iface (resolve-interface (module-name iface))))
+ (if (eq? iface public-iface)
+ (lambda (name)
+ (and (module-variable iface name)
+ (cons (module-name iface) name)))
+ (let ((by-var (make-hash-table)))
+ (module-for-each (lambda (name var)
+ (hashq-set! by-var var name))
+ public-iface)
+ (lambda (name)
+ (let ((var (module-variable iface name)))
+ (and var
+ (cons (module-name iface)
+ (hashq-ref by-var var)))))))))
+
+ (define the-module (resolve-module mod))
+ (define resolvers
+ (map imported-resolver (module-uses the-module)))
+
+ (lambda (name)
+ (cond
+ ((or (module-local-variable the-module name)
+ (memq name local-definitions))
+ 'local)
+ (else
+ (match (filter-map (lambda (resolve) (resolve name)) resolvers)
+ (() 'unknown)
+ (((mod . #f)) 'unknown)
+ (((mod . public-name)) (cons mod public-name))
+ ((_ _ . _) 'duplicate))))))
+
+;;; Record all bindings in a module, to know whether a toplevel-ref is
+;;; an import or not. If toplevel-ref to imported variable, transform
+;;; to module-ref or primitive-ref. New pass before peval.
+
+(define (compute-free-var-resolver exp)
+ (define assigned-lexicals (compute-assigned-lexicals exp))
+ (define module-definitions '())
+ (define module-lexicals '())
+ (define bindings '())
+ (define (add-module-definition! mod args)
+ (set! module-definitions (acons mod args module-definitions)))
+ (define (add-module-lexical! var mod)
+ (unless (memq var assigned-lexicals)
+ (set! module-lexicals (acons var mod module-lexicals))))
+ (define (add-binding! mod name)
+ (set! bindings (acons mod name bindings)))
+
+ (define (record-bindings! mod vars vals)
+ (for-each
+ (lambda (var val)
+ (match val
+ (($ <call> _ ($ <module-ref> _ '(guile) 'define-module* #f)
+ (($ <const> _ mod) . args))
+ (add-module-definition! mod args)
+ (add-module-lexical! var mod))
+ (($ <primcall> _ 'current-module ())
+ (when mod
+ (add-module-lexical! var mod)))
+ (_ #f)))
+ vars vals))
+
+ ;; Thread a conservative idea of what the current module is through
+ ;; the visit. Visiting an expression returns the name of the current
+ ;; module when the expression completes, or #f if unknown. Record the
+ ;; define-module* forms, if any, and note any toplevel definitions.
+ (define (visit exp) (visit/mod exp #f))
+ (define (visit* exps)
+ (unless (null? exps)
+ (visit (car exps))
+ (visit* (cdr exps))))
+ (define (visit+ exps mod)
+ (match exps
+ (() mod)
+ ((exp . exps)
+ (let lp ((mod' (visit/mod exp mod)) (exps exps))
+ (match exps
+ (() mod')
+ ((exp . exps)
+ (lp (and (equal? mod' (visit/mod exp mod)) mod')
+ exps)))))))
+ (define (visit/mod exp mod)
+ (match exp
+ ((or ($ <void>) ($ <const>) ($ <primitive-ref>) ($ <lexical-ref>)
+ ($ <module-ref>) ($ <toplevel-ref>))
+ mod)
+
+ (($ <call> _ ($ <module-ref> _ '(guile) 'set-current-module #f)
+ (($ <lexical-ref> _ _ var)))
+ (assq-ref module-lexicals var))
+
+ (($ <call> _ proc args)
+ (visit proc)
+ (visit* args)
+ #f)
+
+ (($ <primcall> _ _ args)
+ ;; There is no primcall that sets the current module.
+ (visit+ args mod))
+
+ (($ <conditional> src test consequent alternate)
+ (visit+ (list consequent alternate) (visit/mod test mod)))
+
+ (($ <lexical-set> src name gensym exp)
+ (visit/mod exp mod))
+
+ (($ <toplevel-set> src mod name exp)
+ (visit/mod exp mod))
+
+ (($ <module-set> src mod name public? exp)
+ (visit/mod exp mod))
+
+ (($ <toplevel-define> src mod name exp)
+ (add-binding! mod name)
+ (visit/mod exp mod))
+
+ (($ <lambda> src meta body)
+ (when body (visit body))
+ mod)
+
+ (($ <lambda-case> src req opt rest kw inits gensyms body alternate)
+ (visit* inits)
+ (let* ((bodies (cons body inits))
+ (bodies (if alternate (cons alternate bodies) bodies)))
+ (visit+ bodies mod)))
+
+ (($ <seq> src head tail)
+ (visit/mod tail (visit/mod head mod)))
+
+ (($ <let> src names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <letrec> src in-order? names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <fix> src names gensyms vals body)
+ (record-bindings! mod gensyms vals)
+ (visit/mod body (visit+ vals mod)))
+
+ (($ <let-values> src exp body)
+ (visit/mod body (visit/mod exp mod)))
+
+ (($ <prompt> src escape-only? tag body handler)
+ (visit+ (list body handler) (visit/mod tag mod)))
+
+ (($ <abort> src tag args tail)
+ (visit tag)
+ (visit* args)
+ (visit tail)
+ #f)))
+
+ (visit exp)
+
+ (define (kwarg-ref args kw kt kf)
+ (let lp ((args args))
+ (match args
+ (() (kf))
+ ((($ <const> _ (? keyword? kw')) val . args)
+ (if (eq? kw' kw)
+ (kt val)
+ (lp args)))
+ ((_ _ . args)
+ (lp args)))))
+ (define (kwarg-ref/const args kw kt kf)
+ (kwarg-ref args kw
+ (lambda (exp)
+ (match exp
+ (($ <const> _ val') (kt val'))
+ (_ (kf))))
+ kf))
+ (define (has-constant-initarg? args kw val)
+ (kwarg-ref/const args kw
+ (lambda (val')
+ (equal? val val'))
+ (lambda () #f)))
+
+ ;; Collect declarative modules defined once in this compilation unit.
+ (define declarative-modules
+ (let lp ((defs module-definitions) (not-declarative '()) (declarative '()))
+ (match defs
+ (() declarative)
+ (((mod . args) . defs)
+ (cond ((member mod not-declarative)
+ (lp defs not-declarative declarative))
+ ((or (assoc mod defs) ;; doubly defined?
+ (not (has-constant-initarg? args #:declarative? #t)))
+ (lp defs (cons mod not-declarative) declarative))
+ (else
+ (lp defs not-declarative (cons mod declarative))))))))
+
+ (define resolvers
+ (map (lambda (mod)
+ (define resolve
+ (make-resolver mod
+ (filter-map (match-lambda
+ ((mod' . name)
+ (and (equal? mod mod') name)))
+ bindings)))
+ (cons mod resolve))
+ declarative-modules))
+
+ (lambda (mod name)
+ (cond
+ ((assoc-ref resolvers mod)
+ => (lambda (resolve) (resolve name)))
+ (else 'unknown))))
+
+(define (resolve-free-vars exp)
+ "Traverse @var{exp}, extracting module-level definitions."
+ (define resolve
+ (compute-free-var-resolver exp))
+
+ (post-order
+ (lambda (exp)
+ (match exp
+ (($ <toplevel-ref> src mod name)
+ (match (resolve mod name)
+ ((or 'unknown 'duplicate 'local) exp)
+ ((mod . name)
+ (make-module-ref src mod name #t))))
+ (($ <toplevel-set> src mod name val)
+ (match (resolve mod name)
+ ((or 'unknown 'duplicate 'local) exp)
+ ((mod . name)
+ (make-module-set src mod name #t val))))
+ (exp exp)))
+ exp))
diff --git a/module/scheme/base.scm b/module/scheme/base.scm
index 20e280467..c6a73c092 100644
--- a/module/scheme/base.scm
+++ b/module/scheme/base.scm
@@ -56,10 +56,8 @@
bytevector bytevector-append
string->vector vector->string
(r7:string->utf8 . string->utf8)
- (r7:vector-copy . vector-copy)
(r7:vector->list . vector->list)
- (r7:vector-fill! . vector-fill!)
- vector-copy! vector-append vector-for-each vector-map
+ vector-append vector-for-each vector-map
(r7:bytevector-copy . bytevector-copy)
(r7:bytevector-copy! . bytevector-copy!)
(r7:utf8->string . utf8->string)
@@ -116,7 +114,7 @@
(char-ready? . u8-ready?)
unless
unquote unquote-splicing values
- vector
+ vector vector-copy vector-copy! vector-fill!
vector-length vector-ref vector-set! vector?
when with-exception-handler write-char
zero?))
@@ -433,41 +431,11 @@
;;; vector
-(define (%subvector v start end)
- (define mlen (- end start))
- (define out (make-vector (- end start)))
- (define (itr r)
- (if (= r mlen)
- out
- (begin
- (vector-set! out r (vector-ref v (+ start r)))
- (itr (+ r 1)))))
- (itr 0))
-
-(define r7:vector-copy
- (case-lambda*
- ((v) (vector-copy v))
- ((v start #:optional (end (vector-length v)))
- (%subvector v start end))))
-
-(define* (vector-copy! target tstart source
- #:optional (sstart 0) (send (vector-length source)))
- "Copy a block of elements from SOURCE to TARGET, both of which must be
-vectors, starting in TARGET at TSTART and starting in SOURCE at SSTART,
-ending when SEND - SSTART elements have been copied. It is an error for
-TARGET to have a length less than TSTART + (SEND - SSTART). SSTART
-defaults to 0 and SEND defaults to the length of SOURCE."
- (let ((tlen (vector-length target))
- (slen (vector-length source)))
- (if (< tstart sstart)
- (vector-move-left! source sstart send target tstart)
- (vector-move-right! source sstart send target tstart))))
-
(define r7:vector->list
(case-lambda*
((v) (vector->list v))
((v start #:optional (end (vector-length v)))
- (vector->list (%subvector v start end)))))
+ (vector->list (vector-copy v start end)))))
(define vector-map
(case-lambda*
@@ -518,16 +486,7 @@ defaults to 0 and SEND defaults to the length of SOURCE."
(case-lambda*
((v) (list->string (vector->list v)))
((v start #:optional (end (vector-length v)))
- (vector->string (%subvector v start end)))))
-
-(define r7:vector-fill!
- (case-lambda*
- ((vec fill) (vector-fill! vec fill))
- ((vec fill start #:optional (end (vector-length vec)))
- (let lp ((r start))
- (unless (= r end)
- (vector-set! vec r fill)
- (lp (+ r 1)))))))
+ (vector->string (vector-copy v start end)))))
(define (%subbytevector bv start end)
(define mlen (- end start))
diff --git a/module/srfi/srfi-1.scm b/module/srfi/srfi-1.scm
index 680ee94b5..57f9058b6 100644
--- a/module/srfi/srfi-1.scm
+++ b/module/srfi/srfi-1.scm
@@ -1,6 +1,6 @@
;;; srfi-1.scm --- List Library
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2014, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2014, 2020, 2021 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -734,7 +734,7 @@ the list returned."
(define (find-tail pred lst)
"Return the first pair of @var{lst} whose @sc{car} satisfies the
predicate @var{pred}, or return @code{#f} if no such element is found."
- (check-arg procedure? pred find)
+ (check-arg procedure? pred find-tail)
(let loop ((lst lst))
(and (not (null? lst))
(let ((head (car lst)))
diff --git a/module/srfi/srfi-43.scm b/module/srfi/srfi-43.scm
index eb6d8c317..18e97cf53 100644
--- a/module/srfi/srfi-43.scm
+++ b/module/srfi/srfi-43.scm
@@ -22,7 +22,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-8)
#:re-export (make-vector vector vector? vector-ref vector-set!
- vector-length vector-fill!)
+ vector-length vector-fill! vector-copy!)
#:replace (vector-copy list->vector vector->list)
#:export (vector-empty? vector= vector-unfold vector-unfold-right
vector-reverse-copy
@@ -35,7 +35,7 @@
vector-binary-search
vector-any vector-every
vector-swap! vector-reverse!
- vector-copy! vector-reverse-copy!
+ vector-reverse-copy!
reverse-vector->list
reverse-list->vector))
@@ -204,7 +204,6 @@ error for the number of seeds to vary between iterations."
(define guile-vector-copy (@ (guile) vector-copy))
-;; TODO: Enhance Guile core 'vector-copy' to do this.
(define vector-copy
(case-lambda*
"(vector-copy vec [start [end [fill]]]) -> vector
@@ -217,23 +216,20 @@ VEC, the slots in the new vector that obviously cannot be filled by
elements from VEC are filled with FILL, whose default value is
unspecified."
((v) (guile-vector-copy v))
- ((v start)
- (assert-vector v 'vector-copy)
- (let ((len (vector-length v)))
- (assert-valid-start start len 'vector-copy)
- (let ((result (make-vector (- len start))))
- (vector-move-left! v start len result 0)
- result)))
+ ((v start) (guile-vector-copy v start))
((v start end #:optional (fill *unspecified*))
(assert-vector v 'vector-copy)
(let ((len (vector-length v)))
- (unless (and (exact-integer? start)
- (exact-integer? end)
- (<= 0 start end))
- (error-from 'vector-copy "invalid index range" start end))
- (let ((result (make-vector (- end start) fill)))
- (vector-move-left! v start (min end len) result 0)
- result)))))
+ (if (<= end len)
+ (guile-vector-copy v start end)
+ (begin
+ (unless (and (exact-integer? start)
+ (exact-integer? end)
+ (<= 0 start end))
+ (error-from 'vector-copy "invalid index range" start end))
+ (let ((result (make-vector (- end start) fill)))
+ (vector-move-left! v start (min end len) result 0)
+ result)))))))
(define vector-reverse-copy
(let ()
@@ -937,19 +933,6 @@ START defaults to 0 and END defaults to the length of VEC."
(error-from 'copy! "would write past end of target"))
(%copy! target tstart source sstart send)))))))
-(define-vector-copier! vector-copy!
- "(vector-copy! target tstart source [sstart [send]]) -> unspecified
-
-Copy a block of elements from SOURCE to TARGET, both of which must be
-vectors, starting in TARGET at TSTART and starting in SOURCE at
-SSTART, ending when SEND - SSTART elements have been copied. It is an
-error for TARGET to have a length less than TSTART + (SEND - SSTART).
-SSTART defaults to 0 and SEND defaults to the length of SOURCE."
- (lambda (target tstart source sstart send)
- (if (< tstart sstart)
- (vector-move-left! source sstart send target tstart)
- (vector-move-right! source sstart send target tstart))))
-
(define-vector-copier! vector-reverse-copy!
"(vector-reverse-copy! target tstart source [sstart [send]]) -> unspecified
diff --git a/module/system/base/optimize.scm b/module/system/base/optimize.scm
index 03c57bf1b..8da908da6 100644
--- a/module/system/base/optimize.scm
+++ b/module/system/base/optimize.scm
@@ -1,6 +1,6 @@
;;; Optimization flags
-;; Copyright (C) 2018, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2018, 2020, 2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -28,12 +28,15 @@
(match lang-name
('tree-il
'((#:cps? 2)
+ (#:resolve-free-vars? 1)
(#:resolve-primitives? 1)
(#:expand-primitives? 1)
(#:letrectify? 2)
(#:seal-private-bindings? 3)
(#:partial-eval? 1)
- (#:eta-expand? 2)))
+ (#:eta-expand? 2)
+ (#:inlinable-exports? 1)
+ (#:cross-module-inlining? 2)))
('cps
'( ;; (#:split-rec? #t)
(#:simplify? 2)
diff --git a/module/system/foreign-library.scm b/module/system/foreign-library.scm
index d53e293ef..dc426385f 100644
--- a/module/system/foreign-library.scm
+++ b/module/system/foreign-library.scm
@@ -48,7 +48,7 @@
(define system-library-extensions
(cond
- ((string-contains %host-type "-darwin-")
+ ((string-contains %host-type "-darwin")
'(".bundle" ".so" ".dylib"))
((or (string-contains %host-type "cygwin")
(string-contains %host-type "mingw")
diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm
index ac1fa0933..0024fd165 100644
--- a/module/system/repl/command.scm
+++ b/module/system/repl/command.scm
@@ -1,6 +1,6 @@
;;; Repl commands
-;; Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013, 2020, 2021 Free Software Foundation, Inc.
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -22,10 +22,12 @@
(define-module (system repl command)
#:use-module (system base syntax)
#:use-module (system base pmatch)
- #:use-module (system base compile)
+ #:autoload (system base compile) (compile-file)
#:use-module (system repl common)
#:use-module (system repl debug)
- #:use-module (system vm disassembler)
+ #:autoload (system vm disassembler) (disassemble-image
+ disassemble-program
+ disassemble-file)
#:use-module (system vm loader)
#:use-module (system vm program)
#:use-module (system vm trap-state)
@@ -42,7 +44,7 @@
#:use-module ((ice-9 pretty-print) #:select ((pretty-print . pp)))
#:use-module ((system vm inspect) #:select ((inspect . %inspect)))
#:use-module (rnrs bytevectors)
- #:use-module (statprof)
+ #:autoload (statprof) (statprof)
#:export (meta-command define-meta-command))
@@ -55,7 +57,7 @@
(module (module m) (import use) (load l) (reload re) (binding b) (in))
(language (language L))
(compile (compile c) (compile-file cc)
- (expand exp) (optimize opt)
+ (expand exp) (optimize opt) (optimize-cps optx)
(disassemble x) (disassemble-file xx))
(profile (time t) (profile pr) (trace tr))
(debug (backtrace bt) (up) (down) (frame fr)
@@ -488,6 +490,11 @@ Run the optimizer on a piece of code and print the result."
(run-hook before-print-hook x)
(pp x)))
+(define-meta-command (optimize-cps repl (form))
+ "optimize-cps EXP
+Run the CPS optimizer on a piece of code and print the result."
+ (repl-optimize-cps repl (repl-parse repl form)))
+
(define-meta-command (disassemble repl (form))
"disassemble EXP
Disassemble a compiled procedure."
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index 29ae104c5..7f785b53e 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -32,7 +32,7 @@
repl-tm-stats repl-gc-stats repl-debug
repl-welcome repl-prompt
repl-read repl-compile repl-prepare-eval-thunk repl-eval
- repl-expand repl-optimize
+ repl-expand repl-optimize repl-optimize-cps
repl-parse repl-print repl-option-ref repl-option-set!
repl-default-option-set! repl-default-prompt-set!
puts ->string user-error
@@ -204,7 +204,7 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
#:env (current-module))
#:from lang #:to from)))
-(define* (repl-optimize repl form #:key (lang 'tree-il))
+(define (optimize* repl form lang print)
(let ((from (repl-language repl))
(make-lower (language-lowerer (lookup-language lang)))
(optimization-level (repl-optimization-level repl))
@@ -212,13 +212,21 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
(opts (repl-compile-options repl)))
(unless make-lower
(error "language has no optimizer" lang))
- (decompile ((make-lower optimization-level opts)
- (compile form #:from from #:to lang #:opts opts
- #:optimization-level optimization-level
- #:warning-level warning-level
- #:env (current-module))
- (current-module))
- #:from lang #:to from)))
+ (print ((make-lower optimization-level opts)
+ (compile form #:from from #:to lang #:opts opts
+ #:optimization-level optimization-level
+ #:warning-level warning-level
+ #:env (current-module))
+ (current-module)))))
+
+(define* (repl-optimize repl form #:key (lang 'tree-il))
+ (optimize* repl form lang
+ (lambda (exp)
+ (decompile exp #:from lang #:to (repl-language repl)))))
+
+(define* (repl-optimize-cps repl form)
+ (optimize* repl form 'cps
+ (module-ref (resolve-interface '(language cps dump)) 'dump)))
(define (repl-parse repl form)
(let ((parser (language-parser (repl-language repl))))
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index ad34a549d..be1b79e34 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -2061,8 +2061,9 @@ should be .data or .rodata), and return the resulting linker object.
((array? obj)
(let-values
- ;; array tag + rank + contp flag: see libguile/arrays.h .
- (((tag) (logior tc7-array (ash (array-rank obj) 17) (ash 1 16)))
+ ;; array tag + rank
+ ;; see libguile/arrays.h: SCM_I_ARRAY_NDIM, SCM_I_ARRAYP, scm_i_raw_array
+ (((tag) (logior tc7-array (ash (array-rank obj) 17)))
((bv-set! bvs-set!)
(case word-size
((4) (values bytevector-u32-set! bytevector-s32-set!))
@@ -2284,7 +2285,7 @@ needed."
;; FIXME: Define these somewhere central, shared with C.
(define *bytecode-major-version* #x0300)
-(define *bytecode-minor-version* 5)
+(define *bytecode-minor-version* 6)
(define (link-dynamic-section asm text rw rw-init frame-maps)
"Link the dynamic section for an ELF image with bytecode @var{text},
diff --git a/module/system/vm/trace.scm b/module/system/vm/trace.scm
index e9f17dae8..54840d8fd 100644
--- a/module/system/vm/trace.scm
+++ b/module/system/vm/trace.scm
@@ -73,7 +73,7 @@
(max-indent (- width 40)))
(define (apply-handler frame depth)
(print-application frame depth width prefix max-indent))
- (define (return-handler frame depth values)
+ (define (return-handler frame depth)
(print-return frame depth width prefix max-indent))
(trap-calls-to-procedure proc apply-handler return-handler))
diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test
index c2716ed17..3bf433582 100644
--- a/test-suite/tests/arrays.test
+++ b/test-suite/tests/arrays.test
@@ -419,7 +419,7 @@
(eq? a (array-contents (make-shared-array a (const '(0)))))
(eq? a (array-contents (make-shared-array a (const '(0))) #t)))))
- (pass-if "simple vector"
+ (pass-if "plain vector"
(let* ((a (make-array 0 4)))
(eq? a (array-contents a))))
diff --git a/test-suite/tests/bytevectors.test b/test-suite/tests/bytevectors.test
index 9ae040f1e..732aadb3e 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -65,6 +65,20 @@
(bytevector-fill! bv -128)
bv))
+ ;; This is a Guile-specific extension.
+ (pass-if-equal "bytevector-fill! range arguments I"
+ #vu8(0 0 1 1 1)
+ (let ((bv (make-bytevector 5 0)))
+ (bytevector-fill! bv 1 2)
+ bv))
+
+ ;; This is a Guile-specific extension.
+ (pass-if-equal "bytevector-fill! range arguments II"
+ #vu8(0 0 1 1 0)
+ (let ((bv (make-bytevector 5 0)))
+ (bytevector-fill! bv 1 2 4)
+ bv))
+
(pass-if "bytevector-copy! overlapping"
;; See <http://debbugs.gnu.org/10070>.
(let ((b (u8-list->bytevector '(1 2 3 4 5 6 7 8))))
diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test
index 254aaa720..466f2b821 100644
--- a/test-suite/tests/compiler.test
+++ b/test-suite/tests/compiler.test
@@ -302,73 +302,77 @@
'(3 #t #f #nil ()))))
(with-test-prefix "cse auxiliary definitions"
- (define test-code
- '(begin
- (define count 1)
- (set! count count) ;; Avoid inlining
-
- (define (main)
- (define (trampoline thunk)
- (let loop ((i 0) (result #f))
- (cond
- ((< i 1)
- (loop (+ i 1) (thunk)))
- (else
- (unless (= result 42) (error "bad result" result))
- result))))
- (define (test n)
- (let ((matrix (make-vector n)))
- (let loop ((i (- n 1)))
- (when (>= i 0)
- (vector-set! matrix i (make-vector n 42))
- (loop (- i 1))))
- (vector-ref (vector-ref matrix 0) 0)))
-
- (trampoline (lambda () (test count))))
- main))
-
- (define test-proc #f)
- (pass-if "compiling test works"
- (begin
- (set! test-proc (compile test-code))
- (procedure? test-proc)))
-
- (pass-if-equal "test terminates without error" 42
- (test-proc)))
+ (define test-proc
+ (compile
+ '(begin
+ (define count 1)
+ (set! count count) ;; Avoid inlining
+
+ (define (main)
+ (define (trampoline thunk)
+ (let loop ((i 0) (result #f))
+ (cond
+ ((< i 1)
+ (loop (+ i 1) (thunk)))
+ (else
+ (unless (= result 42) (error "bad result" result))
+ result))))
+ (define (test n)
+ (let ((matrix (make-vector n)))
+ (let loop ((i (- n 1)))
+ (when (>= i 0)
+ (vector-set! matrix i (make-vector n 42))
+ (loop (- i 1))))
+ (vector-ref (vector-ref matrix 0) 0)))
+
+ (trampoline (lambda () (test count))))
+ main)))
+
+ (pass-if-equal "running test" 42 (test-proc)))
(with-test-prefix "closure conversion"
- (define test-code
- '(lambda (arg)
- (define (A a)
- (let loop ((ls a))
- (cond ((null? ls)
- (B a))
- ((pair? ls)
- (if (list? (car ls))
- (loop (cdr ls))
- #t))
- (else #t))))
- (define (B b)
- (let loop ((ls b))
- (cond ((null? ls)
- (map A b))
- ((pair? ls)
- (if (list? (car ls))
- (loop (cdr ls))
- (error "bad" b)))
- (else
- (error "bad" b)))))
- (B arg)))
-
- (define test-proc #f)
- (pass-if "compiling test works"
- (begin
- (set! test-proc (compile test-code))
- (procedure? test-proc)))
-
- (pass-if-equal "test terminates without error" '(#t #t)
+ (define test-proc
+ (compile
+ '(lambda (arg)
+ (define (A a)
+ (let loop ((ls a))
+ (cond ((null? ls)
+ (B a))
+ ((pair? ls)
+ (if (list? (car ls))
+ (loop (cdr ls))
+ #t))
+ (else #t))))
+ (define (B b)
+ (let loop ((ls b))
+ (cond ((null? ls)
+ (map A b))
+ ((pair? ls)
+ (if (list? (car ls))
+ (loop (cdr ls))
+ (error "bad" b)))
+ (else
+ (error "bad" b)))))
+ (B arg))))
+
+ (pass-if-equal "running test" '(#t #t)
(test-proc '((V X) (Y Z)))))
+(with-test-prefix "constant propagation"
+ (define test-proc
+ (compile
+ '(lambda (a b)
+ (let ((c (if (and (eq? a 'foo)
+ (eq? b 'bar))
+ 'qux
+ a)))
+ c))))
+
+ (pass-if-equal "one two" 'one (test-proc 'one 'two))
+ (pass-if-equal "one bar" 'one (test-proc 'one 'bar))
+ (pass-if-equal "foo bar" 'qux (test-proc 'foo 'bar))
+ (pass-if-equal "foo two" 'foo (test-proc 'foo 'two)))
+
(with-test-prefix "read-and-compile tree-il"
(let ((code
"\
diff --git a/test-suite/tests/match.test b/test-suite/tests/match.test
index 6bf5bdd2c..b5dface86 100644
--- a/test-suite/tests/match.test
+++ b/test-suite/tests/match.test
@@ -1,6 +1,6 @@
;;;; match.test --- (ice-9 match) -*- mode: scheme; coding: utf-8; -*-
;;;;
-;;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
+;;;; Copyright (C) 2010, 2011, 2012, 2021 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -189,6 +189,17 @@
(($ rtd-3-slots a b c d)
#f))))))
+(with-test-prefix "unify in list patterns"
+ (pass-if-equal "matching" '(1 2 3)
+ (match '((1 2 3) (1 2 3))
+ (((x ...) (x ...)) x)
+ (_ #f)))
+
+ (pass-if-equal "not matching" #f
+ (match '((1 2 3) (1 2 3 4))
+ (((x ...) (x ...)) x)
+ (_ #f))))
+
;;;
;;; Upstream tests, from Chibi-Scheme (3-clause BSD license).
diff --git a/test-suite/tests/match.test.upstream b/test-suite/tests/match.test.upstream
index 7cbb80433..8dd73b566 100644
--- a/test-suite/tests/match.test.upstream
+++ b/test-suite/tests/match.test.upstream
@@ -30,6 +30,22 @@
(test "duplicate symbols bound" 3 (let ((a '(1 2))) (match a ((and (a 2) (1 b)) (+ a b)) (_ #f))))
(test "duplicate quasiquote" 'ok (match '(a b) ((or `(a ,x) `(,x b)) 'ok) (_ #f)))
+(test "duplicate before ellipsis" #f
+ (match '(1 2) ((a a ...) a) (else #f)))
+(test "duplicate ellipsis pass" '(1 2)
+ (match '((1 2) (1 2)) (((x ...) (x ...)) x) (else #f)))
+(test "duplicate ellipsis fail" #f
+ (match '((1 2) (1 2 3)) (((x ...) (x ...)) x) (else #f)))
+(test "duplicate ellipsis trailing" '(1 2)
+ (match '((1 2 3) (1 2 3)) (((x ... 3) (x ... 3)) x) (else #f)))
+(test "duplicate ellipsis trailing fail" #f
+ (match '((1 2 3) (1 1 3)) (((x ... 3) (x ... 3)) x) (else #f)))
+(test "duplicate ellipsis fail trailing" #f
+ (match '((1 2 3) (1 2 4)) (((x ... 3) (x ... 3)) x) (else #f)))
+(test "ellipsis trailing" '(3 1 2)
+ (match '(1 2 3) ((x ... y) (cons y x)) (else #f)))
+
+
(test "ellipses" '((a b c) (1 2 3))
(match '((a . 1) (b . 2) (c . 3))
(((x . y) ___) (list x y))))
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 59e370ec9..8f644874d 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -1,6 +1,6 @@
;;;; numbers.test --- tests guile's numbers -*- scheme -*-
;;;; Copyright (C) 2000, 2001, 2003-2006, 2009-2013,
-;;;; 2015, 2018 Free Software Foundation, Inc.
+;;;; 2015, 2018, 2021 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,7 @@
(define-module (test-suite test-numbers)
#:use-module (test-suite lib)
#:use-module (ice-9 documentation)
+ #:autoload (system base compile) (compile)
#:use-module (srfi srfi-1) ; list library
#:use-module (srfi srfi-11)) ; let-values
@@ -5468,7 +5469,15 @@
(ash-variant 123 (expt 2 1000)))))
(test-ash-variant 'ash ash floor #f)
- (test-ash-variant 'round-ash round-ash round #t))
+ (test-ash-variant 'round-ash round-ash round #t)
+
+ (pass-if-equal "ash at -O1" ;https://issues.guix.gnu.org/50696
+ '(4 1)
+ (compile '((lambda (x y)
+ (list (ash x 2) (ash y -2))) 1 4)
+ #:to 'value
+ #:opts '(#:cps? #f #:partial-eval? #f)
+ #:optimization-level 1)))
;;;
;;; regressions
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 1481a0a5d..ad7c6d575 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -536,6 +536,11 @@
(with-test-prefix "#{}#"
(pass-if (equal? (read-string "#{}#") '#{}#))
+ ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>
+ (pass-if (equal? (read-string "#{}}#") (string->symbol "}")))
+ (pass-if (equal? (read-string "#{}}}#") (string->symbol "}}")))
+ (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}")))
+ (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b")))
(pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
(pass-if (equal? (read-string "#{a}#") 'a))
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
diff --git a/test-suite/tests/syntax.test b/test-suite/tests/syntax.test
index a2999ac43..510e7104d 100644
--- a/test-suite/tests/syntax.test
+++ b/test-suite/tests/syntax.test
@@ -1684,6 +1684,16 @@
(hash interpreted most-positive-fixnum)
(hash compiled most-positive-fixnum))))
+(with-test-prefix "#nil in syntaxes"
+ (pass-if-equal "does not crash"
+ 42
+ (let ()
+ (define-syntax foo
+ (syntax-rules ()
+ ;; In 3.0.7 this would crash with
+ ;; unknown location: unexpected syntax in form ()
+ ((_ x) (when (eq? x #nil) 42))))
+ (foo #nil))))
;;; Local Variables:
;;; eval: (put 'pass-if-syntax-error 'scheme-indent-function 1)
diff --git a/test-suite/tests/vectors.test b/test-suite/tests/vectors.test
index 97b3f187a..371b51840 100644
--- a/test-suite/tests/vectors.test
+++ b/test-suite/tests/vectors.test
@@ -31,9 +31,18 @@
exception:immutable-vector
(vector-set! '#(1 2 3) 0 4)))
+(with-test-prefix "vector-copy"
+
+ (pass-if "defaults"
+ (equal? #(1 2 3) (vector-copy #(1 2 3))))
+ (pass-if "default end"
+ (equal? #(2 3) (vector-copy #(1 2 3) 1)))
+ (pass-if "start end"
+ (equal? #(2) (vector-copy #(1 2 3) 1 2))))
+
(with-test-prefix "vector->list"
- (pass-if "simple vector"
+ (pass-if "plain vector"
(equal? '(1 2 3) (vector->list #(1 2 3))))
(pass-if "string vector 1"