]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Update gnulib files.
authorSimon Josefsson <simon@josefsson.org>
Tue, 26 Jan 2010 14:39:52 +0000 (15:39 +0100)
committerSimon Josefsson <simon@josefsson.org>
Tue, 26 Jan 2010 14:39:52 +0000 (15:39 +0100)
411 files changed:
GNUmakefile
build-aux/arg-nonnull.h [new file with mode: 0644]
build-aux/config.rpath
build-aux/gendocs.sh
build-aux/gnupload
build-aux/link-warning.h [deleted file]
build-aux/pmccabe2html
build-aux/useless-if-before-free
build-aux/vc-list-files
build-aux/warn-on-use.h [new file with mode: 0644]
gl/Makefile.am
gl/accept.c
gl/alignof.h
gl/alloca.c
gl/alloca.in.h
gl/arpa_inet.in.h
gl/asnprintf.c
gl/bind.c
gl/c-ctype.c
gl/c-ctype.h
gl/close-hook.c
gl/close-hook.h
gl/close.c
gl/connect.c
gl/errno.in.h
gl/error.c
gl/error.h
gl/fclose.c
gl/float+.h
gl/float.in.h
gl/fseeko.c
gl/gai_strerror.c
gl/getaddrinfo.c
gl/getdelim.c
gl/getline.c
gl/getpass.c
gl/getpass.h
gl/gettext.h
gl/inet_ntop.c
gl/inet_pton.c
gl/intprops.h
gl/listen.c
gl/lseek.c
gl/m4/00gnulib.m4
gl/m4/alloca.m4
gl/m4/arpa_inet_h.m4
gl/m4/autobuild.m4
gl/m4/close.m4
gl/m4/errno_h.m4
gl/m4/error.m4
gl/m4/extensions.m4
gl/m4/fclose.m4
gl/m4/float_h.m4
gl/m4/fseeko.m4
gl/m4/getaddrinfo.m4
gl/m4/getdelim.m4
gl/m4/getline.m4
gl/m4/getpass.m4
gl/m4/gettimeofday.m4
gl/m4/gnulib-cache.m4
gl/m4/gnulib-common.m4
gl/m4/gnulib-comp.m4
gl/m4/gnulib-tool.m4
gl/m4/hostent.m4
gl/m4/include_next.m4
gl/m4/inet_ntop.m4
gl/m4/inet_pton.m4
gl/m4/intmax_t.m4
gl/m4/inttypes_h.m4
gl/m4/lib-ld.m4
gl/m4/lib-link.m4
gl/m4/lib-prefix.m4
gl/m4/longlong.m4
gl/m4/lseek.m4
gl/m4/malloc.m4
gl/m4/manywarnings.m4
gl/m4/memchr.m4
gl/m4/minmax.m4
gl/m4/mmap-anon.m4
gl/m4/multiarch.m4
gl/m4/netdb_h.m4
gl/m4/netinet_in_h.m4
gl/m4/perror.m4
gl/m4/printf.m4
gl/m4/read-file.m4
gl/m4/readline.m4
gl/m4/realloc.m4
gl/m4/select.m4
gl/m4/servent.m4
gl/m4/size_max.m4
gl/m4/snprintf.m4
gl/m4/sockets.m4
gl/m4/socklen.m4
gl/m4/sockpfaf.m4
gl/m4/stdarg.m4
gl/m4/stdbool.m4
gl/m4/stddef_h.m4
gl/m4/stdint.m4
gl/m4/stdint_h.m4
gl/m4/stdio_h.m4
gl/m4/stdlib_h.m4
gl/m4/strerror.m4
gl/m4/string_h.m4
gl/m4/sys_ioctl_h.m4
gl/m4/sys_select_h.m4
gl/m4/sys_socket_h.m4
gl/m4/sys_stat_h.m4
gl/m4/sys_time_h.m4
gl/m4/time_h.m4
gl/m4/ungetc.m4
gl/m4/unistd_h.m4
gl/m4/vasnprintf.m4
gl/m4/version-etc.m4
gl/m4/warnings.m4
gl/m4/wchar.m4
gl/m4/wchar_t.m4
gl/m4/wint_t.m4
gl/m4/xsize.m4
gl/memchr.c
gl/minmax.h
gl/netdb.in.h
gl/netinet_in.in.h
gl/override/lib/gettext.h.diff
gl/perror.c
gl/printf-args.c
gl/printf-args.h
gl/printf-parse.c
gl/printf-parse.h
gl/progname.c
gl/progname.h
gl/read-file.c
gl/read-file.h
gl/readline.c
gl/readline.h
gl/realloc.c
gl/recv.c
gl/select.c
gl/send.c
gl/setsockopt.c
gl/shutdown.c
gl/size_max.h
gl/snprintf.c
gl/socket.c
gl/sockets.c
gl/sockets.h
gl/stdarg.in.h
gl/stdbool.in.h
gl/stddef.in.h
gl/stdint.in.h
gl/stdio-impl.h
gl/stdio-write.c
gl/stdio.in.h
gl/stdlib.in.h
gl/strerror.c
gl/string.in.h
gl/sys_select.in.h
gl/sys_socket.in.h
gl/sys_stat.in.h
gl/sys_time.in.h
gl/tests/Makefile.am
gl/tests/dummy.c
gl/tests/gettimeofday.c
gl/tests/ioctl.c
gl/tests/sys_ioctl.in.h
gl/tests/test-alignof.c
gl/tests/test-alloca-opt.c
gl/tests/test-arpa_inet.c
gl/tests/test-c-ctype.c
gl/tests/test-errno.c
gl/tests/test-fseeko.c
gl/tests/test-getaddrinfo.c
gl/tests/test-getdelim.c
gl/tests/test-getline.c
gl/tests/test-gettimeofday.c
gl/tests/test-inet_ntop.c
gl/tests/test-inet_pton.c
gl/tests/test-lseek.c
gl/tests/test-memchr.c
gl/tests/test-netdb.c
gl/tests/test-netinet_in.c
gl/tests/test-perror.c
gl/tests/test-read-file.c
gl/tests/test-select-fd.c
gl/tests/test-select-stdin.c
gl/tests/test-select.c
gl/tests/test-snprintf.c
gl/tests/test-stdbool.c
gl/tests/test-stddef.c
gl/tests/test-stdint.c
gl/tests/test-stdio.c
gl/tests/test-stdlib.c
gl/tests/test-strerror.c
gl/tests/test-string.c
gl/tests/test-sys_select.c
gl/tests/test-sys_socket.c
gl/tests/test-sys_stat.c
gl/tests/test-sys_time.c
gl/tests/test-time.c
gl/tests/test-unistd.c
gl/tests/test-vasnprintf.c
gl/tests/test-vc-list-files-cvs.sh
gl/tests/test-vc-list-files-git.sh
gl/tests/test-version-etc.c
gl/tests/test-version-etc.sh
gl/tests/test-wchar.c
gl/tests/verify.h
gl/tests/w32sock.h
gl/tests/zerosize-ptr.h
gl/time.in.h
gl/unistd.in.h
gl/vasnprintf.c
gl/vasnprintf.h
gl/version-etc-fsf.c
gl/version-etc.c
gl/version-etc.h
gl/w32sock.h
gl/wchar.in.h
gl/xsize.h
lib/build-aux/config.rpath
lib/build-aux/link-warning.h [deleted file]
lib/gl/Makefile.am
lib/gl/alignof.h
lib/gl/alloca.in.h
lib/gl/asnprintf.c
lib/gl/asprintf.c
lib/gl/byteswap.in.h
lib/gl/c-ctype.c
lib/gl/c-ctype.h
lib/gl/close-hook.c
lib/gl/close-hook.h
lib/gl/errno.in.h
lib/gl/float+.h
lib/gl/float.in.h
lib/gl/fseeko.c
lib/gl/gettext.h
lib/gl/lseek.c
lib/gl/m4/00gnulib.m4
lib/gl/m4/alloca.m4
lib/gl/m4/byteswap.m4
lib/gl/m4/codeset.m4
lib/gl/m4/errno_h.m4
lib/gl/m4/extensions.m4
lib/gl/m4/float_h.m4
lib/gl/m4/fseeko.m4
lib/gl/m4/func.m4
lib/gl/m4/gettext.m4
lib/gl/m4/glibc2.m4
lib/gl/m4/glibc21.m4
lib/gl/m4/gnulib-cache.m4
lib/gl/m4/gnulib-common.m4
lib/gl/m4/gnulib-comp.m4
lib/gl/m4/gnulib-tool.m4
lib/gl/m4/iconv.m4
lib/gl/m4/include_next.m4
lib/gl/m4/intdiv0.m4
lib/gl/m4/intl.m4
lib/gl/m4/intldir.m4
lib/gl/m4/intlmacosx.m4
lib/gl/m4/intmax.m4
lib/gl/m4/intmax_t.m4
lib/gl/m4/inttypes-pri.m4
lib/gl/m4/inttypes_h.m4
lib/gl/m4/lcmessage.m4
lib/gl/m4/ld-output-def.m4
lib/gl/m4/ld-version-script.m4
lib/gl/m4/lib-ld.m4
lib/gl/m4/lib-link.m4
lib/gl/m4/lib-prefix.m4
lib/gl/m4/lock.m4
lib/gl/m4/longlong.m4
lib/gl/m4/lseek.m4
lib/gl/m4/malloc.m4
lib/gl/m4/memchr.m4
lib/gl/m4/memmem.m4
lib/gl/m4/minmax.m4
lib/gl/m4/mmap-anon.m4
lib/gl/m4/multiarch.m4
lib/gl/m4/netdb_h.m4
lib/gl/m4/nls.m4
lib/gl/m4/po.m4
lib/gl/m4/printf-posix.m4
lib/gl/m4/printf.m4
lib/gl/m4/progtest.m4
lib/gl/m4/read-file.m4
lib/gl/m4/realloc.m4
lib/gl/m4/size_max.m4
lib/gl/m4/snprintf.m4
lib/gl/m4/sockets.m4
lib/gl/m4/socklen.m4
lib/gl/m4/sockpfaf.m4
lib/gl/m4/stdbool.m4
lib/gl/m4/stddef_h.m4
lib/gl/m4/stdint.m4
lib/gl/m4/stdint_h.m4
lib/gl/m4/stdio_h.m4
lib/gl/m4/stdlib_h.m4
lib/gl/m4/strcase.m4
lib/gl/m4/string_h.m4
lib/gl/m4/strings_h.m4
lib/gl/m4/strverscmp.m4
lib/gl/m4/sys_socket_h.m4
lib/gl/m4/sys_stat_h.m4
lib/gl/m4/threadlib.m4
lib/gl/m4/time_h.m4
lib/gl/m4/time_r.m4
lib/gl/m4/uintmax_t.m4
lib/gl/m4/ungetc.m4
lib/gl/m4/unistd_h.m4
lib/gl/m4/vasnprintf.m4
lib/gl/m4/vasprintf.m4
lib/gl/m4/visibility.m4
lib/gl/m4/vsnprintf.m4
lib/gl/m4/wchar.m4
lib/gl/m4/wchar_t.m4
lib/gl/m4/wint_t.m4
lib/gl/m4/xsize.m4
lib/gl/memchr.c
lib/gl/memmem.c
lib/gl/minmax.h
lib/gl/netdb.in.h
lib/gl/override/lib/gettext.h.diff
lib/gl/printf-args.c
lib/gl/printf-args.h
lib/gl/printf-parse.c
lib/gl/printf-parse.h
lib/gl/read-file.c
lib/gl/read-file.h
lib/gl/realloc.c
lib/gl/size_max.h
lib/gl/snprintf.c
lib/gl/sockets.c
lib/gl/sockets.h
lib/gl/stdbool.in.h
lib/gl/stddef.in.h
lib/gl/stdint.in.h
lib/gl/stdio-impl.h
lib/gl/stdio-write.c
lib/gl/stdio.in.h
lib/gl/stdlib.in.h
lib/gl/str-two-way.h
lib/gl/strcasecmp.c
lib/gl/string.in.h
lib/gl/strings.in.h
lib/gl/strncasecmp.c
lib/gl/strverscmp.c
lib/gl/sys_socket.in.h
lib/gl/sys_stat.in.h
lib/gl/tests/Makefile.am
lib/gl/tests/dummy.c
lib/gl/tests/intprops.h
lib/gl/tests/test-alloca-opt.c
lib/gl/tests/test-byteswap.c
lib/gl/tests/test-c-ctype.c
lib/gl/tests/test-errno.c
lib/gl/tests/test-fseeko.c
lib/gl/tests/test-func.c
lib/gl/tests/test-memchr.c
lib/gl/tests/test-netdb.c
lib/gl/tests/test-read-file.c
lib/gl/tests/test-snprintf.c
lib/gl/tests/test-stdbool.c
lib/gl/tests/test-stddef.c
lib/gl/tests/test-stdint.c
lib/gl/tests/test-stdio.c
lib/gl/tests/test-stdlib.c
lib/gl/tests/test-string.c
lib/gl/tests/test-strings.c
lib/gl/tests/test-strverscmp.c
lib/gl/tests/test-sys_socket.c
lib/gl/tests/test-sys_stat.c
lib/gl/tests/test-time.c
lib/gl/tests/test-unistd.c
lib/gl/tests/test-vasnprintf.c
lib/gl/tests/test-vasprintf.c
lib/gl/tests/test-vsnprintf.c
lib/gl/tests/test-wchar.c
lib/gl/tests/verify.h
lib/gl/tests/zerosize-ptr.h
lib/gl/time.in.h
lib/gl/time_r.c
lib/gl/unistd.in.h
lib/gl/vasnprintf.c
lib/gl/vasnprintf.h
lib/gl/vasprintf.c
lib/gl/vsnprintf.c
lib/gl/w32sock.h
lib/gl/wchar.in.h
lib/gl/xsize.h
libextra/build-aux/config.rpath
libextra/gl/gnulib.mk
libextra/gl/hmac-md5.c
libextra/gl/hmac.h
libextra/gl/m4/00gnulib.m4
libextra/gl/m4/extensions.m4
libextra/gl/m4/gnulib-cache.m4
libextra/gl/m4/gnulib-common.m4
libextra/gl/m4/gnulib-comp.m4
libextra/gl/m4/gnulib-tool.m4
libextra/gl/m4/hmac-md5.m4
libextra/gl/m4/ld-output-def.m4
libextra/gl/m4/ld-version-script.m4
libextra/gl/m4/lib-ld.m4
libextra/gl/m4/lib-link.m4
libextra/gl/m4/lib-prefix.m4
libextra/gl/m4/md5.m4
libextra/gl/m4/memxor.m4
libextra/gl/md5.c
libextra/gl/md5.h
libextra/gl/memxor.c
libextra/gl/memxor.h
maint.mk

index 33eb3aa4d5c8fe5bc86f8e19ce88b86e8a855ba7..40ccc061d0c93ce2055c4b46772f05d15cd69adb 100644 (file)
@@ -5,7 +5,7 @@
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
-# Copyright (C) 2001, 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2010 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
diff --git a/build-aux/arg-nonnull.h b/build-aux/arg-nonnull.h
new file mode 100644 (file)
index 0000000..7e3e2db
--- /dev/null
@@ -0,0 +1,26 @@
+/* A C macro for declaring that specific arguments must not be NULL.
+   Copyright (C) 2009, 2010 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 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 General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
+#ifndef _GL_ARG_NONNULL
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+#  define _GL_ARG_NONNULL(params)
+# endif
+#endif
index 85c2f209beb72edebf886ca1de25f29f02c09aec..17298f2348bf0c5ce90917bf19abfb75a92ae179 100755 (executable)
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2008 Free Software Foundation, Inc.
+#   Copyright 1996-2010 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
index 992d9fc32c17fb8512803d991fe5ed0a1823c8ae..b50a6c7ffd80296ca2b74a3e0c9391624b70b758 100755 (executable)
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/sh -e
 # 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=2009-09-09.22
+scriptversion=2010-01-02.16
 
-# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 # Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -268,7 +268,7 @@ else
 fi
 
 echo Making .tar.gz for sources...
-srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null`
+srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
 tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles
 texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz`
 
index 002cee39a7b636c0868b285567a3813810ae0660..bfdad59b6a73e9a4ad5d6f2e8d83c32a27c10f60 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2009-12-21.21; # UTC
 
 # Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation
 #
@@ -73,34 +73,33 @@ actual command line options.  Use this to keep your defaults.  Comments
 (#) and empty lines in $conffile are allowed.
 
 Examples:
-1. Upload automake-1.8.2b.tar.gz and automake-1.8.2b.tar.bz2 to two sites:
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
-
-2. Same as above, but also create symbolic links to automake-latest.tar.*:
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --symlink-regex \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
-
-3. Symlink automake-1.8.2b.tar.gz to automake-latest.tar.gz and
-automake-1.8.2b.tar.bz2 to automake-latest.tar.bz2 on both sites:
+1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
 
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --symlink automake-1.8.2b.tar.gz automake-latest.tar.gz \\
-                     automake-1.8.2b.tar.bz2 automake-latest.tar.bz2
+2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
+  gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
 
-4. Delete automake-1.8.2a.tar.gz and .bz2, remove symlink
-automake-latest.tar.gz and upload automake-1.8.2b.tar.gz:
-
-  gnupload --to sources.redhat.com:~ftp/pub/automake \\
-           --to alpha.gnu.org:automake \\
-           --delete automake-1.8.2a.tar.gz automake-1.8.2a.tar.bz2 \\
-           --rmsymlink automake-latest.tar.gz \\
-           -- \\
-           automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
+3. Same as above, and also create symbolic links to foobar-latest.tar.*:
+  gnupload --to ftp.gnu.org:foobar \\
+           --symlink-regex \\
+           foobar-1.0.tar.gz foobar-1.0.tar.xz
+
+4. Upload foobar-0.9.90.tar.gz to two sites:
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           foobar-0.9.90.tar.gz
+
+5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
+   (the -- terminates the list of files to delete):
+  gnupload --to alpha.gnu.org:foobar \\
+           --to sources.redhat.com:~ftp/pub/foobar \\
+           --delete oopsbar-0.9.91.tar.gz \\
+           -- foobar-0.9.91.tar.gz
+
+gnupload uses the ncftpput program to do the transfers; if you don't
+happen to have an ncftp package installed, the ncftpput-ftp script in
+the build-aux/ directory of the gnulib package
+(http://savannah.gnu.org/projects/gnulib) may serve as a replacement.
 
 Report bugs to <bug-automake@gnu.org>.
 Send patches to <automake-patches@gnu.org>."
diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h
deleted file mode 100644 (file)
index fda0194..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]            \
-          __attribute__ ((__unused__,                          \
-                          __section__ (".gnu.warning"),                \
-                          __aligned__ (1)))                    \
-          = message "\n";                                      \
-        (void)0;                                               \
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
index dd397cff19ad1951386bdd93411627bc6a2b9540..3f887adc7d1b7f2ff25cfea0840a438e911bc51b 100644 (file)
@@ -1,6 +1,6 @@
 # pmccabe2html - AWK script to convert pmccabe output to html
 
-# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2009, 2010 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
@@ -64,7 +64,7 @@ BEGIN {
        html_prolog = "<a href=\"" url "\">Back to " package_name " Homepage</a><br/><br/>"
     }
     html_epilog = "<hr color=\"black\" size=\"2\"/> \
-Copyright (c) 2007, 2008 Free Software Foundation Inc."
+Copyright (c) 2007, 2008 Free Software Foundation, Inc."
     html_doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \
 \"http://www.w3.org/TR/html401/loose.dtd\">"
     html_comment = "<!-- Generated by gnulib's pmccabe2html at " systime() " -->"
@@ -135,22 +135,22 @@ function html_fnc_table (caption,
     {
         print "<caption class=\"function_table_caption\">" caption "</caption>"
     }
-    html_fnc_header(fname_p, 
-                    mcyclo_p, 
-                    cyclo_p, 
-                    num_statements_p, 
-                    num_lines_p, 
-                    first_line_p, 
+    html_fnc_header(fname_p,
+                    mcyclo_p,
+                    cyclo_p,
+                    num_statements_p,
+                    num_lines_p,
+                    first_line_p,
                     file_p)
     for (nfnc = 1; nfnc < nfuncs; nfnc++)
     {
         html_fnc(nfnc,
-                 fname_p, 
-                 mcyclo_p, 
-                 cyclo_p, 
-                 num_statements_p, 
-                 num_lines_p, 
-                 first_line_p, 
+                 fname_p,
+                 mcyclo_p,
+                 cyclo_p,
+                 num_statements_p,
+                 num_lines_p,
+                 first_line_p,
                  file_p)
     }
     print "</table>"
@@ -307,7 +307,7 @@ function html_fnc (nfun,
     if (mcyclo[nfun] > cyclo_high_max)
     {
         trclass="function_entry_untestable"
-    }   
+    }
     else if (mcyclo[nfun] > cyclo_moderate_max)
     {
         trclass="function_entry_high"
@@ -391,7 +391,7 @@ function html_fnc (nfun,
         {
             print file[nfun]
         }
+
         print "</td>"
 
 
@@ -409,7 +409,7 @@ function html_fnc (nfun,
             if (num_lines_p) { num_columns++ }
             if (first_line_p) { num_columns++ }
             if (file_p) { num_columns++ }
-            
+
             print "<td colspan=\"" num_columns "\" height=\"0\">"
             print "<div id=\"" fname "_src\" class=\"function_src\" style=\"position: relative; display: none;\">"
             print "<pre class=\"function_src\">"
@@ -419,7 +419,7 @@ function html_fnc (nfun,
                 sub(/\\</, "&lt;", codeline)
                 sub(/\\>/, "&gt;", codeline)
                 sub(/&/, "&amp;", codeline)
-                
+
                 print codeline
             }
             close(fname nfun "_fn.txt")
@@ -517,7 +517,7 @@ function html_function_cyclo ()
     print "Simple module, without much risk"
     print "</td>"
     print "</tr>"
-    # Moderate 
+    # Moderate
     print "<tr>"
     print "<td class=\"ranges_entry_moderate\">"
     print "&nbsp;"
@@ -589,7 +589,7 @@ function wiki_function_cyclo ()
     print "==Details for all functions=="
 
     print "Used ranges:"
-    
+
     print "{| class =\"cyclo_ranges_table\""
     print "|-"
     print "| class=\"cyclo_ranges_header_entry\" | "
@@ -646,22 +646,22 @@ function wiki_fnc_table (caption,
     {
         print "|+" caption
     }
-    wiki_fnc_header(fname_p, 
-                    mcyclo_p, 
-                    cyclo_p, 
-                    num_statements_p, 
-                    num_lines_p, 
-                    first_line_p, 
+    wiki_fnc_header(fname_p,
+                    mcyclo_p,
+                    cyclo_p,
+                    num_statements_p,
+                    num_lines_p,
+                    first_line_p,
                     file_p)
     for (nfnc = 1; nfnc < nfuncs; nfnc++)
     {
         wiki_fnc(nfnc,
-                 fname_p, 
-                 mcyclo_p, 
-                 cyclo_p, 
-                 num_statements_p, 
-                 num_lines_p, 
-                 first_line_p, 
+                 fname_p,
+                 mcyclo_p,
+                 cyclo_p,
+                 num_statements_p,
+                 num_lines_p,
+                 first_line_p,
                  file_p)
     }
     print "|}"
@@ -724,7 +724,7 @@ function wiki_fnc (nfnc,
     if (mcyclo[nfnc] > cyclo_high_max)
     {
         trclass="cyclo_function_entry_untestable"
-    }   
+    }
     else if (mcyclo[nfnc] > cyclo_moderate_max)
     {
         trclass="cyclo_function_entry_high"
@@ -773,7 +773,7 @@ function wiki_fnc (nfnc,
             href = source_file_link_tmpl
             sub(/%FILENAME%/, file[nfnc], href)
         }
-        
+
         # Source file
         print "| class=\"cyclo_function_entry_filename\" |" \
             ((href != "") ? "[" href " " file[nfnc] "]" : "[" file[nfnc] "]")
@@ -838,7 +838,7 @@ END {
     }
 
     # Print prolog
-    if ((output_lang == "html") && 
+    if ((output_lang == "html") &&
         (html_prolog != ""))
     {
         print html_prolog
@@ -884,9 +884,9 @@ END {
             wiki_function_cyclo()
         }
     }
-    
+
     # Print epilog
-    if ((output_lang == "html") && 
+    if ((output_lang == "html") &&
         (html_epilog != ""))
     {
         print html_epilog
index 793c9753e05f1f0ab7841582cef49287e8788f5c..6aa7d3965f4514f480a74bf388aa9e3f44559d12 100755 (executable)
@@ -12,7 +12,7 @@ my $VERSION = '2009-04-16 15:57'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008-2010 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
index cc716e9c3500809a6143a8b18b316a15880938a8..c07576d0d1423dc2457fee824f62f39a92abbc54 100755 (executable)
@@ -4,7 +4,7 @@
 # Print a version string.
 scriptversion=2009-07-21.16; # UTC
 
-# Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2006-2010 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
diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h
new file mode 100644 (file)
index 0000000..b314d36
--- /dev/null
@@ -0,0 +1,75 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010 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 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 General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* _GL_WARN_ON_USE(function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   This macro is useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.  However, one of the reasons that a function is a
+   portability trap is if it has the wrong signature.  Declaring
+   FUNCTION with a different signature in C is a compilation error, so
+   this macro must use the same type as any existing declaration so
+   that programs that avoid the problematic FUNCTION do not fail to
+   compile merely because they included a header that poisoned the
+   function.  But this implies that _GL_WARN_ON_USE is only safe to
+   use if FUNCTION is known to already have a declaration.  Use of
+   this macro implies that there must not be any other macro hiding
+   the declaration of FUNCTION; but undefining FUNCTION first is part
+   of the poisoning process anyway (although for symbols that are
+   provided only via a macro, the result is a compilation error rather
+   than a warning containing "literal string").  Also note that in
+   C++, it is only safe to use if FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+   #if HAVE_RAW_DECL_ENVIRON
+   static inline char ***rpl_environ (void) { return &environ; }
+   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+   # undef environ
+   # define environ (*rpl_environ ())
+   #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern int _gl_warn_on_use
+# endif
+#endif
index 6577ce03a354d3cfec627d77e4275f2d73ff423b..bd6a43e636f004f57f7e9246dd9c6b00f9f8efc5 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -84,13 +84,37 @@ EXTRA_DIST += alloca.in.h
 
 ## end   gnulib module alloca-opt
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module arpa_inet
 
-BUILT_SOURCES += $(ARPA_INET_H)
+BUILT_SOURCES += arpa/inet.h
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
-arpa/inet.h: arpa_inet.in.h
+arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) arpa
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -102,7 +126,8 @@ arpa/inet.h: arpa_inet.in.h
              -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
              -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
              -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/arpa_inet.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -327,14 +352,6 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
-## begin gnulib module link-warning
-
-LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module listen
 
 
@@ -380,7 +397,7 @@ BUILT_SOURCES += $(NETDB_H)
 
 # We need the following in order to create <netdb.h> when the system
 # doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -393,6 +410,7 @@ netdb.h: netdb.in.h
              -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
              -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
              -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/netdb.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -662,7 +680,7 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h
+stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -708,7 +726,8 @@ stdio.h: stdio.in.h
              -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|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             < $(srcdir)/stdio.in.h | \
+         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
@@ -746,8 +765,8 @@ stdio.h: stdio.in.h
              -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
              -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdio.in.h; \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
@@ -764,7 +783,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h
+stdlib.h: stdlib.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -817,9 +836,11 @@ stdlib.h: stdlib.in.h
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -844,7 +865,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -883,6 +904,8 @@ string.h: string.in.h
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -910,7 +933,8 @@ string.h: string.in.h
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -922,11 +946,11 @@ EXTRA_DIST += string.in.h
 
 ## begin gnulib module sys_select
 
-BUILT_SOURCES += $(SYS_SELECT_H)
+BUILT_SOURCES += sys/select.h
 
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h
+sys/select.h: sys_select.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -937,7 +961,7 @@ sys/select.h: sys_select.in.h
              -e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
              -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_select.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -950,11 +974,11 @@ EXTRA_DIST += sys_select.in.h
 
 ## begin gnulib module sys_socket
 
-BUILT_SOURCES += $(SYS_SOCKET_H)
+BUILT_SOURCES += sys/socket.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h
+sys/socket.h: sys_socket.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -983,7 +1007,8 @@ sys/socket.h: sys_socket.in.h
              -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
              -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
              -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_socket.in.h; \
        } > $@-t && \
        mv -f $@-t $@
@@ -1000,7 +1025,7 @@ BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h
+sys/stat.h: sys_stat.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1039,7 +1064,8 @@ sys/stat.h: sys_stat.in.h
              -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
              -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
              -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_stat.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -1056,7 +1082,7 @@ BUILT_SOURCES += $(SYS_TIME_H)
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h
+sys/time.h: sys_time.in.h $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1066,6 +1092,7 @@ sys/time.h: sys_time.in.h
              -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
              -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
              -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/sys_time.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -1081,7 +1108,7 @@ BUILT_SOURCES += time.h
 
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
-time.h: time.in.h
+time.h: time.in.h $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1094,6 +1121,7 @@ time.h: time.in.h
              -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
              -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/time.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -1109,7 +1137,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h
+unistd.h: unistd.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -1132,6 +1160,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|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_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
@@ -1140,6 +1169,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
+             -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
              -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
@@ -1150,8 +1180,10 @@ unistd.h: unistd.in.h
              -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|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
+             < $(srcdir)/unistd.in.h | \
+         sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -1163,18 +1195,21 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
              -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
+             -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
              -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
              -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
+             -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
+             -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
@@ -1192,16 +1227,19 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
              -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
              -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
              -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
+             -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
              -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
              -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
              -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
+             -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/unistd.in.h; \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
@@ -1245,13 +1283,32 @@ libgnu_la_SOURCES += version-etc-fsf.c
 
 ## end   gnulib module version-etc-fsf
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar
 
-BUILT_SOURCES += $(WCHAR_H)
+BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1293,7 +1350,8 @@ wchar.h: wchar.in.h
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > $@-t && \
        mv $@-t $@
index ae46537792b369e4814e7c7e24b36620f351b085..8a3079f574571b449823181426b3eb31a17934ae 100644 (file)
@@ -1,6 +1,6 @@
 /* accept.c --- wrappers for Windows accept function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 0d2099cfd3d1f31cf7044a98315706d01168268c..240468c682e9950c8b3b856e817e8f3fea57f3d8 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine alignment of types.
-   Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2004, 2006, 2009-2010 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
index ff1cb7e9a6bc60ea33cdb5a956fa39eda671aa05..75afdb9607a9fc52db3d965130120d682b8b9e93 100644 (file)
@@ -81,37 +81,37 @@ long i00afunc ();
    STACK_DIRECTION = 0 => direction of growth unknown  */
 
 #  ifndef STACK_DIRECTION
-#   define STACK_DIRECTION     0       /* Direction unknown.  */
+#   define STACK_DIRECTION      0       /* Direction unknown.  */
 #  endif
 
 #  if STACK_DIRECTION != 0
 
-#   define STACK_DIR   STACK_DIRECTION /* Known at compile-time.  */
+#   define STACK_DIR    STACK_DIRECTION /* Known at compile-time.  */
 
 #  else /* STACK_DIRECTION == 0; need run-time code.  */
 
-static int stack_dir;          /* 1 or -1 once known.  */
-#   define STACK_DIR   stack_dir
+static int stack_dir;           /* 1 or -1 once known.  */
+#   define STACK_DIR    stack_dir
 
 static void
 find_stack_direction (void)
 {
-  static char *addr = NULL;    /* Address of first `dummy', once known.  */
-  auto char dummy;             /* To get stack address.  */
+  static char *addr = NULL;     /* Address of first `dummy', once known.  */
+  auto char dummy;              /* To get stack address.  */
 
   if (addr == NULL)
-    {                          /* Initial entry.  */
+    {                           /* Initial entry.  */
       addr = ADDRESS_FUNCTION (dummy);
 
-      find_stack_direction (); /* Recurse once.  */
+      find_stack_direction ();  /* Recurse once.  */
     }
   else
     {
       /* Second entry.  */
       if (ADDRESS_FUNCTION (dummy) > addr)
-       stack_dir = 1;          /* Stack grew upward.  */
+        stack_dir = 1;          /* Stack grew upward.  */
       else
-       stack_dir = -1;         /* Stack grew downward.  */
+        stack_dir = -1;         /* Stack grew downward.  */
     }
 }
 
@@ -124,21 +124,21 @@ find_stack_direction (void)
    It is very important that sizeof(header) agree with malloc
    alignment chunk size.  The following default should work okay.  */
 
-#  ifndef      ALIGN_SIZE
-#   define ALIGN_SIZE  sizeof(double)
+#  ifndef       ALIGN_SIZE
+#   define ALIGN_SIZE   sizeof(double)
 #  endif
 
 typedef union hdr
 {
-  char align[ALIGN_SIZE];      /* To force sizeof(header).  */
+  char align[ALIGN_SIZE];       /* To force sizeof(header).  */
   struct
     {
-      union hdr *next;         /* For chaining headers.  */
-      char *deep;              /* For stack depth measure.  */
+      union hdr *next;          /* For chaining headers.  */
+      char *deep;               /* For stack depth measure.  */
     } h;
 } header;
 
-static header *last_alloca_header = NULL;      /* -> last alloca header.  */
+static header *last_alloca_header = NULL;       /* -> last alloca header.  */
 
 /* Return a pointer to at least SIZE bytes of storage,
    which will be automatically reclaimed upon exit from
@@ -150,11 +150,11 @@ static header *last_alloca_header = NULL; /* -> last alloca header.  */
 void *
 alloca (size_t size)
 {
-  auto char probe;             /* Probes stack depth: */
+  auto char probe;              /* Probes stack depth: */
   register char *depth = ADDRESS_FUNCTION (probe);
 
 #  if STACK_DIRECTION == 0
-  if (STACK_DIR == 0)          /* Unknown growth direction.  */
+  if (STACK_DIR == 0)           /* Unknown growth direction.  */
     find_stack_direction ();
 #  endif
 
@@ -162,7 +162,7 @@ alloca (size_t size)
      was allocated from deeper in the stack than currently.  */
 
   {
-    register header *hp;       /* Traverses linked list.  */
+    register header *hp;        /* Traverses linked list.  */
 
 #  ifdef emacs
     BLOCK_INPUT;
@@ -170,18 +170,18 @@ alloca (size_t size)
 
     for (hp = last_alloca_header; hp != NULL;)
       if ((STACK_DIR > 0 && hp->h.deep > depth)
-         || (STACK_DIR < 0 && hp->h.deep < depth))
-       {
-         register header *np = hp->h.next;
+          || (STACK_DIR < 0 && hp->h.deep < depth))
+        {
+          register header *np = hp->h.next;
 
-         free (hp);            /* Collect garbage.  */
+          free (hp);            /* Collect garbage.  */
 
-         hp = np;              /* -> next header.  */
-       }
+          hp = np;              /* -> next header.  */
+        }
       else
-       break;                  /* Rest are not deeper.  */
+        break;                  /* Rest are not deeper.  */
 
-    last_alloca_header = hp;   /* -> last valid storage.  */
+    last_alloca_header = hp;    /* -> last valid storage.  */
 
 #  ifdef emacs
     UNBLOCK_INPUT;
@@ -189,7 +189,7 @@ alloca (size_t size)
   }
 
   if (size == 0)
-    return NULL;               /* No allocation required.  */
+    return NULL;                /* No allocation required.  */
 
   /* Allocate combined header + user data storage.  */
 
@@ -229,10 +229,10 @@ alloca (size_t size)
 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
 struct stack_control_header
   {
-    long shgrow:32;            /* Number of times stack has grown.  */
-    long shaseg:32;            /* Size of increments to stack.  */
-    long shhwm:32;             /* High water mark of stack.  */
-    long shsize:32;            /* Current size of stack (all segments).  */
+    long shgrow:32;             /* Number of times stack has grown.  */
+    long shaseg:32;             /* Size of increments to stack.  */
+    long shhwm:32;              /* High water mark of stack.  */
+    long shsize:32;             /* Current size of stack (all segments).  */
   };
 
 /* The stack segment linkage control information occurs at
@@ -244,21 +244,21 @@ struct stack_control_header
 
 struct stack_segment_linkage
   {
-    long ss[0200];             /* 0200 overflow words.  */
-    long sssize:32;            /* Number of words in this segment.  */
-    long ssbase:32;            /* Offset to stack base.  */
+    long ss[0200];              /* 0200 overflow words.  */
+    long sssize:32;             /* Number of words in this segment.  */
+    long ssbase:32;             /* Offset to stack base.  */
     long:32;
-    long sspseg:32;            /* Offset to linkage control of previous
-                                  segment of stack.  */
+    long sspseg:32;             /* Offset to linkage control of previous
+                                   segment of stack.  */
     long:32;
-    long sstcpt:32;            /* Pointer to task common address block.  */
-    long sscsnm;               /* Private control structure number for
-                                  microtasking.  */
-    long ssusr1;               /* Reserved for user.  */
-    long ssusr2;               /* Reserved for user.  */
-    long sstpid;               /* Process ID for pid based multi-tasking.  */
-    long ssgvup;               /* Pointer to multitasking thread giveup.  */
-    long sscray[7];            /* Reserved for Cray Research.  */
+    long sstcpt:32;             /* Pointer to task common address block.  */
+    long sscsnm;                /* Private control structure number for
+                                   microtasking.  */
+    long ssusr1;                /* Reserved for user.  */
+    long ssusr2;                /* Reserved for user.  */
+    long sstpid;                /* Process ID for pid based multi-tasking.  */
+    long ssgvup;                /* Pointer to multitasking thread giveup.  */
+    long sscray[7];             /* Reserved for Cray Research.  */
     long ssa0;
     long ssa1;
     long ssa2;
@@ -282,27 +282,27 @@ struct stack_segment_linkage
    returned by the STKSTAT library routine.  */
 struct stk_stat
   {
-    long now;                  /* Current total stack size.  */
-    long maxc;                 /* Amount of contiguous space which would
-                                  be required to satisfy the maximum
-                                  stack demand to date.  */
-    long high_water;           /* Stack high-water mark.  */
-    long overflows;            /* Number of stack overflow ($STKOFEN) calls.  */
-    long hits;                 /* Number of internal buffer hits.  */
-    long extends;              /* Number of block extensions.  */
-    long stko_mallocs;         /* Block allocations by $STKOFEN.  */
-    long underflows;           /* Number of stack underflow calls ($STKRETN).  */
-    long stko_free;            /* Number of deallocations by $STKRETN.  */
-    long stkm_free;            /* Number of deallocations by $STKMRET.  */
-    long segments;             /* Current number of stack segments.  */
-    long maxs;                 /* Maximum number of stack segments so far.  */
-    long pad_size;             /* Stack pad size.  */
-    long current_address;      /* Current stack segment address.  */
-    long current_size;         /* Current stack segment size.  This
-                                  number is actually corrupted by STKSTAT to
-                                  include the fifteen word trailer area.  */
-    long initial_address;      /* Address of initial segment.  */
-    long initial_size;         /* Size of initial segment.  */
+    long now;                   /* Current total stack size.  */
+    long maxc;                  /* Amount of contiguous space which would
+                                   be required to satisfy the maximum
+                                   stack demand to date.  */
+    long high_water;            /* Stack high-water mark.  */
+    long overflows;             /* Number of stack overflow ($STKOFEN) calls.  */
+    long hits;                  /* Number of internal buffer hits.  */
+    long extends;               /* Number of block extensions.  */
+    long stko_mallocs;          /* Block allocations by $STKOFEN.  */
+    long underflows;            /* Number of stack underflow calls ($STKRETN).  */
+    long stko_free;             /* Number of deallocations by $STKRETN.  */
+    long stkm_free;             /* Number of deallocations by $STKMRET.  */
+    long segments;              /* Current number of stack segments.  */
+    long maxs;                  /* Maximum number of stack segments so far.  */
+    long pad_size;              /* Stack pad size.  */
+    long current_address;       /* Current stack segment address.  */
+    long current_size;          /* Current stack segment size.  This
+                                   number is actually corrupted by STKSTAT to
+                                   include the fifteen word trailer area.  */
+    long initial_address;       /* Address of initial segment.  */
+    long initial_size;          /* Size of initial segment.  */
   };
 
 /* The following structure describes the data structure which trails
@@ -311,13 +311,13 @@ struct stk_stat
 
 struct stk_trailer
   {
-    long this_address;         /* Address of this block.  */
-    long this_size;            /* Size of this block (does not include
-                                  this trailer).  */
+    long this_address;          /* Address of this block.  */
+    long this_size;             /* Size of this block (does not include
+                                   this trailer).  */
     long unknown2;
     long unknown3;
-    long link;                 /* Address of trailer block of previous
-                                  segment.  */
+    long link;                  /* Address of trailer block of previous
+                                   segment.  */
     long unknown5;
     long unknown6;
     long unknown7;
@@ -355,8 +355,8 @@ i00afunc (long *address)
   /* Set up the iteration.  */
 
   trailer = (struct stk_trailer *) (status.current_address
-                                   + status.current_size
-                                   - 15);
+                                    + status.current_size
+                                    - 15);
 
   /* There must be at least one stack segment.  Therefore it is
      a fatal error if "trailer" is null.  */
@@ -371,10 +371,10 @@ i00afunc (long *address)
       block = (long *) trailer->this_address;
       size = trailer->this_size;
       if (block == 0 || size == 0)
-       abort ();
+        abort ();
       trailer = (struct stk_trailer *) trailer->link;
       if ((block <= address) && (address < (block + size)))
-       break;
+        break;
     }
 
   /* Set the result to the offset in this segment and add the sizes
@@ -390,7 +390,7 @@ i00afunc (long *address)
   do
     {
       if (trailer->this_size <= 0)
-       abort ();
+        abort ();
       result += trailer->this_size;
       trailer = (struct stk_trailer *) trailer->link;
     }
@@ -453,7 +453,7 @@ i00afunc (long address)
       fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
 #    endif
       if (pseg == 0)
-       break;
+        break;
       stkl = stkl - pseg;
       ssptr = (struct stack_segment_linkage *) stkl;
       size = ssptr->sssize;
index 6269607a475d3d5dda8a7ba07ab13cc1bb7087c4..44f20b7a1a0d7fb17c52ecffcf9eedc1c9e3a091 100644 (file)
@@ -1,7 +1,7 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2010 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
index ac933991436c5b02226bd7e2363c3c007bee4f12..99968930c89b4a806a63a50c189de5ba4152c609 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <arpa/inet.h>.
 
-   Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2010 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
 #ifndef _GL_ARPA_INET_H
 
 /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
-   under MinGW. */
-#include <sys/socket.h>
+   under MinGW.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
 
 #if @HAVE_ARPA_INET_H@
 
@@ -36,7 +39,9 @@
 #ifndef _GL_ARPA_INET_H
 #define _GL_ARPA_INET_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -60,26 +65,28 @@ extern "C" {
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
 extern const char *inet_ntop (int af, const void *restrict src,
-                             char *restrict dst, socklen_t cnt);
+                              char *restrict dst, socklen_t cnt)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_ntop
-# define inet_ntop(af,src,dst,cnt) \
-    (GL_LINK_WARNING ("inet_ntop is unportable - " \
-                      "use gnulib module inet_ntop for portability"), \
-     inet_ntop (af, src, dst, cnt))
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
 #endif
 
 #if @GNULIB_INET_PTON@
 # if !@HAVE_DECL_INET_PTON@
-extern int inet_pton (int af, const char *restrict src, void *restrict dst);
+extern int inet_pton (int af, const char *restrict src, void *restrict dst)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_pton
-# define inet_pton(af,src,dst) \
-  (GL_LINK_WARNING ("inet_pton is unportable - " \
-                   "use gnulib module inet_pton for portability"), \
-   inet_pton (af, src, dst))
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index bf2abf3c9d1e09ea9e721a97a24bab66ab51a282..3bd2229d524875e7fb2dabccc4d2b9d2d8553bca 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009, 2010 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
index 108a2393ce05bd6c6a06850bae2e4baacbea754d..fe88d03d8f638bb024872f844872b228644f06d3 100644 (file)
--- a/gl/bind.c
+++ b/gl/bind.c
@@ -1,6 +1,6 @@
 /* bind.c --- wrappers for Windows bind function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index b87e6ef31a47a556442849a89ff26c0e7723ed9a..0d8da205b677e3b9328e2c74f928ca339a34fa33 100644 (file)
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright 2000-2003, 2006 Free Software Foundation, Inc.
+   Copyright 2000-2003, 2006, 2009-2010 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
index d78dd19d5dc9a18fbde4533e1a362ffc3af743cc..0eb27e659b1b54a8dc881827731e067456279703 100644 (file)
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2010 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
index fe1f22c780524089c7349251393319c04bd30a2e..0253c4dc5957726f30409c6a4ab252083a082241 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making the close() function extensible.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -66,7 +66,7 @@ register_close_hook (close_hook_fn hook, struct close_hook *link)
     {
       /* The link is already in use.  */
       if (link->private_fn != hook)
-       abort ();
+        abort ();
     }
 }
 
index 460603abac2478845935f6c9c9e043c3cb2099d8..1e115516d62fc440a062c3145e31e3906c84b855 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making the close() function extensible.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index 5278f24bba531debd6a4d9d32926a90936ae4f7c..afa8f64058cb9dd16f1135bcf06131993c2c221a 100644 (file)
@@ -1,5 +1,5 @@
 /* close replacement.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
index c7abf204d21cacb8501caecee321afd55c04bc09..5e7f95a2e8ee1a217cf14a6943747ae128771eb6 100644 (file)
@@ -1,6 +1,6 @@
 /* connect.c --- wrappers for Windows connect function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -36,9 +36,9 @@ rpl_connect (int fd, struct sockaddr *sockaddr, int len)
   if (r < 0)
     {
       /* EINPROGRESS is not returned by WinSock 2.0; for backwards
-        compatibility, connect(2) uses EWOULDBLOCK.  */
+         compatibility, connect(2) uses EWOULDBLOCK.  */
       if (WSAGetLastError () == WSAEWOULDBLOCK)
-       WSASetLastError (WSAEINPROGRESS);
+        WSASetLastError (WSAEINPROGRESS);
 
       set_winsock_errno ();
     }
index 70c16b6903e28fd18d385c9bf8be255339742e79..140e5d134685a9525c0e87f41106b25f166c1ca6 100644 (file)
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
index af2287b2713eaf792093e27adf7d7beeac99ac30..c79e8d42cb30f51c5284529dc2713065e9736a3c 100644 (file)
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009-2010 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
@@ -70,8 +70,8 @@ unsigned int error_message_count;
 extern void __error (int status, int errnum, const char *message, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 extern void __error_at_line (int status, int errnum, const char *file_name,
-                            unsigned int line_number, const char *message,
-                            ...)
+                             unsigned int line_number, const char *message,
+                             ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));;
 # define error __error
 # define error_at_line __error_at_line
@@ -86,6 +86,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 #else /* not _LIBC */
 
 # include <fcntl.h>
+# include <unistd.h>
 
 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
 #  ifndef HAVE_DECL_STRERROR_R
@@ -100,8 +101,33 @@ extern char *program_name;
 
 # if HAVE_STRERROR_R || defined strerror_r
 #  define __strerror_r strerror_r
-# endif        /* HAVE_STRERROR_R || defined strerror_r */
-#endif /* not _LIBC */
+# endif /* HAVE_STRERROR_R || defined strerror_r */
+#endif  /* not _LIBC */
+
+static inline void
+flush_stdout (void)
+{
+#if !_LIBC && defined F_GETFL
+  int stdout_fd;
+
+# if GNULIB_FREOPEN_SAFER
+  /* Use of gnulib's freopen-safer module normally ensures that
+       fileno (stdout) == 1
+     whenever stdout is open.  */
+  stdout_fd = STDOUT_FILENO;
+# else
+  /* POSIX states that fileno (stdout) after fclose is unspecified.  But in
+     practice it is not a problem, because stdout is statically allocated and
+     the fd of a FILE stream is stored as a field in its allocated memory.  */
+  stdout_fd = fileno (stdout);
+# endif
+  /* POSIX states that fflush (stdout) after fclose is unspecified; it
+     is safe in glibc, but not on all other platforms.  fflush (NULL)
+     is always defined, but too draconian.  */
+  if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL))
+#endif
+    fflush (stdout);
+}
 
 static void
 print_errno_message (int errnum)
@@ -149,58 +175,58 @@ error_tail (int status, int errnum, const char *message, va_list args)
       bool use_malloc = false;
 
       while (1)
-       {
-         if (__libc_use_alloca (len * sizeof (wchar_t)))
-           wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
-         else
-           {
-             if (!use_malloc)
-               wmessage = NULL;
-
-             wchar_t *p = (wchar_t *) realloc (wmessage,
-                                               len * sizeof (wchar_t));
-             if (p == NULL)
-               {
-                 free (wmessage);
-                 fputws_unlocked (L"out of memory\n", stderr);
-                 return;
-               }
-             wmessage = p;
-             use_malloc = true;
-           }
-
-         memset (&st, '\0', sizeof (st));
-         tmp = message;
-
-         res = mbsrtowcs (wmessage, &tmp, len, &st);
-         if (res != len)
-           break;
-
-         if (__builtin_expect (len >= SIZE_MAX / 2, 0))
-           {
-             /* This really should not happen if everything is fine.  */
-             res = (size_t) -1;
-             break;
-           }
-
-         len *= 2;
-       }
+        {
+          if (__libc_use_alloca (len * sizeof (wchar_t)))
+            wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
+          else
+            {
+              if (!use_malloc)
+                wmessage = NULL;
+
+              wchar_t *p = (wchar_t *) realloc (wmessage,
+                                                len * sizeof (wchar_t));
+              if (p == NULL)
+                {
+                  free (wmessage);
+                  fputws_unlocked (L"out of memory\n", stderr);
+                  return;
+                }
+              wmessage = p;
+              use_malloc = true;
+            }
+
+          memset (&st, '\0', sizeof (st));
+          tmp = message;
+
+          res = mbsrtowcs (wmessage, &tmp, len, &st);
+          if (res != len)
+            break;
+
+          if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+            {
+              /* This really should not happen if everything is fine.  */
+              res = (size_t) -1;
+              break;
+            }
+
+          len *= 2;
+        }
 
       if (res == (size_t) -1)
-       {
-         /* The string cannot be converted.  */
-         if (use_malloc)
-           {
-             free (wmessage);
-             use_malloc = false;
-           }
-         wmessage = (wchar_t *) L"???";
-       }
+        {
+          /* The string cannot be converted.  */
+          if (use_malloc)
+            {
+              free (wmessage);
+              use_malloc = false;
+            }
+          wmessage = (wchar_t *) L"???";
+        }
 
       __vfwprintf (stderr, wmessage, args);
 
       if (use_malloc)
-       free (wmessage);
+        free (wmessage);
     }
   else
 #endif
@@ -235,16 +261,10 @@ error (int status, int errnum, const char *message, ...)
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
   __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+                   0);
 #endif
 
-#if !_LIBC && defined F_GETFL
-  /* POSIX states that fflush (stdout) after fclose is unspecified; it
-     is safe in glibc, but not on all other platforms.  fflush (NULL)
-     is always defined, but too draconian.  */
-  if (0 <= fcntl (1, F_GETFL))
-#endif
-  fflush (stdout);
+  flush_stdout ();
 #ifdef _LIBC
   _IO_flockfile (stderr);
 #endif
@@ -276,7 +296,7 @@ int error_one_per_line;
 
 void
 error_at_line (int status, int errnum, const char *file_name,
-              unsigned int line_number, const char *message, ...)
+               unsigned int line_number, const char *message, ...)
 {
   va_list args;
 
@@ -286,10 +306,10 @@ error_at_line (int status, int errnum, const char *file_name,
       static unsigned int old_line_number;
 
       if (old_line_number == line_number
-         && (file_name == old_file_name
-             || strcmp (old_file_name, file_name) == 0))
-       /* Simply return and print nothing.  */
-       return;
+          && (file_name == old_file_name
+              || strcmp (old_file_name, file_name) == 0))
+        /* Simply return and print nothing.  */
+        return;
 
       old_file_name = file_name;
       old_line_number = line_number;
@@ -300,16 +320,10 @@ error_at_line (int status, int errnum, const char *file_name,
      cancellation.  Therefore disable cancellation for now.  */
   int state = PTHREAD_CANCEL_ENABLE;
   __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
-                  0);
+                   0);
 #endif
 
-#if !_LIBC && defined F_GETFL
-  /* POSIX states that fflush (stdout) after fclose is unspecified; it
-     is safe in glibc, but not on all other platforms.  fflush (NULL)
-     is always defined, but too draconian.  */
-  if (0 <= fcntl (1, F_GETFL))
-#endif
-  fflush (stdout);
+  flush_stdout ();
 #ifdef _LIBC
   _IO_flockfile (stderr);
 #endif
@@ -326,10 +340,10 @@ error_at_line (int status, int errnum, const char *file_name,
 
 #if _LIBC
   __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
-             file_name, line_number);
+              file_name, line_number);
 #else
   fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
-          file_name, line_number);
+           file_name, line_number);
 #endif
 
   va_start (args, message);
index 6d49681146d5067a4a9664342047f70b42e20d71..9deef02d2f3d5f048fce0357aedf224f8afefa6c 100644 (file)
@@ -1,5 +1,6 @@
 /* Declaration for error-reporting function
-   Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 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
 #define _ERROR_H 1
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
-#ifdef __cplusplus
+#ifdef __cplusplus
 extern "C" {
 #endif
 
@@ -43,7 +43,7 @@ extern void error (int __status, int __errnum, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 
 extern void error_at_line (int __status, int __errnum, const char *__fname,
-                          unsigned int __lineno, const char *__format, ...)
+                           unsigned int __lineno, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));
 
 /* If NULL, error will flush stdout, then print on stderr the program
@@ -58,7 +58,7 @@ extern unsigned int error_message_count;
    variable controls whether this mode is selected or not.  */
 extern int error_one_per_line;
 
-#ifdef __cplusplus
+#ifdef __cplusplus
 }
 #endif
 
index a0074b77d7b3b73df66d6e0d3a832604f987a671..9f4388912aa093acca36473478594668159bd381 100644 (file)
@@ -1,5 +1,5 @@
 /* fclose replacement.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 240fe3658d42fd34f567a6bdee25eb936d439fad..b55e5e6def6905c72b4bf04f01bc2a15a51a9bd5 100644 (file)
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2007.
 
    This program is free software; you can redistribute it and/or modify
index 9ba2bce4b5bdb912ae3b6087a30cad1504ce3421..caf822f1d0a98a043977c2e1283acb57c2aeffeb 100644 (file)
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index a7ac9fc4dc0f5397a0477549762e90726e9ffa4c..1a41b16f51bfe8ce810646f41f49dfb58cb00ded 100644 (file)
@@ -1,5 +1,5 @@
 /* An fseeko() function that, together with fflush(), is POSIX compliant.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -50,10 +50,10 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if ((fp->_flags & __SL64) == 0)
     {
       /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
-        mode; but has an fseeko that requires 64-bit mode.  */
+         mode; but has an fseeko that requires 64-bit mode.  */
       FILE *tmp = fopen ("/dev/null", "r");
       if (!tmp)
-       return -1;
+        return -1;
       fp->_flags |= __SL64;
       fp->_seek64 = tmp->_seek64;
       fclose (tmp);
@@ -62,8 +62,8 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (fp_->_p == fp_->_bf._base
       && fp_->_r == 0
       && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
-                    ? fp_->_bf._size
-                    : 0)
+                     ? fp_->_bf._size
+                     : 0)
       && fp_ub._base == NULL)
 #elif defined __EMX__               /* emx+gcc */
   if (fp->_ptr == fp->_buffer
@@ -77,7 +77,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (((fp->__modeflags & __FLAG_WRITING) == 0
        || fp->__bufpos == fp->__bufstart)
       && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
-         || fp->__bufpos == fp->__bufread))
+          || fp->__bufpos == fp->__bufread))
 #elif defined __QNX__               /* QNX */
   if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
@@ -92,25 +92,42 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
 #endif
     {
       /* We get here when an fflush() call immediately preceded this one.  We
-        know there are no buffers.
-        POSIX requires us to modify the file descriptor's position.
-        But we cannot position beyond end of file here.  */
+         know there are no buffers.
+         POSIX requires us to modify the file descriptor's position.
+         But we cannot position beyond end of file here.  */
       off_t pos =
-       lseek (fileno (fp),
-              whence == SEEK_END && offset > 0 ? 0 : offset,
-              whence);
+        lseek (fileno (fp),
+               whence == SEEK_END && offset > 0 ? 0 : offset,
+               whence);
       if (pos == -1)
-       {
+        {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
-         fp_->_flags &= ~__SOFF;
+          fp_->_flags &= ~__SOFF;
 #endif
-         return -1;
-       }
+          return -1;
+        }
 
 #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __CYGWIN__
+      /* fp_->_offset is typed as an integer.  */
       fp_->_offset = pos;
+# else
+      /* fp_->_offset is an fpos_t.  */
+      {
+        /* Use a union, since on NetBSD, the compilation flags
+           determine whether fpos_t is typedef'd to off_t or a struct
+           containing a single off_t member.  */
+        union
+          {
+            fpos_t f;
+            off_t o;
+          } u;
+        u.o = pos;
+        fp_->_offset = u.f;
+      }
+# endif
       fp_->_flags |= __SOFF;
       fp_->_flags &= ~__SEOF;
 #elif defined __EMX__               /* emx+gcc */
@@ -122,9 +139,9 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
       fp->__eof = 0;
 #endif
       /* If we were not requested to position beyond end of file, we're
-        done.  */
+         done.  */
       if (!(whence == SEEK_END && offset > 0))
-       return 0;
+        return 0;
     }
   return fseeko (fp, offset, whence);
 }
index afbcdbb4f7a78965d2114828ded3384201d08570..c05b5c47ee392272fa7ca64b9b001503ee219cb6 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 Free
+   Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
 
index f09cf9ee641a4aef4c86bede901805d43229fac3..2e610a2ed00d6d75ec6ef67c143acc9b1268c052 100644 (file)
@@ -1,6 +1,5 @@
 /* Get address information (partial implementation).
-   Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <simon@josefsson.org>.
 
    This program is free software; you can redistribute it and/or modify
 
 #include <config.h>
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the sa == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
 #include <netdb.h>
 
 #if HAVE_NETINET_IN_H
 
 #ifdef WIN32_NATIVE
 typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
-                                       const struct addrinfo*,
-                                       struct addrinfo**);
+                                        const struct addrinfo*,
+                                        struct addrinfo**);
 typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
 typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
-                                       socklen_t, char*, DWORD,
-                                       char*, DWORD, int);
+                                        socklen_t, char*, DWORD,
+                                        char*, DWORD, int);
 
 static getaddrinfo_func getaddrinfo_ptr = NULL;
 static freeaddrinfo_func freeaddrinfo_ptr = NULL;
@@ -123,9 +126,9 @@ validate_family (int family)
    socket addresses. */
 int
 getaddrinfo (const char *restrict nodename,
-            const char *restrict servname,
-            const struct addrinfo *restrict hints,
-            struct addrinfo **restrict res)
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
 {
   struct addrinfo *tmp;
   int port = 0;
@@ -165,7 +168,7 @@ getaddrinfo (const char *restrict nodename,
   if (!nodename)
     {
       if (!(hints->ai_flags & AI_PASSIVE))
-       return EAI_NONAME;
+        return EAI_NONAME;
 
 #ifdef HAVE_IPV6
       nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
@@ -178,24 +181,24 @@ getaddrinfo (const char *restrict nodename,
     {
       struct servent *se = NULL;
       const char *proto =
-       (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
 
       if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
-       /* FIXME: Use getservbyname_r if available. */
-       se = getservbyname (servname, proto);
+        /* FIXME: Use getservbyname_r if available. */
+        se = getservbyname (servname, proto);
 
       if (!se)
-       {
-         char *c;
-         if (!(*servname >= '0' && *servname <= '9'))
-           return EAI_NONAME;
-         port = strtoul (servname, &c, 10);
-         if (*c || port > 0xffff)
-           return EAI_NONAME;
-         port = htons (port);
-       }
+        {
+          char *c;
+          if (!(*servname >= '0' && *servname <= '9'))
+            return EAI_NONAME;
+          port = strtoul (servname, &c, 10);
+          if (*c || port > 0xffff)
+            return EAI_NONAME;
+          port = htons (port);
+        }
       else
-       port = se->s_port;
+        port = se->s_port;
     }
 
   /* FIXME: Use gethostbyname_r if available. */
@@ -230,23 +233,23 @@ getaddrinfo (const char *restrict nodename,
 #if HAVE_IPV6
     case PF_INET6:
       {
-       struct v6_pair *p = storage;
-       struct sockaddr_in6 *sinp = &p->sockaddr_in6;
-       tmp = &p->addrinfo;
+        struct v6_pair *p = storage;
+        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
+        tmp = &p->addrinfo;
 
-       if (port)
-         sinp->sin6_port = port;
+        if (port)
+          sinp->sin6_port = port;
 
-       if (he->h_length != sizeof (sinp->sin6_addr))
-         {
-           free (storage);
-           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-         }
+        if (he->h_length != sizeof (sinp->sin6_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
 
-       memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
+        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
 
-       tmp->ai_addr = (struct sockaddr *) sinp;
-       tmp->ai_addrlen = sizeof *sinp;
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
       }
       break;
 #endif
@@ -254,23 +257,23 @@ getaddrinfo (const char *restrict nodename,
 #if HAVE_IPV4
     case PF_INET:
       {
-       struct v4_pair *p = storage;
-       struct sockaddr_in *sinp = &p->sockaddr_in;
-       tmp = &p->addrinfo;
+        struct v4_pair *p = storage;
+        struct sockaddr_in *sinp = &p->sockaddr_in;
+        tmp = &p->addrinfo;
 
-       if (port)
-         sinp->sin_port = port;
+        if (port)
+          sinp->sin_port = port;
 
-       if (he->h_length != sizeof (sinp->sin_addr))
-         {
-           free (storage);
-           return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
-         }
+        if (he->h_length != sizeof (sinp->sin_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
 
-       memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
+        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
 
-       tmp->ai_addr = (struct sockaddr *) sinp;
-       tmp->ai_addrlen = sizeof *sinp;
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
       }
       break;
 #endif
@@ -284,16 +287,16 @@ getaddrinfo (const char *restrict nodename,
     {
       const char *cn;
       if (he->h_name)
-       cn = he->h_name;
+        cn = he->h_name;
       else
-       cn = nodename;
+        cn = nodename;
 
       tmp->ai_canonname = strdup (cn);
       if (!tmp->ai_canonname)
-       {
-         free (storage);
-         return EAI_MEMORY;
-       }
+        {
+          free (storage);
+          return EAI_MEMORY;
+        }
     }
 
   tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
@@ -349,14 +352,14 @@ freeaddrinfo (struct addrinfo *ai)
 }
 
 int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-               char *restrict node, socklen_t nodelen,
-               char *restrict service, socklen_t servicelen,
-               int flags)
+                char *restrict node, socklen_t nodelen,
+                char *restrict service, socklen_t servicelen,
+                int flags)
 {
 #ifdef WIN32_NATIVE
   if (use_win32_p ())
     return getnameinfo_ptr (sa, salen, node, nodelen,
-                           service, servicelen, flags);
+                            service, servicelen, flags);
 #endif
 
   /* FIXME: Support other flags. */
@@ -373,13 +376,13 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
 #if HAVE_IPV4
     case AF_INET:
       if (salen < sizeof (struct sockaddr_in))
-       return EAI_FAMILY;
+        return EAI_FAMILY;
       break;
 #endif
 #if HAVE_IPV6
     case AF_INET6:
       if (salen < sizeof (struct sockaddr_in6))
-       return EAI_FAMILY;
+        return EAI_FAMILY;
       break;
 #endif
     default:
@@ -389,28 +392,28 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
   if (node && nodelen > 0 && flags & NI_NUMERICHOST)
     {
       switch (sa->sa_family)
-       {
+        {
 #if HAVE_IPV4
-       case AF_INET:
-         if (!inet_ntop (AF_INET,
-                         &(((const struct sockaddr_in *) sa)->sin_addr),
-                         node, nodelen))
-           return EAI_SYSTEM;
-         break;
+        case AF_INET:
+          if (!inet_ntop (AF_INET,
+                          &(((const struct sockaddr_in *) sa)->sin_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
 #endif
 
 #if HAVE_IPV6
-       case AF_INET6:
-         if (!inet_ntop (AF_INET6,
-                         &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-                         node, nodelen))
-           return EAI_SYSTEM;
-         break;
+        case AF_INET6:
+          if (!inet_ntop (AF_INET6,
+                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
 #endif
 
-       default:
-         return EAI_FAMILY;
-       }
+        default:
+          return EAI_FAMILY;
+        }
     }
 
   if (service && servicelen > 0 && flags & NI_NUMERICSERV)
@@ -422,13 +425,13 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
 #if HAVE_IPV6
       case AF_INET6:
 #endif
-       {
-         unsigned short int port
-           = ntohs (((const struct sockaddr_in *) sa)->sin_port);
-         if (servicelen <= snprintf (service, servicelen, "%u", port))
-           return EAI_OVERFLOW;
-       }
-       break;
+        {
+          unsigned short int port
+            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+          if (servicelen <= snprintf (service, servicelen, "%u", port))
+            return EAI_OVERFLOW;
+        }
+        break;
       }
 
   return 0;
index b74e5b5350055d63cbd667bdb3c7625ce88fca44..66d07b9ae00a94d76709ff7779c326a0c470f757 100644 (file)
@@ -1,6 +1,6 @@
 /* getdelim.c --- Implementation of replacement getdelim function.
-   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007,
-   2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008,
+   2009, 2010 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
 
 #include <config.h>
 
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below.  */
+#define _GL_ARG_NONNULL(params)
+
 #include <stdio.h>
 
 #include <limits.h>
 
 #if USE_UNLOCKED_IO
 # include "unlocked-io.h"
-# define getc_maybe_unlocked(fp)       getc(fp)
+# define getc_maybe_unlocked(fp)        getc(fp)
 #elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
 # undef flockfile
 # undef funlockfile
 # define flockfile(x) ((void) 0)
 # define funlockfile(x) ((void) 0)
-# define getc_maybe_unlocked(fp)       getc(fp)
+# define getc_maybe_unlocked(fp)        getc(fp)
 #else
-# define getc_maybe_unlocked(fp)       getc_unlocked(fp)
+# define getc_maybe_unlocked(fp)        getc_unlocked(fp)
 #endif
 
 /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
@@ -71,10 +75,10 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
       *n = 120;
       new_lineptr = (char *) realloc (*lineptr, *n);
       if (new_lineptr == NULL)
-       {
-         result = -1;
-         goto unlock_return;
-       }
+        {
+          result = -1;
+          goto unlock_return;
+        }
       *lineptr = new_lineptr;
     }
 
@@ -84,44 +88,44 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
 
       i = getc_maybe_unlocked (fp);
       if (i == EOF)
-       {
-         result = -1;
-         break;
-       }
+        {
+          result = -1;
+          break;
+        }
 
       /* Make enough space for len+1 (for final NUL) bytes.  */
       if (cur_len + 1 >= *n)
-       {
-         size_t needed_max =
-           SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
-         size_t needed = 2 * *n + 1;   /* Be generous. */
-         char *new_lineptr;
-
-         if (needed_max < needed)
-           needed = needed_max;
-         if (cur_len + 1 >= needed)
-           {
-             result = -1;
-             errno = EOVERFLOW;
-             goto unlock_return;
-           }
-
-         new_lineptr = (char *) realloc (*lineptr, needed);
-         if (new_lineptr == NULL)
-           {
-             result = -1;
-             goto unlock_return;
-           }
-
-         *lineptr = new_lineptr;
-         *n = needed;
-       }
+        {
+          size_t needed_max =
+            SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
+          size_t needed = 2 * *n + 1;   /* Be generous. */
+          char *new_lineptr;
+
+          if (needed_max < needed)
+            needed = needed_max;
+          if (cur_len + 1 >= needed)
+            {
+              result = -1;
+              errno = EOVERFLOW;
+              goto unlock_return;
+            }
+
+          new_lineptr = (char *) realloc (*lineptr, needed);
+          if (new_lineptr == NULL)
+            {
+              result = -1;
+              goto unlock_return;
+            }
+
+          *lineptr = new_lineptr;
+          *n = needed;
+        }
 
       (*lineptr)[cur_len] = i;
       cur_len++;
 
       if (i == delimiter)
-       break;
+        break;
     }
   (*lineptr)[cur_len] = '\0';
   result = cur_len ? cur_len : result;
index a653648f055c4b94cff19dfe25bd13ce86939163..30c076e870161701cb3e242ae04396172be175ba 100644 (file)
@@ -1,5 +1,5 @@
 /* getline.c --- Implementation of replacement getline function.
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2009, 2010 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
index 208e21bbdaf0205a84dfcd8a957a0f5a4984c2f2..e9b4eb9b1bd48822f7311bfe4d95716f892c9347 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006, 2007 Free Software
-   Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
@@ -34,7 +33,7 @@
 #  include <stdio_ext.h>
 # endif
 #else
-# define __fsetlocking(stream, type)   /* empty */
+# define __fsetlocking(stream, type)    /* empty */
 #endif
 
 #if HAVE_TERMIOS_H
@@ -145,17 +144,17 @@ getpass (const char *prompt)
   if (buf != NULL)
     {
       if (nread < 0)
-       buf[0] = '\0';
+        buf[0] = '\0';
       else if (buf[nread - 1] == '\n')
-       {
-         /* Remove the newline.  */
-         buf[nread - 1] = '\0';
-         if (tty_changed)
-           {
-             /* Write the newline that was not echoed.  */
-             putc_unlocked ('\n', out);
-           }
-       }
+        {
+          /* Remove the newline.  */
+          buf[nread - 1] = '\0';
+          if (tty_changed)
+            {
+              /* Write the newline that was not echoed.  */
+              putc_unlocked ('\n', out);
+            }
+        }
     }
 
   /* Restore the original setting.  */
@@ -204,20 +203,20 @@ getpass (const char *prompt)
     {
       c = _getch ();
       if (c == '\r')
-       {
-         getpassbuf[i] = '\0';
-         break;
-       }
+        {
+          getpassbuf[i] = '\0';
+          break;
+        }
       else if (i < PASS_MAX)
-       {
-         getpassbuf[i++] = c;
-       }
+        {
+          getpassbuf[i++] = c;
+        }
 
       if (i >= PASS_MAX)
-       {
-         getpassbuf[i] = '\0';
-         break;
-       }
+        {
+          getpassbuf[i] = '\0';
+          break;
+        }
     }
 
   if (prompt)
index 616a31045d8915955b8f51a29ff250043f0f156f..6a54261afe7b9c0f26548df5973643f7fb39be08 100644 (file)
@@ -1,5 +1,5 @@
 /* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2009-2010 Free Software Foundation, Inc.
    Contributed by Simon Josefsson <jas@extundo.com>, 2004.
 
    This program is free software; you can redistribute it and/or modify
index 41c0ae1b9ecc25fcb4b25b4176765fe2df5ceee4..f5e7a8bbd89a94d832581ca5e7bbb206ac9fbe17 100644 (file)
@@ -1,5 +1,6 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 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
@@ -140,8 +141,8 @@ inline
 #endif
 static const char *
 pgettext_aux (const char *domain,
-             const char *msg_ctxt_id, const char *msgid,
-             int category)
+              const char *msg_ctxt_id, const char *msgid,
+              int category)
 {
   const char *translation = dcgettext (domain, msg_ctxt_id, category);
   if (translation == msg_ctxt_id)
@@ -159,9 +160,9 @@ inline
 #endif
 static const char *
 npgettext_aux (const char *domain,
-              const char *msg_ctxt_id, const char *msgid,
-              const char *msgid_plural, unsigned long int n,
-              int category)
+               const char *msg_ctxt_id, const char *msgid,
+               const char *msgid_plural, unsigned long int n,
+               int category)
 {
   const char *translation =
     dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
index c32c273054c08c18fabb0c6062438423b5086650..baaa23f85655a6eab253a96fc05db261ce7a05ea 100644 (file)
@@ -1,6 +1,6 @@
 /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
 
-   Copyright (C) 2005, 2006, 2008, 2009  Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2010 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
@@ -59,15 +59,15 @@ static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t si
 
 /* char *
  * inet_ntop(af, src, dst, size)
- *     convert a network format address to presentation format.
+ *      convert a network format address to presentation format.
  * return:
- *     pointer to presentation format address (`dst'), or NULL (see errno).
+ *      pointer to presentation format address (`dst'), or NULL (see errno).
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 const char *
 inet_ntop (int af, const void *restrict src,
-          char *restrict dst, socklen_t cnt)
+           char *restrict dst, socklen_t cnt)
 {
   switch (af)
     {
@@ -90,14 +90,14 @@ inet_ntop (int af, const void *restrict src,
 
 /* const char *
  * inet_ntop4(src, dst, size)
- *     format an IPv4 address
+ *      format an IPv4 address
  * return:
- *     `dst' (as a const)
+ *      `dst' (as a const)
  * notes:
- *     (1) uses no statics
- *     (2) takes a u_char* not an in_addr as input
+ *      (1) uses no statics
+ *      (2) takes a u_char* not an in_addr as input
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static const char *
 inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
@@ -122,9 +122,9 @@ inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
 
 /* const char *
  * inet_ntop6(src, dst, size)
- *     convert IPv6 binary address into presentation (printable) format
+ *      convert IPv6 binary address into presentation (printable) format
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static const char *
 inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
@@ -157,26 +157,26 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
   for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
     {
       if (words[i] == 0)
-       {
-         if (cur.base == -1)
-           cur.base = i, cur.len = 1;
-         else
-           cur.len++;
-       }
+        {
+          if (cur.base == -1)
+            cur.base = i, cur.len = 1;
+          else
+            cur.len++;
+        }
       else
-       {
-         if (cur.base != -1)
-           {
-             if (best.base == -1 || cur.len > best.len)
-               best = cur;
-             cur.base = -1;
-           }
-       }
+        {
+          if (cur.base != -1)
+            {
+              if (best.base == -1 || cur.len > best.len)
+                best = cur;
+              cur.base = -1;
+            }
+        }
     }
   if (cur.base != -1)
     {
       if (best.base == -1 || cur.len > best.len)
-       best = cur;
+        best = cur;
     }
   if (best.base != -1 && best.len < 2)
     best.base = -1;
@@ -189,28 +189,28 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
     {
       /* Are we inside the best run of 0x00's? */
       if (best.base != -1 && i >= best.base && i < (best.base + best.len))
-       {
-         if (i == best.base)
-           *tp++ = ':';
-         continue;
-       }
+        {
+          if (i == best.base)
+            *tp++ = ':';
+          continue;
+        }
       /* Are we following an initial run of 0x00s or any real hex? */
       if (i != 0)
-       *tp++ = ':';
+        *tp++ = ':';
       /* Is this address an encapsulated IPv4? */
       if (i == 6 && best.base == 0 &&
-         (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
-       {
-         if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
-           return (NULL);
-         tp += strlen (tp);
-         break;
-       }
+          (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
+        {
+          if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp)))
+            return (NULL);
+          tp += strlen (tp);
+          break;
+        }
       {
-       int len = sprintf (tp, "%x", words[i]);
-       if (len < 0)
-         return NULL;
-       tp += len;
+        int len = sprintf (tp, "%x", words[i]);
+        if (len < 0)
+          return NULL;
+        tp += len;
       }
     }
   /* Was it a trailing run of 0x00's? */
index a9c9bafdef18fc307bc4c6fe71a3ab49c8427cd3..d8a2dee0ff485f137d8f68ede866a157b2f9c57c 100644 (file)
@@ -1,6 +1,6 @@
 /* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
 
-   Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2008, 2009, 2010 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
@@ -57,14 +57,14 @@ static int inet_pton6 (const char *src, unsigned char *dst);
 
 /* int
  * inet_pton(af, src, dst)
- *     convert from presentation format (which usually means ASCII printable)
- *     to network format (which is usually some kind of binary format).
+ *      convert from presentation format (which usually means ASCII printable)
+ *      to network format (which is usually some kind of binary format).
  * return:
- *     1 if the address was valid for the specified address family
- *     0 if the address wasn't valid (`dst' is untouched in this case)
- *     -1 if some other error occurred (`dst' is untouched in this case, too)
+ *      1 if the address was valid for the specified address family
+ *      0 if the address wasn't valid (`dst' is untouched in this case)
+ *      -1 if some other error occurred (`dst' is untouched in this case, too)
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 int
 inet_pton (int af, const char *restrict src, void *restrict dst)
@@ -88,14 +88,14 @@ inet_pton (int af, const char *restrict src, void *restrict dst)
 
 /* int
  * inet_pton4(src, dst)
- *     like inet_aton() but without all the hexadecimal, octal (with the
- *     exception of 0) and shorthand.
+ *      like inet_aton() but without all the hexadecimal, octal (with the
+ *      exception of 0) and shorthand.
  * return:
- *     1 if `src' is a valid dotted quad, else 0.
+ *      1 if `src' is a valid dotted quad, else 0.
  * notice:
- *     does not touch `dst' unless it's returning 1.
+ *      does not touch `dst' unless it's returning 1.
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static int
 inet_pton4 (const char *restrict src, unsigned char *restrict dst)
@@ -110,30 +110,30 @@ inet_pton4 (const char *restrict src, unsigned char *restrict dst)
     {
 
       if (ch >= '0' && ch <= '9')
-       {
-         unsigned new = *tp * 10 + (ch - '0');
-
-         if (saw_digit && *tp == 0)
-           return (0);
-         if (new > 255)
-           return (0);
-         *tp = new;
-         if (!saw_digit)
-           {
-             if (++octets > 4)
-               return (0);
-             saw_digit = 1;
-           }
-       }
+        {
+          unsigned new = *tp * 10 + (ch - '0');
+
+          if (saw_digit && *tp == 0)
+            return (0);
+          if (new > 255)
+            return (0);
+          *tp = new;
+          if (!saw_digit)
+            {
+              if (++octets > 4)
+                return (0);
+              saw_digit = 1;
+            }
+        }
       else if (ch == '.' && saw_digit)
-       {
-         if (octets == 4)
-           return (0);
-         *++tp = 0;
-         saw_digit = 0;
-       }
+        {
+          if (octets == 4)
+            return (0);
+          *++tp = 0;
+          saw_digit = 0;
+        }
       else
-       return (0);
+        return (0);
     }
   if (octets < 4)
     return (0);
@@ -145,16 +145,16 @@ inet_pton4 (const char *restrict src, unsigned char *restrict dst)
 
 /* int
  * inet_pton6(src, dst)
- *     convert presentation level address to network order binary form.
+ *      convert presentation level address to network order binary form.
  * return:
- *     1 if `src' is a valid [RFC1884 2.2] address, else 0.
+ *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
  * notice:
- *     (1) does not touch `dst' unless it's returning 1.
- *     (2) :: in a full address is silently ignored.
+ *      (1) does not touch `dst' unless it's returning 1.
+ *      (2) :: in a full address is silently ignored.
  * credit:
- *     inspired by Mark Andrews.
+ *      inspired by Mark Andrews.
  * author:
- *     Paul Vixie, 1996.
+ *      Paul Vixie, 1996.
  */
 static int
 inet_pton6 (const char *restrict src, unsigned char *restrict dst)
@@ -181,49 +181,49 @@ inet_pton6 (const char *restrict src, unsigned char *restrict dst)
 
       pch = strchr (xdigits, ch);
       if (pch != NULL)
-       {
-         val <<= 4;
-         val |= (pch - xdigits);
-         if (val > 0xffff)
-           return (0);
-         saw_xdigit = 1;
-         continue;
-       }
+        {
+          val <<= 4;
+          val |= (pch - xdigits);
+          if (val > 0xffff)
+            return (0);
+          saw_xdigit = 1;
+          continue;
+        }
       if (ch == ':')
-       {
-         curtok = src;
-         if (!saw_xdigit)
-           {
-             if (colonp)
-               return (0);
-             colonp = tp;
-             continue;
-           }
-         else if (*src == '\0')
-           {
-             return (0);
-           }
-         if (tp + NS_INT16SZ > endp)
-           return (0);
-         *tp++ = (u_char) (val >> 8) & 0xff;
-         *tp++ = (u_char) val & 0xff;
-         saw_xdigit = 0;
-         val = 0;
-         continue;
-       }
+        {
+          curtok = src;
+          if (!saw_xdigit)
+            {
+              if (colonp)
+                return (0);
+              colonp = tp;
+              continue;
+            }
+          else if (*src == '\0')
+            {
+              return (0);
+            }
+          if (tp + NS_INT16SZ > endp)
+            return (0);
+          *tp++ = (u_char) (val >> 8) & 0xff;
+          *tp++ = (u_char) val & 0xff;
+          saw_xdigit = 0;
+          val = 0;
+          continue;
+        }
       if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
-         inet_pton4 (curtok, tp) > 0)
-       {
-         tp += NS_INADDRSZ;
-         saw_xdigit = 0;
-         break;                /* '\0' was seen by inet_pton4(). */
-       }
+          inet_pton4 (curtok, tp) > 0)
+        {
+          tp += NS_INADDRSZ;
+          saw_xdigit = 0;
+          break;                /* '\0' was seen by inet_pton4(). */
+        }
       return (0);
     }
   if (saw_xdigit)
     {
       if (tp + NS_INT16SZ > endp)
-       return (0);
+        return (0);
       *tp++ = (u_char) (val >> 8) & 0xff;
       *tp++ = (u_char) val & 0xff;
     }
@@ -237,12 +237,12 @@ inet_pton6 (const char *restrict src, unsigned char *restrict dst)
       int i;
 
       if (tp == endp)
-       return (0);
+        return (0);
       for (i = 1; i <= n; i++)
-       {
-         endp[-i] = colonp[n - i];
-         colonp[n - i] = 0;
-       }
+        {
+          endp[-i] = colonp[n - i];
+          colonp[n - i] = 0;
+        }
       tp = endp;
     }
   if (tp != endp)
index 325c3979972abcf2403b36260d765a4bcbae5df1..46f4d47d709c7018fe5fe2e203e990416bce0f3a 100644 (file)
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    your host.  */
 # define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) 0 \
-       : TYPE_SIGNED_MAGNITUDE (t) \
-       ? ~ (t) 0 \
-       : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+        ? (t) 0 \
+        : TYPE_SIGNED_MAGNITUDE (t) \
+        ? ~ (t) 0 \
+        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
 # define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) -1 \
-       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+        ? (t) -1 \
+        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
 /* Return zero if T can be determined to be an unsigned type.
    Otherwise, return 1.
index 49e0a08425e681c0afd867e710d92e01f19b2947..4a77de22ea240b37736cb4454e0daf1aa805ae5a 100644 (file)
@@ -1,6 +1,6 @@
 /* listen.c --- wrappers for Windows listen function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index f2ed8bb54c135f698acfc730574d412561d72ecc..0d5376ab34fcb0dbd49bbdaa06aba35fc3333293 100644 (file)
@@ -1,5 +1,5 @@
 /* An lseek() function that detects pipes.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index d4d04d1530a27c0921a542c6978da037107b9ee0..301469b31cef0ba55efc7c41e701ae5fa715834d 100644 (file)
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2010 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.
index 4b978e137cbe7c2d9f76baa6546764f6e2f7a0a6..f3ee34380cda13d5463e465bdb2c6d691169d449 100644 (file)
@@ -1,5 +1,6 @@
 # alloca.m4 serial 9
-dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
index a6e63df01c376b124467f906268131fcc3e05573..4360dd810498833477d78429531d16b2a45e424a 100644 (file)
@@ -1,5 +1,5 @@
-# arpa_inet_h.m4 serial 5
-dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+# arpa_inet_h.m4 serial 7
+dnl Copyright (C) 2006, 2008, 2009, 2010 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.
@@ -16,20 +16,28 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
   if test $ac_cv_header_arpa_inet_h = yes; then
     HAVE_ARPA_INET_H=1
   else
-    ARPA_INET_H='arpa/inet.h'
     HAVE_ARPA_INET_H=0
   fi
   AC_SUBST([HAVE_ARPA_INET_H])
-  dnl Execute this unconditionally, because ARPA_INET_H may be set by other
-  dnl modules, after this code is executed.
+  dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([arpa/inet.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* On some systems, this header is not self-consistent.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
+#include <arpa/inet.h>
+    ]], [inet_ntop inet_pton])
 ])
 
 dnl Unconditionally enables the replacement of <arpa/inet.h>.
 AC_DEFUN([gl_REPLACE_ARPA_INET_H],
 [
-  AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-  ARPA_INET_H='arpa/inet.h'
+  dnl This is a no-op, because <arpa/inet.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
@@ -46,5 +54,4 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
   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])
-  ARPA_INET_H='';         AC_SUBST([ARPA_INET_H])
 ])
index a025e737953eb736a4fab9e41332554706cd2b95..93ccb5468aa11adfb44d2c571ae37a8822cac963 100644 (file)
@@ -1,5 +1,6 @@
 # autobuild.m4 serial 7
-dnl Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+dnl 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.
index fdcc96b67398bc85b66812ef9a6fea48944c4cc0..1ee3add9b998a2c33893357e6af73201842519a0 100644 (file)
@@ -1,5 +1,5 @@
 # close.m4 serial 5
-dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2010 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.
index 4ce1ccbd9f4b1e6a9d4c06ce4d59d3fed48646eb..d02a039363dda9dbd4eaf43d40e9cdbccb699446 100644 (file)
@@ -1,5 +1,5 @@
 # errno_h.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 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.
index 7c7746e2cc8ddbf6b94471cf666fca7fe8f1a4c9..9f1307a428e297d89b8ef96a9affe82dcf091384 100644 (file)
@@ -1,7 +1,6 @@
-#serial 11
+#serial 12
 
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -18,5 +17,6 @@ AC_DEFUN([gl_ERROR],
 AC_DEFUN([gl_PREREQ_ERROR],
 [
   AC_REQUIRE([AC_FUNC_STRERROR_R])
+  AC_REQUIRE([AC_C_INLINE])
   :
 ])
index ba6d5e190f9f2df6ae1b080fc8f2d16490b5e3b2..7d9458a8d65a0b085d93b695beaaa6685b824c18 100644 (file)
@@ -1,7 +1,7 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([[
-#        define __EXTENSIONS__ 1
-         ]AC_INCLUDES_DEFAULT])],
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
index ab2986fd11c46f413f8736b5b1d06bbc75ccca7b..85de6294231a91ec24ee68257f48c3f8543c40d0 100644 (file)
@@ -1,5 +1,5 @@
 # fclose.m4 serial 2
-dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2010 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.
index d36e3a46caef916dfd5d0c4dd26182d70850b3ae..a74a0d957f2ea89a010102dba7da48add2fccbfe 100644 (file)
@@ -1,5 +1,5 @@
 # float_h.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index a370648e9f3411b3c72700c1d2bd8ea1029b4677..5f7f97729c067cdbaec9527fefd3cabe4020e9cc 100644 (file)
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 6
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# fseeko.m4 serial 7
+dnl Copyright (C) 2007-2010 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.
@@ -17,12 +17,10 @@ AC_DEFUN([gl_FUNC_FSEEKO],
     [
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
 ]], [fseeko (stdin, 0, 0);])],
-       [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
+        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
     ])
-  if test $gl_cv_func_fseeko = no; then
-    HAVE_FSEEKO=0
-    gl_REPLACE_FSEEKO
-  elif test $gl_cv_var_stdin_large_offset = no; then
+  if test $gl_cv_func_fseeko = no \
+      || test $gl_cv_var_stdin_large_offset = no; then
     gl_REPLACE_FSEEKO
   fi
 ])
index 526dce5ba12622129588e183b859943a9f0babfb..05fd2b6c4fa3bb8e7f64b8a2c041560daeed46e7 100644 (file)
@@ -1,5 +1,5 @@
 # getaddrinfo.m4 serial 22
-dnl Copyright (C) 2004-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2010 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.
@@ -39,7 +39,7 @@ AC_DEFUN([gl_GETADDRINFO],
       [gl_cv_func_getaddrinfo=no])])
   if test $gl_cv_func_getaddrinfo = no; then
     AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32],
-                  gl_cv_w32_getaddrinfo, [
+                   gl_cv_w32_getaddrinfo, [
       gl_cv_w32_getaddrinfo=no
       am_save_LIBS="$LIBS"
       LIBS="$LIBS -lws2_32"
index 8ab38398859a25e3b3ebd1f80d4c99b6818b5e47..9e5ad5baaf36cc45f70bc1448749ee64ebd66b35 100644 (file)
@@ -1,6 +1,6 @@
 # getdelim.m4 serial 5
 
-dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 4897bc36908ef76796686859faaa89659752b786..5b8a712fbc60db058a0aef0750889b0e6908d577 100644 (file)
@@ -1,6 +1,7 @@
 # getline.m4 serial 20
 
-dnl Copyright (C) 1998-2003, 2005-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation,
+dnl Inc.
 dnl
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,9 +24,9 @@ AC_DEFUN([gl_FUNC_GETLINE],
 
   gl_getline_needs_run_time_check=no
   AC_CHECK_FUNC([getline],
-               dnl Found it in some library.  Verify that it works.
-               gl_getline_needs_run_time_check=yes,
-               am_cv_func_working_getline=no)
+                dnl Found it in some library.  Verify that it works.
+                gl_getline_needs_run_time_check=yes,
+                am_cv_func_working_getline=no)
   if test $gl_getline_needs_run_time_check = yes; then
     AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
@@ -40,7 +41,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
       int len;
       FILE *in = fopen ("./conftest.data", "r");
       if (!in)
-       return 1;
+        return 1;
       len = getline (&line, &siz, in);
       exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
     }
index 3b55ee48ec8d3c9b46ae3a6d3f841ff57d3822a3..cb80a65c528b3d5ea9ff08c13c17c82faaf645c6 100644 (file)
@@ -1,5 +1,6 @@
 # getpass.m4 serial 11
-dnl Copyright (C) 2002-2003, 2005-2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation,
+dnl 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.
index 0fec7d42b7c7dfcca7f73e679b849b351d2b8315..735123e6dc19469bf09c47dbe6b261b4cc75fe94 100644 (file)
@@ -1,6 +1,6 @@
 # serial 12
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,16 +17,16 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
     [gl_cv_func_gettimeofday_posix_signature],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <sys/time.h>
-           struct timeval c;
-         ]],
-         [[
-           int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
-           int x = f (&c, 0);
-           return !(x | c.tv_sec | c.tv_usec);
-         ]])],
-       [gl_cv_func_gettimeofday_posix_signature=yes],
-       [gl_cv_func_gettimeofday_posix_signature=no])])
+          [[#include <sys/time.h>
+            struct timeval c;
+          ]],
+          [[
+            int (*f) (struct timeval *restrict, void *restrict) = gettimeofday;
+            int x = f (&c, 0);
+            return !(x | c.tv_sec | c.tv_usec);
+          ]])],
+        [gl_cv_func_gettimeofday_posix_signature=yes],
+        [gl_cv_func_gettimeofday_posix_signature=no])])
 
   gl_FUNC_GETTIMEOFDAY_CLOBBER
 
@@ -56,21 +56,21 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
   [gl_cv_func_gettimeofday_clobber],
   [AC_RUN_IFELSE(
      [AC_LANG_PROGRAM(
-       [[#include <string.h>
-         #include <sys/time.h>
-         #include <time.h>
-         #include <stdlib.h>
-       ]],
-       [[
-         time_t t = 0;
-         struct tm *lt;
-         struct tm saved_lt;
-         struct timeval tv;
-         lt = localtime (&t);
-         saved_lt = *lt;
-         gettimeofday (&tv, NULL);
-         return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
-       ]])],
+        [[#include <string.h>
+          #include <sys/time.h>
+          #include <time.h>
+          #include <stdlib.h>
+        ]],
+        [[
+          time_t t = 0;
+          struct tm *lt;
+          struct tm saved_lt;
+          struct timeval tv;
+          lt = localtime (&t);
+          saved_lt = *lt;
+          gettimeofday (&tv, NULL);
+          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
+        ]])],
      [gl_cv_func_gettimeofday_clobber=no],
      [gl_cv_func_gettimeofday_clobber=yes],
      dnl When crosscompiling, assume it is broken.
index 628c18763043808affd2f60c48a81e17a87680b1..4be01511f89b1eba3def73d86027a2fceeb16b0f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
index c8fda2033045d38975415f240bd9a72a14a2c949..b7812a896217a250e8298125c6a087a588994340 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 11
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 12
+dnl Copyright (C) 2007-2010 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.
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -49,6 +52,14 @@ m4_ifndef([m4_foreach_w],
   [m4_define([m4_foreach_w],
     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
+# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
+# ----------------------------------------------------
+# Backport of autoconf-2.63b's macro.
+# Remove this macro when we can assume autoconf >= 2.64.
+m4_ifndef([AS_VAR_IF],
+[m4_define([AS_VAR_IF],
+[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
@@ -70,13 +81,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
index 9bfd46733d03b006a879087f0b581a8363c09a74..099a0830aede8fc75e4e76d17c5d201601bca43d 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -54,7 +54,7 @@ AC_DEFUN([gl_INIT],
   fi
   gl_SYS_SOCKET_MODULE_INDICATOR([accept])
 changequote(,)dnl
-LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
+LTALLOCA=`echo "$ALLOCA" | sed -e 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
 changequote([, ])dnl
 AC_SUBST([LTALLOCA])
   gl_FUNC_ALLOCA
@@ -113,6 +113,8 @@ AC_SUBST([LTALLOCA])
   gl_SYS_SOCKET_MODULE_INDICATOR([listen])
   gl_FUNC_LSEEK
   gl_UNISTD_MODULE_INDICATOR([lseek])
+  AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
+    [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
   gl_FUNC_MEMCHR
   gl_STRING_MODULE_INDICATOR([memchr])
   gl_MINMAX
@@ -217,7 +219,7 @@ AC_SUBST([LTALLOCA])
     if test -n "$gl_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         gl_libobjs="$gl_libobjs $i.$ac_objext"
         gl_ltlibobjs="$gl_ltlibobjs $i.lo"
       done
@@ -278,7 +280,7 @@ AC_SUBST([LTALLOCA])
     if test -n "$gltests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         gltests_libobjs="$gltests_libobjs $i.$ac_objext"
         gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
       done
@@ -347,14 +349,15 @@ AC_DEFUN([gltests_LIBSOURCES], [
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
+  build-aux/arg-nonnull.h
   build-aux/config.rpath
   build-aux/gendocs.sh
   build-aux/gnupload
-  build-aux/link-warning.h
   build-aux/pmccabe.css
   build-aux/pmccabe2html
   build-aux/useless-if-before-free
   build-aux/vc-list-files
+  build-aux/warn-on-use.h
   doc/fdl-1.3.texi
   doc/gendocs_template
   doc/gpl-3.0.texi
@@ -509,11 +512,14 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/unistd_h.m4
   m4/vasnprintf.m4
   m4/version-etc.m4
+  m4/warn-on-use.m4
   m4/warnings.m4
   m4/wchar.m4
   m4/wchar_t.m4
   m4/wint_t.m4
   m4/xsize.m4
+  tests/macros.h
+  tests/signature.h
   tests/test-alignof.c
   tests/test-alloca-opt.c
   tests/test-arpa_inet.c
@@ -550,6 +556,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-stdlib.c
   tests/test-strerror.c
   tests/test-string.c
+  tests/test-sys_ioctl.c
   tests/test-sys_select.c
   tests/test-sys_socket.c
   tests/test-sys_stat.c
index 4438d488698b2e25a911a6741d8903cb9fd35ebf..69e7733b990a0aac8afb62c14813b417bb371891 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2010 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.
index 4a96af7a53f877b60479b58a49f15079c98a99cd..1111041129181fd30693fd6d8ceb783030b88bf3 100644 (file)
@@ -1,5 +1,5 @@
 # hostent.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 5e22ded936ccb558203f81709e7b8f2417fd532f..c7e0672f60c01b02fa96a2a4427907c69f483879 100644 (file)
@@ -1,5 +1,5 @@
 # include_next.m4 serial 14
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2010 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.
@@ -109,11 +109,11 @@ EOF
 # be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
-#      #@INCLUDE_NEXT@ @NEXT_FOO_H@
+#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
 # or
-#      #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
+#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
-#      #include_next <foo.h>
+#       #include_next <foo.h>
 # even if the compiler does not support include_next.
 # The three "///" are to pacify Sun C 5.8, which otherwise would say
 # "warning: #include of /usr/include/... may be non-portable".
@@ -129,46 +129,46 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
+                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
-        m4_defn([gl_next_header]),
-        [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
-         if test AS_VAR_GET(gl_header_exists) = yes; then
-           AC_LANG_CONFTEST(
-             [AC_LANG_SOURCE(
-                [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
-              )])
-           dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
-           dnl that contain only a #include of other header files and no
-           dnl non-comment tokens of their own. This leads to a failure to
-           dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
-           dnl and others. The workaround is to force preservation of comments
-           dnl through option -C. This ensures all necessary #line directives
-           dnl are present. GCC supports option -C as well.
-           case "$host_os" in
-             aix*) gl_absname_cpp="$ac_cpp -C" ;;
-             *)    gl_absname_cpp="$ac_cpp" ;;
-           esac
-           dnl eval is necessary to expand gl_absname_cpp.
-           dnl Ultrix and Pyramid sh refuse to redirect output of eval,
-           dnl so use subshell.
-           AS_VAR_SET([gl_next_header],
-             ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
-                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
-                s#^/[^/]#//&#
-                p
-                q
-              }'`'"'])
-         else
-           AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
-         fi
-         AS_VAR_POPDEF([gl_header_exists])])
+         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+         m4_defn([gl_next_header]),
+         [AS_VAR_PUSHDEF([gl_header_exists],
+                         [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
+          if test AS_VAR_GET(gl_header_exists) = yes; then
+            AC_LANG_CONFTEST(
+              [AC_LANG_SOURCE(
+                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
+               )])
+            dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+            dnl that contain only a #include of other header files and no
+            dnl non-comment tokens of their own. This leads to a failure to
+            dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+            dnl and others. The workaround is to force preservation of comments
+            dnl through option -C. This ensures all necessary #line directives
+            dnl are present. GCC supports option -C as well.
+            case "$host_os" in
+              aix*) gl_absname_cpp="$ac_cpp -C" ;;
+              *)    gl_absname_cpp="$ac_cpp" ;;
+            esac
+            dnl eval is necessary to expand gl_absname_cpp.
+            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
+            dnl so use subshell.
+            AS_VAR_SET([gl_next_header],
+              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+               sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
+                 s#^/[^/]#//&#
+                 p
+                 q
+               }'`'"'])
+          else
+            AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+          fi
+          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
index 2a8ff205159bdc34de53e2f2d9a37e104b13f776..20e8d7c52e586316daed4db8303a89c3f2b5584c 100644 (file)
@@ -1,5 +1,5 @@
 # inet_ntop.m4 serial 11
-dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2008, 2009, 2010 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.
index e890b9b7a09404d75319464ce2f07f9a9aa64822..e0b794242f38c9dbdafa35734cf828360cba5601 100644 (file)
@@ -1,5 +1,5 @@
 # inet_pton.m4 serial 9
-dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008, 2009, 2010 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.
index 264cb57184dc384c67591764196eecb59f859f4c..975caac50670d193a88577508de756a7aa17c560 100644 (file)
@@ -1,5 +1,6 @@
 # intmax_t.m4 serial 7
-dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
index f4ca16021cf78da48bb7541c86d43ded2b4352c3..782d77ed8b1e0629d7b5ac2938db0ef6010e61d6 100644 (file)
@@ -1,5 +1,5 @@
 # inttypes_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
index e4863f2c9b76a6cc8a3979bb41244a615d194c84..ebb30528bd5abfdfcc2126175cbe1de99d902457 100644 (file)
@@ -1,5 +1,5 @@
 # lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2010 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.
@@ -59,7 +59,7 @@ if test "$GCC" = yes; then
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD],
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-       test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
index 2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0..90e1ac9170d3418035f0c6a299d16ae8aadcebee 100644 (file)
@@ -1,5 +1,5 @@
 # lib-link.m4 serial 20 (gettext-0.18)
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
index 4b7ee3358debcbd4991f12831aba90601bb4d361..1601ceaefd3c2b447b569f991813be12b0e06e2d 100644 (file)
@@ -1,5 +1,5 @@
 # lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2010 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.
index eedc8d56826218e41849ce337e63964a968b7a1a..cca3c1a90fa9d399493c7a7b9a885b4ca5270971 100644 (file)
@@ -1,5 +1,5 @@
 # longlong.m4 serial 14
-dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2007, 2009-2010 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.
@@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
     [AC_LINK_IFELSE(
        [_AC_TYPE_LONG_LONG_SNIPPET],
        [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
-       dnl If cross compiling, assume the bug isn't important, since
-       dnl nobody cross compiles for this platform as far as we know.
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-            [[@%:@include <limits.h>
-              @%:@ifndef LLONG_MAX
-              @%:@ define HALF \
-                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
-              @%:@ define LLONG_MAX (HALF - 1 + HALF)
-              @%:@endif]],
-            [[long long int n = 1;
-              int i;
-              for (i = 0; ; i++)
-                {
-                  long long int m = n << i;
-                  if (m >> i != n)
-                    return 1;
-                  if (LLONG_MAX / 2 < m)
-                    break;
-                }
-              return 0;]])],
-         [ac_cv_type_long_long_int=yes],
-         [ac_cv_type_long_long_int=no],
-         [ac_cv_type_long_long_int=yes])],
+        dnl If cross compiling, assume the bug isn't important, since
+        dnl nobody cross compiles for this platform as far as we know.
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[@%:@include <limits.h>
+               @%:@ifndef LLONG_MAX
+               @%:@ define HALF \
+                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+               @%:@ define LLONG_MAX (HALF - 1 + HALF)
+               @%:@endif]],
+             [[long long int n = 1;
+               int i;
+               for (i = 0; ; i++)
+                 {
+                   long long int m = n << i;
+                   if (m >> i != n)
+                     return 1;
+                   if (LLONG_MAX / 2 < m)
+                     break;
+                 }
+               return 0;]])],
+          [ac_cv_type_long_long_int=yes],
+          [ac_cv_type_long_long_int=no],
+          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
 [
   AC_LANG_PROGRAM(
     [[/* For now, do not test the preprocessor; as of 2007 there are too many
-        implementations with broken preprocessors.  Perhaps this can
-        be revisited in 2012.  In the meantime, code should not expect
-        #if to work with literals wider than 32 bits.  */
+         implementations with broken preprocessors.  Perhaps this can
+         be revisited in 2012.  In the meantime, code should not expect
+         #if to work with literals wider than 32 bits.  */
       /* Test literals.  */
       long long int ll = 9223372036854775807ll;
       long long int nll = -9223372036854775807LL;
       unsigned long long int ull = 18446744073709551615ULL;
       /* Test constant expressions.   */
       typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       int i = 63;]],
     [[/* Test availability of runtime routines for shift and division.  */
       long long int llmax = 9223372036854775807ll;
       unsigned long long int ullmax = 18446744073709551615ull;
       return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-             | (llmax / ll) | (llmax % ll)
-             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
-             | (ullmax / ull) | (ullmax % ull));]])
+              | (llmax / ll) | (llmax % ll)
+              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+              | (ullmax / ull) | (ullmax % ull));]])
 ])
index f336990709c2636072aacfd763a764da1d12db4a..f3084957c186bbac4bc6f4f398a15f5200add6a3 100644 (file)
@@ -1,5 +1,5 @@
 # lseek.m4 serial 4
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
@@ -19,21 +19,21 @@ int main ()
   /* Exit with success only if stdin is seekable.  */
   return lseek (0, (off_t)0, SEEK_CUR) < 0;
 }],
-        [if test -s conftest$ac_exeext \
-            && ./conftest$ac_exeext < conftest.$ac_ext \
-            && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
-           gl_cv_func_lseek_pipe=yes
-         else
-           gl_cv_func_lseek_pipe=no
-         fi],
-        [gl_cv_func_lseek_pipe=no])
+         [if test -s conftest$ac_exeext \
+             && ./conftest$ac_exeext < conftest.$ac_ext \
+             && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+            gl_cv_func_lseek_pipe=yes
+          else
+            gl_cv_func_lseek_pipe=no
+          fi],
+         [gl_cv_func_lseek_pipe=no])
      else
        AC_COMPILE_IFELSE([
 #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
 /* mingw and BeOS mistakenly return 0 when trying to seek on pipes.  */
   Choke me.
 #endif],
-        [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+         [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
      fi])
   if test $gl_cv_func_lseek_pipe = no; then
     gl_REPLACE_LSEEK
@@ -46,5 +46,5 @@ AC_DEFUN([gl_REPLACE_LSEEK],
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   REPLACE_LSEEK=1
   AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
-           [Define to 1 if lseek does not detect pipes.])
+            [Define to 1 if lseek does not detect pipes.])
 ])
index 807017166ba35812585f8e41667b8181f4f20afa..910ac92292c8c9b2840ad1e9c8cfcb8d9a867f4c 100644 (file)
@@ -1,5 +1,5 @@
 # malloc.m4 serial 9
-dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index 7f36fb4f675ab6199e55e30fe3dc4ead2aa4319b..844a9ba2a07213fe89d135faef8448a225b618ce 100644 (file)
@@ -1,5 +1,5 @@
 # manywarnings.m4 serial 1
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 1194bac2e81dbadeb030ed946d00f2304bd000c0..94596ef959a860c5dbba620109bb0341f99528e0 100644 (file)
@@ -1,5 +1,5 @@
 # memchr.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2010 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.
@@ -53,11 +53,11 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
     {
       int pagesize = getpagesize ();
       char *two_pages =
-       (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
-                      flags, fd, 0);
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
       if (two_pages != (char *)(-1)
-         && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
-       fence = two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        fence = two_pages + pagesize;
     }
 #endif
   if (fence)
index d2993fbaf78a91d458eb77e0352c981a1d0d5158..d9e9cecfd743b96583a0b2ec4026a6b2f67ba1b6 100644 (file)
@@ -1,5 +1,5 @@
 # minmax.m4 serial 3
-dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009, 2010 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.
index 14b6270d28a150c5e99d968bdd9814f1eba2c6bf..a6b7b9ac3b4954a5603f27408b2f5b3c3e90b61b 100644 (file)
@@ -1,5 +1,5 @@
 # mmap-anon.m4 serial 8
-dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2010 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.
index ec377bac86691e897398063ede37d01f02d4994a..389bd2bbaa6e73bbccc10e73f88c2ab079a24e0b 100644 (file)
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 5
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 5a12251f9a1cdb1dcd9333fb4957654867af1bbc..84afce6e5e0ecdd9efb11914772f14edae59707c 100644 (file)
@@ -1,5 +1,5 @@
-# netdb_h.m4 serial 5
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# netdb_h.m4 serial 6
+dnl Copyright (C) 2008, 2009, 2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_HEADER_NETDB],
 [
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
   gl_CHECK_NEXT_HEADERS([netdb.h])
   if test $ac_cv_header_netdb_h = yes; then
     AC_COMPILE_IFELSE(
index 47fd9cc3175099f4e5479ac17f1ea8d44bb3da40..cc7a44cc21b85d2364efd168cca9bed77b3f42e4 100644 (file)
@@ -1,5 +1,5 @@
 # netinet_in_h.m4 serial 4
-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2010 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.
index fb37fd0d991cbe738db0ddc86953f8773f8a3238..350cd4203fa736cc32bc8fd2863e37ba6137a6a3 100644 (file)
@@ -1,5 +1,5 @@
 # perror.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 87aa45c5e7e5eceed46e249708235f78285425b7..ebca5364c467d51f91324b50bb2b248b3cc725a0 100644 (file)
@@ -1,5 +1,5 @@
 # printf.m4 serial 33
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
index 8d1b8f3c5f1ad8d18e799a7522e046045ad74d7d..35a3a4817fddcd3c2b2d11ae41b7d80c75e513f5 100644 (file)
@@ -1,5 +1,6 @@
 # read-file.m4 serial 2
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software
+dnl 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.
index eb44b0ad0306e1e35b7d8e29694a4e5dd7fc1dbb..27f81629a5b015fe16172127d8565f81f13d1b82 100644 (file)
@@ -1,5 +1,5 @@
 # readline.m4 serial 7
-dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2009, 2010 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.
@@ -42,7 +42,7 @@ AC_DEFUN([gl_FUNC_READLINE],
           [[readline((char*)0);]])],
         [gl_cv_lib_readline=" -l$extra_lib"])
       if test "$gl_cv_lib_readline" != no; then
-       break
+        break
       fi
     done
     LIBS="$am_save_LIBS"
index 5925796864e033cb4e0794c9e751378f513b97c5..dc30235c176cb5f7228dfbf091aaed3f96d8f9c6 100644 (file)
@@ -1,5 +1,5 @@
 # realloc.m4 serial 9
-dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index 53cc059656cc424eb745c455c61e8d04eb473d3b..da266f0bfa91e8d67706b8363d6bf831fed3c723 100644 (file)
@@ -1,5 +1,5 @@
-# select.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+# select.m4 serial 3
+dnl Copyright (C) 2009, 2010 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.
@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_SELECT],
 [
   AC_REQUIRE([gl_HEADER_SYS_SELECT])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_SOCKETS])
   if test "$ac_cv_header_winsock2_h" = yes; then
     AC_LIBOBJ([select])
   else
index 242f9e3602991d4a58dfc40068312d7c8cc24498..2ed961a439c5b624c6b5b33c76bf141e5df5a873 100644 (file)
@@ -1,5 +1,5 @@
 # servent.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 35bd3d6ae37ec6fe189a0122d73166943e3787cc..ce992db1f18336a0775f3bd98bdd12cdb7e4e70f 100644 (file)
@@ -1,5 +1,5 @@
 # size_max.m4 serial 9
-dnl Copyright (C) 2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2010 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.
index 6021786ee146ea02ca697a1a90360dc95c6043d4..522b107b12679079050a1459d80b74c067d04743 100644 (file)
@@ -1,5 +1,5 @@
 # snprintf.m4 serial 5
-dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2010 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.
index 3edc010610314e8a89c80747470ed0ce1b61e2d5..aefb936079648fb775b698b0666eec1012a9b4a7 100644 (file)
@@ -1,5 +1,5 @@
 # sockets.m4 serial 6
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 80ed5135fd3e9dceab8dfea491bf88166736c6b6..2933d4b890635f957b8aa58f936e40a2b7d6450b 100644 (file)
@@ -1,5 +1,5 @@
 # socklen.m4 serial 7
-dnl Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 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.
@@ -20,30 +20,30 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
    AC_CHECK_TYPE([socklen_t], ,
      [AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([gl_cv_socklen_t_equiv],
-       [# Systems have either "struct sockaddr *" or
-        # "void *" as the second argument to getpeername
-        gl_cv_socklen_t_equiv=
-        for arg2 in "struct sockaddr" void; do
-          for t in int size_t "unsigned int" "long int" "unsigned long int"; do
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+        [# Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         gl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
+             AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
                  [[#include <sys/types.h>
                    #include <sys/socket.h>
 
                    int getpeername (int, $arg2 *, $t *);]],
                  [[$t len;
                   getpeername (0, 0, &len);]])],
-              [gl_cv_socklen_t_equiv="$t"])
-            test "$gl_cv_socklen_t_equiv" != "" && break
-          done
-          test "$gl_cv_socklen_t_equiv" != "" && break
-        done
+               [gl_cv_socklen_t_equiv="$t"])
+             test "$gl_cv_socklen_t_equiv" != "" && break
+           done
+           test "$gl_cv_socklen_t_equiv" != "" && break
+         done
       ])
       if test "$gl_cv_socklen_t_equiv" = ""; then
-       AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+        AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
       fi
       AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
       AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
-       [type to use in place of socklen_t if not defined])],
+        [type to use in place of socklen_t if not defined])],
      [#include <sys/types.h>
       #if HAVE_SYS_SOCKET_H
       # include <sys/socket.h>
index bbdfabc919f88659c3376d0ce70cc2748ad7bfa4..8a0c23603857399f96dd83bbf4f6e6564a8c7b43 100644 (file)
@@ -1,5 +1,5 @@
 # sockpfaf.m4 serial 7
-dnl Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2009, 2010 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.
index a9ada4f4e0286f47de0f008115af33ebde13b885..5c87bd8b5f6da4b6b64bb94f68fc61f8c2956e9d 100644 (file)
@@ -1,5 +1,5 @@
 # stdarg.m4 serial 3
-dnl Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2010 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.
index 57c804a80ff7da006714ce54b11da37c58557faa..3d672d7476b217bdc8777d6759f1f3bc5c53343d 100644 (file)
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2010 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.
@@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
      [ac_cv_header_stdbool_h],
      [AC_TRY_COMPILE(
-       [
-         #include <stdbool.h>
-         #ifndef bool
-          "error: bool is not defined"
-         #endif
-         #ifndef false
-          "error: false is not defined"
-         #endif
-         #if false
-          "error: false is not 0"
-         #endif
-         #ifndef true
-          "error: true is not defined"
-         #endif
-         #if true != 1
-          "error: true is not 1"
-         #endif
-         #ifndef __bool_true_false_are_defined
-          "error: __bool_true_false_are_defined is not defined"
-         #endif
+        [
+          #include <stdbool.h>
+          #ifndef bool
+           "error: bool is not defined"
+          #endif
+          #ifndef false
+           "error: false is not defined"
+          #endif
+          #if false
+           "error: false is not 0"
+          #endif
+          #ifndef true
+           "error: true is not defined"
+          #endif
+          #if true != 1
+           "error: true is not 1"
+          #endif
+          #ifndef __bool_true_false_are_defined
+           "error: __bool_true_false_are_defined is not defined"
+          #endif
 
-         struct s { _Bool s: 1; _Bool t; } s;
+          struct s { _Bool s: 1; _Bool t; } s;
 
-         char a[true == 1 ? 1 : -1];
-         char b[false == 0 ? 1 : -1];
-         char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-         char d[(bool) 0.5 == true ? 1 : -1];
-         bool e = &s;
-         char f[(_Bool) 0.0 == false ? 1 : -1];
-         char g[true];
-         char h[sizeof (_Bool)];
-         char i[sizeof s.t];
-         enum { j = false, k = true, l = false * true, m = true * 256 };
-         _Bool n[m];
-         char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-         #if defined __xlc__ || defined __GNUC__
-          /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-             reported by James Lemley on 2005-10-05; see
-             http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-             This test is not quite right, since xlc is allowed to
-             reject this program, as the initializer for xlcbug is
-             not one of the forms that C requires support for.
-             However, doing the test right would require a run-time
-             test, and that would make cross-compilation harder.
-             Let us hope that IBM fixes the xlc bug, and also adds
-             support for this kind of constant expression.  In the
-             meantime, this test will reject xlc, which is OK, since
-             our stdbool.h substitute should suffice.  We also test
-             this with GCC, where it should work, to detect more
-             quickly whether someone messes up the test in the
-             future.  */
-          char digs[] = "0123456789";
-          int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-         #endif
-         /* Catch a bug in an HP-UX C compiler.  See
-            http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-            http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          */
-         _Bool q = true;
-         _Bool *pq = &q;
-       ],
-       [
-         *pq |= q;
-         *pq |= ! q;
-         /* Refer to every declared value, to avoid compiler optimizations.  */
-         return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                 + !m + !n + !o + !p + !q + !pq);
-       ],
-       [ac_cv_header_stdbool_h=yes],
-       [ac_cv_header_stdbool_h=no])])
+          char a[true == 1 ? 1 : -1];
+          char b[false == 0 ? 1 : -1];
+          char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+          char d[(bool) 0.5 == true ? 1 : -1];
+          bool e = &s;
+          char f[(_Bool) 0.0 == false ? 1 : -1];
+          char g[true];
+          char h[sizeof (_Bool)];
+          char i[sizeof s.t];
+          enum { j = false, k = true, l = false * true, m = true * 256 };
+          _Bool n[m];
+          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+          char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+          #if defined __xlc__ || defined __GNUC__
+           /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+              reported by James Lemley on 2005-10-05; see
+              http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+              This test is not quite right, since xlc is allowed to
+              reject this program, as the initializer for xlcbug is
+              not one of the forms that C requires support for.
+              However, doing the test right would require a run-time
+              test, and that would make cross-compilation harder.
+              Let us hope that IBM fixes the xlc bug, and also adds
+              support for this kind of constant expression.  In the
+              meantime, this test will reject xlc, which is OK, since
+              our stdbool.h substitute should suffice.  We also test
+              this with GCC, where it should work, to detect more
+              quickly whether someone messes up the test in the
+              future.  */
+           char digs[] = "0123456789";
+           int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+          #endif
+          /* Catch a bug in an HP-UX C compiler.  See
+             http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+             http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+           */
+          _Bool q = true;
+          _Bool *pq = &q;
+        ],
+        [
+          *pq |= q;
+          *pq |= ! q;
+          /* Refer to every declared value, to avoid compiler optimizations.  */
+          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                  + !m + !n + !o + !p + !q + !pq);
+        ],
+        [ac_cv_header_stdbool_h=yes],
+        [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
      AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
index 682e9c626e6b8b43a21192617c4fd538b2fd9e4d..c8572de947dcd3fe6492189ec54b7811c4c9f4d0 100644 (file)
@@ -1,6 +1,6 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
 # stddef_h.m4 serial 1
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009, 2010 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.
index a2e8bdd62814a97e7be2875fd8f3cbf3b4c4ba8f..1cc57e6e9608a820725378eb081e253c6e35806f 100644 (file)
@@ -1,5 +1,5 @@
 # stdint.m4 serial 34
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
@@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
        for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
          case $glsuf in
            '')  gltype1='int';;
-           l)  gltype1='long int';;
-           ll) gltype1='long long int';;
-           i64)        gltype1='__int64';;
-           u)  gltype1='unsigned int';;
-           ul) gltype1='unsigned long int';;
-           ull)        gltype1='unsigned long long int';;
+           l)   gltype1='long int';;
+           ll)  gltype1='long long int';;
+           i64) gltype1='__int64';;
+           u)   gltype1='unsigned int';;
+           ul)  gltype1='unsigned long int';;
+           ull) gltype1='unsigned long long int';;
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
index 82f0c244c8ee0c7a34de7b75fead88478e5bd08e..b8e3c6cc711f17ab409131b9411ea51fe23d8d01 100644 (file)
@@ -1,5 +1,5 @@
 # stdint_h.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
index ed828eac8908dc842b4b0ddecd27f2a2cc5a37d2..20af579d148de3ee1ffb720aaad06883d7dd229f 100644 (file)
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 21
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# stdio_h.m4 serial 24
+dnl Copyright (C) 2007-2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
   gl_CHECK_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -30,6 +31,13 @@ AC_DEFUN([gl_STDIO_H],
       AC_LIBOBJ([stdio-write])
     fi
   ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
+    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+    snprintf vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -89,8 +97,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
   HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
-  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
-  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
   HAVE_RENAMEAT=1;               AC_SUBST([HAVE_RENAMEAT])
   HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
   HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
@@ -140,6 +146,6 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
   choke me
 # endif
 #endif]])],
-       [gl_cv_var_stdin_large_offset=yes],
-       [gl_cv_var_stdin_large_offset=no])])
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
 ])
index 4556ac04c5a2bab487d29d240f378a43d9e19f08..0693d1a5ec10a65c32a499af9348fe7734a96c6d 100644 (file)
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 21
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 22
+dnl Copyright (C) 2007-2010 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.
@@ -22,6 +22,20 @@ AC_DEFUN([gl_STDLIB_H],
       # include <random.h>
       #endif
     ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp
+    mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -80,6 +94,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
 ])
index 8c16ca9a879a5de8720a7651cf15ee5b22033adf..1649b2451133f93bfcf2d2d725f17499e5a0a3da 100644 (file)
@@ -1,5 +1,5 @@
 # strerror.m4 serial 9
-dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2010 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.
index edc5c6e825efaef904b7a43e80e43afeaea68690..73c6d833784a50d05d6256da26ac17dc86850e86 100644 (file)
@@ -1,11 +1,11 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2007-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -64,33 +71,34 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
-  GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
+  GNULIB_STRVERSCMP=0;  AC_SUBST([GNULIB_STRVERSCMP])
+  HAVE_MBSLEN=0;        AC_SUBST([HAVE_MBSLEN])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
-  HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
-  HAVE_DECL_MEMRCHR=1;         AC_SUBST([HAVE_DECL_MEMRCHR])
-  HAVE_RAWMEMCHR=1;            AC_SUBST([HAVE_RAWMEMCHR])
-  HAVE_STPCPY=1;               AC_SUBST([HAVE_STPCPY])
-  HAVE_STPNCPY=1;              AC_SUBST([HAVE_STPNCPY])
-  HAVE_STRCHRNUL=1;            AC_SUBST([HAVE_STRCHRNUL])
-  HAVE_DECL_STRDUP=1;          AC_SUBST([HAVE_DECL_STRDUP])
-  HAVE_DECL_STRNDUP=1;         AC_SUBST([HAVE_DECL_STRNDUP])
-  HAVE_DECL_STRNLEN=1;         AC_SUBST([HAVE_DECL_STRNLEN])
-  HAVE_STRPBRK=1;              AC_SUBST([HAVE_STRPBRK])
-  HAVE_STRSEP=1;               AC_SUBST([HAVE_STRSEP])
-  HAVE_STRCASESTR=1;           AC_SUBST([HAVE_STRCASESTR])
-  HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
-  HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
-  HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
-  HAVE_STRVERSCMP=1;           AC_SUBST([HAVE_STRVERSCMP])
-  REPLACE_MEMCHR=0;            AC_SUBST([REPLACE_MEMCHR])
-  REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
-  REPLACE_STRDUP=0;            AC_SUBST([REPLACE_STRDUP])
-  REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
-  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
-  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
-  REPLACE_STRNDUP=0;           AC_SUBST([REPLACE_STRNDUP])
-  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
-  REPLACE_STRTOK_R=0;          AC_SUBST([REPLACE_STRTOK_R])
-  UNDEFINE_STRTOK_R=0;         AC_SUBST([UNDEFINE_STRTOK_R])
+  HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
+  HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
+  HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
+  HAVE_RAWMEMCHR=1;             AC_SUBST([HAVE_RAWMEMCHR])
+  HAVE_STPCPY=1;                AC_SUBST([HAVE_STPCPY])
+  HAVE_STPNCPY=1;               AC_SUBST([HAVE_STPNCPY])
+  HAVE_STRCHRNUL=1;             AC_SUBST([HAVE_STRCHRNUL])
+  HAVE_DECL_STRDUP=1;           AC_SUBST([HAVE_DECL_STRDUP])
+  HAVE_DECL_STRNDUP=1;          AC_SUBST([HAVE_DECL_STRNDUP])
+  HAVE_DECL_STRNLEN=1;          AC_SUBST([HAVE_DECL_STRNLEN])
+  HAVE_STRPBRK=1;               AC_SUBST([HAVE_STRPBRK])
+  HAVE_STRSEP=1;                AC_SUBST([HAVE_STRSEP])
+  HAVE_STRCASESTR=1;            AC_SUBST([HAVE_STRCASESTR])
+  HAVE_DECL_STRTOK_R=1;         AC_SUBST([HAVE_DECL_STRTOK_R])
+  HAVE_DECL_STRERROR=1;         AC_SUBST([HAVE_DECL_STRERROR])
+  HAVE_DECL_STRSIGNAL=1;        AC_SUBST([HAVE_DECL_STRSIGNAL])
+  HAVE_STRVERSCMP=1;            AC_SUBST([HAVE_STRVERSCMP])
+  REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
+  REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
+  REPLACE_STRSTR=0;             AC_SUBST([REPLACE_STRSTR])
+  REPLACE_STRCASESTR=0;         AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRNDUP=0;            AC_SUBST([REPLACE_STRNDUP])
+  REPLACE_STRSIGNAL=0;          AC_SUBST([REPLACE_STRSIGNAL])
+  REPLACE_STRTOK_R=0;           AC_SUBST([REPLACE_STRTOK_R])
+  UNDEFINE_STRTOK_R=0;          AC_SUBST([UNDEFINE_STRTOK_R])
 ])
index 22aa83ee599fd54c77a32b8cbb78ad72befb05a3..829dc610dc8a11271b81159740a110fea4ee38c3 100644 (file)
@@ -1,5 +1,5 @@
-# sys_ioctl_h.m4 serial 3
-dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
+# sys_ioctl_h.m4 serial 5
+dnl Copyright (C) 2008-2010 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.
@@ -27,24 +27,28 @@ AC_DEFUN([gl_SYS_IOCTL_H],
          [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
          [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
       ])
-    if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then
-      SYS_IOCTL_H='sys/ioctl.h'
-    fi
   else
     HAVE_SYS_IOCTL_H=0
-    SYS_IOCTL_H='sys/ioctl.h'
   fi
   AC_SUBST([HAVE_SYS_IOCTL_H])
-  dnl Execute this unconditionally, because SYS_IOCTL_H may be set by other
-  dnl modules, after this code is executed.
+  dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
+/* Some platforms declare ioctl in the wrong header.  */
+#ifndef __GLIBC__
+# include <unistd.h>
+#endif
+    ]], [ioctl])
 ])
 
 dnl Unconditionally enables the replacement of <sys/ioctl.h>.
 AC_DEFUN([gl_REPLACE_SYS_IOCTL_H],
 [
-  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
-  SYS_IOCTL_H='sys/ioctl.h'
+  dnl This is a no-op, because <sys/ioctl.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
@@ -61,5 +65,4 @@ AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
   SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
   SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
                         AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
-  SYS_IOCTL_H='';                AC_SUBST([SYS_IOCTL_H])
 ])
index 0bb097e1a7395af4f103fe94ce7b5de947705076..590554a11f285d770cdbfbdf61c907c82d930bc9 100644 (file)
@@ -1,5 +1,5 @@
-# sys_select_h.m4 serial 8
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# sys_select_h.m4 serial 11
+dnl Copyright (C) 2006-2010 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.
@@ -17,7 +17,7 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
       dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
       dnl    of 'struct timeval', and no definition of this type.
       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
-                                        [[struct timeval b;]])],
+                                         [[struct timeval b;]])],
         [gl_cv_header_sys_select_h_selfcontained=yes],
         [gl_cv_header_sys_select_h_selfcontained=no])
       dnl Test against another bug:
@@ -45,20 +45,28 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
           ])
       fi
     ])
-  if test $gl_cv_header_sys_select_h_selfcontained = yes; then
-    SYS_SELECT_H=''
+  AC_CHECK_HEADERS_ONCE([sys/select.h])
+  gl_CHECK_NEXT_HEADERS([sys/select.h])
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
   else
-    SYS_SELECT_H='sys/select.h'
-    gl_CHECK_NEXT_HEADERS([sys/select.h])
-    if test $ac_cv_header_sys_select_h = yes; then
-      HAVE_SYS_SELECT_H=1
-    else
-      HAVE_SYS_SELECT_H=0
-    fi
-    AC_SUBST([HAVE_SYS_SELECT_H])
+    HAVE_SYS_SELECT_H=0
+  fi
+  AC_SUBST([HAVE_SYS_SELECT_H])
+  if test $gl_cv_header_sys_select_h_selfcontained != yes; then
     gl_PREREQ_SYS_H_WINSOCK2
   fi
-  AC_SUBST([SYS_SELECT_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [select])
 ])
 
 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
index e864b2c7e214e5d04ab7eeb6c9b3a6801ab5debc..1d47656027f788ff95ee98650cd87cc07cb0fe7d 100644 (file)
@@ -1,5 +1,5 @@
-# sys_socket_h.m4 serial 13
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+# sys_socket_h.m4 serial 14
+dnl Copyright (C) 2005-2010 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.
@@ -66,6 +66,18 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
     gl_PREREQ_SYS_H_WINSOCK2
   fi
   AC_SUBST([SYS_SOCKET_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
 ])
 
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
index 838cf484e9ccb08df84523c53c823f04072e9d0b..5a113d02ea80c8de1cbbfd8518c6b988b5f534ff 100644 (file)
@@ -1,5 +1,5 @@
-# sys_stat_h.m4 serial 21   -*- Autoconf -*-
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 22   -*- Autoconf -*-
+dnl Copyright (C) 2006-2010 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.
@@ -27,6 +27,11 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
     [#include <sys/types.h>
      #include <sys/stat.h>])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
+    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+    mknod mknodat stat utimensat])
 ]) # gl_HEADER_SYS_STAT_H
 
 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
index 13ac5763b3d5c76a26c6d5e5d0740f3b63f77cfb..9c16487957bc27ffd4ade8eba9943b1fb138df5d 100644 (file)
@@ -1,6 +1,7 @@
 # Configure a replacement for <sys/time.h>.
+# serial 2
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -18,6 +19,7 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H],
 AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
 [
   AC_REQUIRE([AC_C_RESTRICT])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
   gl_CHECK_NEXT_HEADERS([sys/time.h])
 
   if test $ac_cv_header_sys_time_h = yes; then
@@ -30,12 +32,12 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
   AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#if HAVE_SYS_TIME_H
-            #include <sys/time.h>
-           #endif
-           #include <time.h>
-         ]],
-         [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
+          [[#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+          ]],
+          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
        [gl_cv_sys_struct_timeval=yes],
        [gl_cv_sys_struct_timeval=no])])
   if test $gl_cv_sys_struct_timeval = yes; then
index 16fefa19749450385b5b3066bb9a49160721518e..c00bfae922c1fac4e9b9f0409a25c84c11068a5b 100644 (file)
@@ -1,6 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -45,9 +45,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     [gl_cv_sys_struct_timespec_in_time_h],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <time.h>
-         ]],
-         [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+          [[#include <time.h>
+          ]],
+          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
        [gl_cv_sys_struct_timespec_in_time_h=yes],
        [gl_cv_sys_struct_timespec_in_time_h=no])])
 
@@ -59,12 +59,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
       [gl_cv_sys_struct_timespec_in_sys_time_h],
       [AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <sys/time.h>
-           ]],
-           [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+            ]],
+            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
     if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
       SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
     fi
index eb652356b539a9f45a9903728470834138bc4b54..68ccf8834943224633400ad75d747ef59d5824af 100644 (file)
@@ -1,5 +1,5 @@
 # ungetc.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009, 2010 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.
@@ -13,21 +13,21 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
       ]], [FILE *f;
-          if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
-          if (fputs ("abc", f) < 0) return 2;
-          rewind (f);
-          if (fgetc (f) != 'a') return 3;
-          if (fgetc (f) != 'b') return 4;
-          if (ungetc ('d', f) != 'd') return 5;
-          if (ftell (f) != 1) return 6;
-          if (fgetc (f) != 'd') return 7;
-          if (ftell (f) != 2) return 8;
-          if (fseek (f, 0, SEEK_CUR) != 0) return 9;
-          if (ftell (f) != 2) return 10;
-          if (fgetc (f) != 'c') return 11;
-          fclose (f); remove ("conftest.tmp");])],
-       [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
-       [gl_cv_func_ungetc_works='guessing no'])
+           if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
+           if (fputs ("abc", f) < 0) return 2;
+           rewind (f);
+           if (fgetc (f) != 'a') return 3;
+           if (fgetc (f) != 'b') return 4;
+           if (ungetc ('d', f) != 'd') return 5;
+           if (ftell (f) != 1) return 6;
+           if (fgetc (f) != 'd') return 7;
+           if (ftell (f) != 2) return 8;
+           if (fseek (f, 0, SEEK_CUR) != 0) return 9;
+           if (ftell (f) != 2) return 10;
+           if (fgetc (f) != 'c') return 11;
+           fclose (f); remove ("conftest.tmp");])],
+        [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
+        [gl_cv_func_ungetc_works='guessing no'])
     ])
   if test "$gl_cv_func_ungetc_works" != yes; then
     AC_DEFINE([FUNC_UNGETC_BROKEN], [1],
index 88e60a05383599868a1efc4b54b078db4925cfeb..31d31c1e93b607f89c34b0dc0f72b5fd13646c29 100644 (file)
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 34
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# unistd_h.m4 serial 39
+dnl Copyright (C) 2006-2010 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.
@@ -11,6 +11,7 @@ AC_DEFUN([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.
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
 
   gl_CHECK_NEXT_HEADERS([unistd.h])
 
@@ -21,6 +22,24 @@ AC_DEFUN([gl_UNISTD_H],
     HAVE_UNISTD_H=0
   fi
   AC_SUBST([HAVE_UNISTD_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
+/* Some systems declare various items in the wrong headers.  */
+#ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -48,6 +67,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
   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_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
   GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
@@ -56,6 +76,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
   GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
   GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
+  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
   GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
   GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
   GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
@@ -66,6 +87,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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 Assume proper GNU behavior unless another module says otherwise.
   HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
@@ -80,12 +102,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
   HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
+  HAVE_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
   HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
   HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
+  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
@@ -96,6 +120,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
@@ -109,11 +134,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
   REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
   REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
   REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
   REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
   REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
   REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
   REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
   UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
index 3a1d1e01006402ffd34994d1abe1642e243bc43f..50a20cca2346803576a53ad8e39d5950cc3fbc33 100644 (file)
@@ -1,5 +1,5 @@
 # vasnprintf.m4 serial 29
-dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2010 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.
index 14d6eb6dce2d55567feebfc643be22a8c41786fc..2c572b4bcaa20378a76dd71abfdd8fa2c5aa5315 100644 (file)
@@ -1,5 +1,5 @@
 # version-etc.m4 serial 1
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,8 +11,8 @@ m4_define([gl_VERSION_ETC_FLAG],
   AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
     [dnl
       case $withval in
-       yes|no) ;;
-       *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
+        yes|no) ;;
+        *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
       esac
     ])
 ])
@@ -20,11 +20,11 @@ m4_define([gl_VERSION_ETC_FLAG],
 AC_DEFUN([gl_VERSION_ETC],
 [dnl
   gl_VERSION_ETC_FLAG([packager],
-                     [String identifying the packager of this software])
+                      [String identifying the packager of this software])
   gl_VERSION_ETC_FLAG([packager-version],
-                     [Packager-specific version information])
+                      [Packager-specific version information])
   gl_VERSION_ETC_FLAG([packager-bug-reports],
-                     [Packager info for bug reports (URL/e-mail/...)])
+                      [Packager info for bug reports (URL/e-mail/...)])
   if test "X$with_packager" = "X" && \
      test "X$with_packager_version$with_packager_bug_reports" != "X"
   then
index c32cf4ed66b7a4ae0bc1a7f3db4cd43288b4ae63..dad5c1f29c66aeebca880e65f9084fc4930a2e81 100644 (file)
@@ -1,19 +1,11 @@
 # warnings.m4 serial 2
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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 From Simon Josefsson
 
-# gl_AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
-# ----------------------------------------------------
-# Provide the functionality of AS_VAR_IF if Autoconf does not have it.
-m4_ifdef([AS_VAR_IF],
-[m4_copy([AS_VAR_IF], [gl_AS_VAR_IF])],
-[m4_define([gl_AS_VAR_IF],
-[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
-
 # gl_AS_VAR_APPEND(VAR, VALUE)
 # ----------------------------
 # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
@@ -33,11 +25,11 @@ AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
   CPPFLAGS="${CPPFLAGS} $1"
   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
                     [AS_VAR_SET([gl_Warn], [yes])],
-                   [AS_VAR_SET([gl_Warn], [no])])
+                    [AS_VAR_SET([gl_Warn], [no])])
   CPPFLAGS="$save_CPPFLAGS"
 ])
 AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
-gl_AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
+AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
 AS_VAR_POPDEF([gl_Flags])dnl
 AS_VAR_POPDEF([gl_Warn])dnl
 m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
index ce53a45cf5c4a8481933f2307f3e44f7a90ba0d4..e81485d01ea6535bbe0d040d7092c30662dba472 100644 (file)
@@ -1,23 +1,30 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2010 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 Written by Eric Blake.
 
-# wchar.m4 serial 25
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  AC_CACHE_CHECK([whether <wchar.h> is standalone],
-    [gl_cv_header_wchar_h_standalone],
-    [AC_COMPILE_IFELSE([[#include <wchar.h>
-wchar_t w;]],
-      [gl_cv_header_wchar_h_standalone=yes],
-      [gl_cv_header_wchar_h_standalone=no])])
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+  dnl Prepare for creating substitute <wchar.h>.
+  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+  dnl character support).
+  dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  gl_CHECK_NEXT_HEADERS([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
 
   AC_REQUIRE([gt_TYPE_WINT_T])
   if test $gt_cv_c_wint_t = yes; then
@@ -27,32 +34,73 @@ wchar_t w;]],
   fi
   AC_SUBST([HAVE_WINT_T])
 
-  dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
-  AC_REQUIRE([gl_STDDEF_H])
-
-  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
-    WCHAR_H=wchar.h
-  fi
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
+])
 
-  dnl Prepare for creating substitute <wchar.h>.
-  dnl Do it always: WCHAR_H may be empty here but can be set later.
-  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
-  dnl character support).
-  AC_CHECK_HEADERS_ONCE([wchar.h])
-  if test $ac_cv_header_wchar_h = yes; then
-    HAVE_WCHAR_H=1
-  else
-    HAVE_WCHAR_H=0
+dnl Check whether <wchar.h> is usable at all.
+AC_DEFUN([gl_WCHAR_H_INLINE_OK],
+[
+  dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
+  dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
+  dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
+  dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
+  dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
+  AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
+    [gl_cv_header_wchar_h_correct_inline],
+    [gl_cv_header_wchar_h_correct_inline=yes
+     AC_LANG_CONFTEST([
+       AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+extern int zero (void);
+int main () { return zero(); }
+]])])
+     if AC_TRY_EVAL([ac_compile]); then
+       mv conftest.$ac_objext conftest1.$ac_objext
+       AC_LANG_CONFTEST([
+         AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+int zero (void) { return 0; }
+]])])
+       if AC_TRY_EVAL([ac_compile]); then
+         mv conftest.$ac_objext conftest2.$ac_objext
+         if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
+           :
+         else
+           gl_cv_header_wchar_h_correct_inline=no
+         fi
+       fi
+     fi
+     rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
+    ])
+  if test $gl_cv_header_wchar_h_correct_inline = no; then
+    AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
+This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
+C99 mode. You have four options:
+  - Add the flag -fgnu89-inline to CC and reconfigure, or
+  - Fix your include files, using parts of
+    <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
+  - Use a gcc version older than 4.3, or
+  - Don't use the flags -std=c99 or -std=gnu99.
+Configuration aborted.])
   fi
-  AC_SUBST([HAVE_WCHAR_H])
-  gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
 dnl Unconditionally enables the replacement of <wchar.h>.
 AC_DEFUN([gl_REPLACE_WCHAR_H],
 [
-  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  WCHAR_H=wchar.h
+  dnl This is a no-op, because <wchar.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
@@ -99,5 +147,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
   REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
   REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
index fb27a7f65f46e0f23b883d01e9e74f84e13595b5..ed804e664ba7933d42051ff3f240e82f9d787998 100644 (file)
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2010 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.
index 47a4363d79041b6481ed781bcbe798dc1b171ec9..a6c7d15cb50a60c46df73caef95f0fd1a0034809 100644 (file)
@@ -1,5 +1,5 @@
 # wint_t.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
index 631893cf59f8a73fe279f39908d421f5dbd8a2e5..b653693a3029cb835e98c0d02be9683926e26e00 100644 (file)
@@ -1,5 +1,5 @@
 # xsize.m4 serial 4
-dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2010 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.
index 2253d2d651cd2b97993309f2cb00428041082c21..6c2b2d6c7dc15cdc1bf15664653cdaecae7e18a7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006, 2008
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
@@ -97,15 +97,15 @@ __memchr (void const *s, int c_in, size_t n)
       repeated_one |= repeated_one << 31 << 1;
       repeated_c |= repeated_c << 31 << 1;
       if (8 < sizeof (longword))
-       {
-         size_t i;
-
-         for (i = 64; i < sizeof (longword) * 8; i *= 2)
-           {
-             repeated_one |= repeated_one << i;
-             repeated_c |= repeated_c << i;
-           }
-       }
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
     }
 
   /* Instead of the traditional loop which tests each byte, we will test a
@@ -144,8 +144,8 @@ __memchr (void const *s, int c_in, size_t n)
       longword longword1 = *longword_ptr ^ repeated_c;
 
       if ((((longword1 - repeated_one) & ~longword1)
-          & (repeated_one << 7)) != 0)
-       break;
+           & (repeated_one << 7)) != 0)
+        break;
       longword_ptr++;
       n -= sizeof (longword);
     }
@@ -162,7 +162,7 @@ __memchr (void const *s, int c_in, size_t n)
   for (; n > 0; --n, ++char_ptr)
     {
       if (*char_ptr == c)
-       return (void *) char_ptr;
+        return (void *) char_ptr;
     }
 
   return NULL;
index 1ebc22078e033491fd595d4dce1f0855ad0128a5..78ca8479d8ca3d0da338349e6c978696416e32f8 100644 (file)
@@ -1,5 +1,6 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009, 2010 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
index 363206d3b37db3bffe3483895963f6c67a92d75b..92daa5138653898528b4b9d1bd08ae6142747279 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a netdb.h header file for systems lacking it (read: MinGW).
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -39,6 +39,8 @@
 /* Get netdb.h definitions such as struct hostent for MinGW.  */
 #include <sys/socket.h>
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* Declarations for a platform that lacks <netdb.h>, or where it is
    incomplete.  */
 
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
 {
-  int ai_flags;                        /* Input flags.  */
-  int ai_family;               /* Protocol family for socket.  */
-  int ai_socktype;             /* Socket type.  */
-  int ai_protocol;             /* Protocol for socket.  */
-  socklen_t ai_addrlen;                /* Length of socket address.  */
-  struct sockaddr *ai_addr;    /* Socket address for socket.  */
-  char *ai_canonname;          /* Canonical name for service location.  */
-  struct addrinfo *ai_next;    /* Pointer to next in list.  */
+  int ai_flags;                 /* Input flags.  */
+  int ai_family;                /* Protocol family for socket.  */
+  int ai_socktype;              /* Socket type.  */
+  int ai_protocol;              /* Protocol for socket.  */
+  socklen_t ai_addrlen;         /* Length of socket address.  */
+  struct sockaddr *ai_addr;     /* Socket address for socket.  */
+  char *ai_canonname;           /* Canonical name for service location.  */
+  struct addrinfo *ai_next;     /* Pointer to next in list.  */
 };
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
 # ifndef AI_PASSIVE
-#  define AI_PASSIVE   0x0001  /* Socket address is intended for `bind'.  */
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
 # endif
 # ifndef AI_CANONNAME
-#  define AI_CANONNAME 0x0002  /* Request for canonical name.  */
+#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
 # endif
 # ifndef AI_NUMERICSERV
-#  define AI_NUMERICSERV       0x0400  /* Don't use name resolution.  */
+#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
 # endif
 
 # if 0
@@ -78,24 +80,24 @@ struct addrinfo
    define them.
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
-#  define AI_NUMERICHOST       0x0004  /* Don't use name resolution.  */
-#  define AI_V4MAPPED  0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL               0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
-#  define AI_ADDRCONFIG        0x0020  /* Use configuration of this host to choose
-                                  returned address type..  */
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
+#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
+#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
+                                   returned address type..  */
 # endif /* 0 */
 
 /* Error values for `getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS
-#  define EAI_BADFLAGS   -1    /* Invalid value for `ai_flags' field.  */
-#  define EAI_NONAME     -2    /* NAME or SERVICE is unknown.  */
-#  define EAI_AGAIN      -3    /* Temporary failure in name resolution.  */
-#  define EAI_FAIL       -4    /* Non-recoverable failure in name res.  */
-#  define EAI_NODATA     -5    /* No address associated with NAME.  */
-#  define EAI_FAMILY     -6    /* `ai_family' not supported.  */
-#  define EAI_SOCKTYPE   -7    /* `ai_socktype' not supported.  */
-#  define EAI_SERVICE    -8    /* SERVICE not supported for `ai_socktype'.  */
-#  define EAI_MEMORY     -10   /* Memory allocation failure.  */
+#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
+#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
+#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
+#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
+#  define EAI_NODATA      -5    /* No address associated with NAME.  */
+#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
+#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
 # endif
 
 /* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
@@ -107,15 +109,15 @@ struct addrinfo
 
 # ifndef EAI_OVERFLOW
 /* Not defined on mingw32 and Haiku. */
-#  define EAI_OVERFLOW   -12   /* Argument buffer overflow.  */
+#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
 # endif
 # ifndef EAI_ADDRFAMILY
 /* Not defined on mingw32. */
-#  define EAI_ADDRFAMILY  -9   /* Address family for NAME not supported.  */
+#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
 # endif
 # ifndef EAI_SYSTEM
 /* Not defined on mingw32. */
-#  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
+#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
 # endif
 
 # if 0
@@ -124,12 +126,12 @@ struct addrinfo
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
 #  ifndef EAI_INPROGRESS
-#   define EAI_INPROGRESS      -100    /* Processing request in progress.  */
-#   define EAI_CANCELED                -101    /* Request canceled.  */
-#   define EAI_NOTCANCELED     -102    /* Request not canceled.  */
-#   define EAI_ALLDONE         -103    /* All requests done.  */
-#   define EAI_INTR            -104    /* Interrupted by a signal.  */
-#   define EAI_IDN_ENCODE      -105    /* IDN encoding failed.  */
+#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
+#   define EAI_CANCELED         -101    /* Request canceled.  */
+#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
+#   define EAI_ALLDONE          -103    /* All requests done.  */
+#   define EAI_INTR             -104    /* Interrupted by a signal.  */
+#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
 #  endif
 # endif
 
@@ -139,16 +141,17 @@ struct addrinfo
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 extern int getaddrinfo (const char *restrict nodename,
-                       const char *restrict servname,
-                       const struct addrinfo *restrict hints,
-                       struct addrinfo **restrict res);
+                        const char *restrict servname,
+                        const struct addrinfo *restrict hints,
+                        struct addrinfo **restrict res)
+     _GL_ARG_NONNULL ((4));
 # endif
 
 # if !@HAVE_DECL_FREEADDRINFO@
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern void freeaddrinfo (struct addrinfo *ai);
+extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
 # endif
 
 # if !@HAVE_DECL_GAI_STRERROR@
@@ -163,9 +166,10 @@ extern const char *gai_strerror (int ecode);
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
 extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-                      char *restrict node, socklen_t nodelen,
-                      char *restrict service, socklen_t servicelen,
-                      int flags);
+                       char *restrict node, socklen_t nodelen,
+                       char *restrict service, socklen_t servicelen,
+                       int flags)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 /* Possible flags for getnameinfo.  */
index 97e11a7e0b023cdc338487cfa2b1715decfe674d..c7b88274e4159632fef7b476ad09032ae8fac3c4 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for <netinet/in.h>.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index fcd13cb8b411cf3f3b11a859cf9cd3daf1f974b0..78c04c1b408613f57ee7626ece92cf2743c041f3 100644 (file)
@@ -1,6 +1,6 @@
---- gl/gettext.h.orig  2008-11-17 17:12:20.000000000 +0100
-+++ gl/gettext.h       2008-11-17 17:12:29.000000000 +0100
-@@ -162,109 +162,4 @@
+--- gl/gettext.h.orig  2010-01-26 15:37:52.000000000 +0100
++++ gl/gettext.h       2010-01-26 15:37:59.000000000 +0100
+@@ -172,109 +172,4 @@
      return translation;
  }
  
@@ -32,8 +32,8 @@
 -#endif
 -static const char *
 -dcpgettext_expr (const char *domain,
--               const char *msgctxt, const char *msgid,
--               int category)
+-                 const char *msgctxt, const char *msgid,
+-                 int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
 -      translation = dcgettext (domain, msg_ctxt_id, category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (translation != msg_ctxt_id)
--      return translation;
+-        return translation;
 -    }
 -  return msgid;
 -}
@@ -77,9 +77,9 @@
 -#endif
 -static const char *
 -dcnpgettext_expr (const char *domain,
--                const char *msgctxt, const char *msgid,
--                const char *msgid_plural, unsigned long int n,
--                int category)
+-                  const char *msgctxt, const char *msgid,
+-                  const char *msgid_plural, unsigned long int n,
+-                  int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
 -      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (!(translation == msg_ctxt_id || translation == msgid_plural))
--      return translation;
+-        return translation;
 -    }
 -  return (n == 1 ? msgid : msgid_plural);
 -}
index 72d9f2851480b7038efdae22139ad72556d1e870..bc3c764911dfec960ea29b9bee85db4b0f43ada3 100644 (file)
@@ -1,5 +1,5 @@
 /* Print a message describing error code.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible and Simon Josefsson.
 
    This program is free software: you can redistribute it and/or modify
index 871c720a9931a1cb26a9d090c7ceac007835fd78..46c03a21eaed86ab8bc8e8a82ba4cb74ef87e43b 100644 (file)
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 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
@@ -42,146 +43,146 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
     switch (ap->type)
       {
       case TYPE_SCHAR:
-       ap->a.a_schar = va_arg (args, /*signed char*/ int);
-       break;
+        ap->a.a_schar = va_arg (args, /*signed char*/ int);
+        break;
       case TYPE_UCHAR:
-       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
-       break;
+        ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
+        break;
       case TYPE_SHORT:
-       ap->a.a_short = va_arg (args, /*short*/ int);
-       break;
+        ap->a.a_short = va_arg (args, /*short*/ int);
+        break;
       case TYPE_USHORT:
-       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
-       break;
+        ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
+        break;
       case TYPE_INT:
-       ap->a.a_int = va_arg (args, int);
-       break;
+        ap->a.a_int = va_arg (args, int);
+        break;
       case TYPE_UINT:
-       ap->a.a_uint = va_arg (args, unsigned int);
-       break;
+        ap->a.a_uint = va_arg (args, unsigned int);
+        break;
       case TYPE_LONGINT:
-       ap->a.a_longint = va_arg (args, long int);
-       break;
+        ap->a.a_longint = va_arg (args, long int);
+        break;
       case TYPE_ULONGINT:
-       ap->a.a_ulongint = va_arg (args, unsigned long int);
-       break;
+        ap->a.a_ulongint = va_arg (args, unsigned long int);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_LONGLONGINT:
-       ap->a.a_longlongint = va_arg (args, long long int);
-       break;
+        ap->a.a_longlongint = va_arg (args, long long int);
+        break;
       case TYPE_ULONGLONGINT:
-       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
-       break;
+        ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
+        break;
 #endif
       case TYPE_DOUBLE:
-       ap->a.a_double = va_arg (args, double);
-       break;
+        ap->a.a_double = va_arg (args, double);
+        break;
       case TYPE_LONGDOUBLE:
-       ap->a.a_longdouble = va_arg (args, long double);
-       break;
+        ap->a.a_longdouble = va_arg (args, long double);
+        break;
       case TYPE_CHAR:
-       ap->a.a_char = va_arg (args, int);
-       break;
+        ap->a.a_char = va_arg (args, int);
+        break;
 #if HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
-          default argument promotions", this is not the case in mingw32,
-          where wint_t is 'unsigned short'.  */
-       ap->a.a_wide_char =
-         (sizeof (wint_t) < sizeof (int)
-          ? va_arg (args, int)
-          : va_arg (args, wint_t));
-       break;
+        /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+           default argument promotions", this is not the case in mingw32,
+           where wint_t is 'unsigned short'.  */
+        ap->a.a_wide_char =
+          (sizeof (wint_t) < sizeof (int)
+           ? (wint_t) va_arg (args, int)
+           : va_arg (args, wint_t));
+        break;
 #endif
       case TYPE_STRING:
-       ap->a.a_string = va_arg (args, const char *);
-       /* A null pointer is an invalid argument for "%s", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_string == NULL)
-         ap->a.a_string = "(NULL)";
-       break;
+        ap->a.a_string = va_arg (args, const char *);
+        /* A null pointer is an invalid argument for "%s", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_string == NULL)
+          ap->a.a_string = "(NULL)";
+        break;
 #if HAVE_WCHAR_T
       case TYPE_WIDE_STRING:
-       ap->a.a_wide_string = va_arg (args, const wchar_t *);
-       /* A null pointer is an invalid argument for "%ls", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_wide_string == NULL)
-         {
-           static const wchar_t wide_null_string[] =
-             {
-               (wchar_t)'(',
-               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
-               (wchar_t)')',
-               (wchar_t)0
-             };
-           ap->a.a_wide_string = wide_null_string;
-         }
-       break;
+        ap->a.a_wide_string = va_arg (args, const wchar_t *);
+        /* A null pointer is an invalid argument for "%ls", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_wide_string == NULL)
+          {
+            static const wchar_t wide_null_string[] =
+              {
+                (wchar_t)'(',
+                (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
+                (wchar_t)')',
+                (wchar_t)0
+              };
+            ap->a.a_wide_string = wide_null_string;
+          }
+        break;
 #endif
       case TYPE_POINTER:
-       ap->a.a_pointer = va_arg (args, void *);
-       break;
+        ap->a.a_pointer = va_arg (args, void *);
+        break;
       case TYPE_COUNT_SCHAR_POINTER:
-       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
-       break;
+        ap->a.a_count_schar_pointer = va_arg (args, signed char *);
+        break;
       case TYPE_COUNT_SHORT_POINTER:
-       ap->a.a_count_short_pointer = va_arg (args, short *);
-       break;
+        ap->a.a_count_short_pointer = va_arg (args, short *);
+        break;
       case TYPE_COUNT_INT_POINTER:
-       ap->a.a_count_int_pointer = va_arg (args, int *);
-       break;
+        ap->a.a_count_int_pointer = va_arg (args, int *);
+        break;
       case TYPE_COUNT_LONGINT_POINTER:
-       ap->a.a_count_longint_pointer = va_arg (args, long int *);
-       break;
+        ap->a.a_count_longint_pointer = va_arg (args, long int *);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_COUNT_LONGLONGINT_POINTER:
-       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
-       break;
+        ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
+        break;
 #endif
 #if ENABLE_UNISTDIO
       /* The unistdio extensions.  */
       case TYPE_U8_STRING:
-       ap->a.a_u8_string = va_arg (args, const uint8_t *);
-       /* A null pointer is an invalid argument for "%U", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u8_string == NULL)
-         {
-           static const uint8_t u8_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u8_string = u8_null_string;
-         }
-       break;
+        ap->a.a_u8_string = va_arg (args, const uint8_t *);
+        /* A null pointer is an invalid argument for "%U", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u8_string == NULL)
+          {
+            static const uint8_t u8_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u8_string = u8_null_string;
+          }
+        break;
       case TYPE_U16_STRING:
-       ap->a.a_u16_string = va_arg (args, const uint16_t *);
-       /* A null pointer is an invalid argument for "%lU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u16_string == NULL)
-         {
-           static const uint16_t u16_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u16_string = u16_null_string;
-         }
-       break;
+        ap->a.a_u16_string = va_arg (args, const uint16_t *);
+        /* A null pointer is an invalid argument for "%lU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u16_string == NULL)
+          {
+            static const uint16_t u16_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u16_string = u16_null_string;
+          }
+        break;
       case TYPE_U32_STRING:
-       ap->a.a_u32_string = va_arg (args, const uint32_t *);
-       /* A null pointer is an invalid argument for "%llU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u32_string == NULL)
-         {
-           static const uint32_t u32_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u32_string = u32_null_string;
-         }
-       break;
+        ap->a.a_u32_string = va_arg (args, const uint32_t *);
+        /* A null pointer is an invalid argument for "%llU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u32_string == NULL)
+          {
+            static const uint32_t u32_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u32_string = u32_null_string;
+          }
+        break;
 #endif
       default:
-       /* Unknown type.  */
-       return -1;
+        /* Unknown type.  */
+        return -1;
       }
   return 0;
 }
index 67cb990cad30aedd50637eec0a27430792d90dfa..2536ebafd32ea983bc3a76caf50fb0469c214221 100644 (file)
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 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
@@ -93,42 +94,42 @@ typedef struct
   arg_type type;
   union
   {
-    signed char                        a_schar;
-    unsigned char              a_uchar;
-    short                      a_short;
-    unsigned short             a_ushort;
-    int                                a_int;
-    unsigned int               a_uint;
-    long int                   a_longint;
-    unsigned long int          a_ulongint;
+    signed char                 a_schar;
+    unsigned char               a_uchar;
+    short                       a_short;
+    unsigned short              a_ushort;
+    int                         a_int;
+    unsigned int                a_uint;
+    long int                    a_longint;
+    unsigned long int           a_ulongint;
 #if HAVE_LONG_LONG_INT
-    long long int              a_longlongint;
-    unsigned long long int     a_ulonglongint;
+    long long int               a_longlongint;
+    unsigned long long int      a_ulonglongint;
 #endif
-    float                      a_float;
-    double                     a_double;
-    long double                        a_longdouble;
-    int                                a_char;
+    float                       a_float;
+    double                      a_double;
+    long double                 a_longdouble;
+    int                         a_char;
 #if HAVE_WINT_T
-    wint_t                     a_wide_char;
+    wint_t                      a_wide_char;
 #endif
-    const char*                        a_string;
+    const char*                 a_string;
 #if HAVE_WCHAR_T
-    const wchar_t*             a_wide_string;
+    const wchar_t*              a_wide_string;
 #endif
-    void*                      a_pointer;
-    signed char *              a_count_schar_pointer;
-    short *                    a_count_short_pointer;
-    int *                      a_count_int_pointer;
-    long int *                 a_count_longint_pointer;
+    void*                       a_pointer;
+    signed char *               a_count_schar_pointer;
+    short *                     a_count_short_pointer;
+    int *                       a_count_int_pointer;
+    long int *                  a_count_longint_pointer;
 #if HAVE_LONG_LONG_INT
-    long long int *            a_count_longlongint_pointer;
+    long long int *             a_count_longlongint_pointer;
 #endif
 #if ENABLE_UNISTDIO
     /* The unistdio extensions.  */
-    const uint8_t *            a_u8_string;
-    const uint16_t *           a_u16_string;
-    const uint32_t *           a_u32_string;
+    const uint8_t *             a_u8_string;
+    const uint16_t *            a_u16_string;
+    const uint32_t *            a_u32_string;
 #endif
   }
   a;
index 28b9bd41acdc60614a836d1b9742e14c568d9adb..f612beb5b7ac11d1f165e2763cc62722a91723da 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2010 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
@@ -80,10 +80,10 @@ STATIC
 int
 PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
 {
-  const CHAR_T *cp = format;           /* pointer into format */
-  size_t arg_posn = 0;         /* number of regular arguments consumed */
-  size_t d_allocated;                  /* allocated elements of d->dir */
-  size_t a_allocated;                  /* allocated elements of a->arg */
+  const CHAR_T *cp = format;            /* pointer into format */
+  size_t arg_posn = 0;          /* number of regular arguments consumed */
+  size_t d_allocated;                   /* allocated elements of d->dir */
+  size_t a_allocated;                   /* allocated elements of a->arg */
   size_t max_width_length = 0;
   size_t max_precision_length = 0;
 
@@ -99,501 +99,501 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
   a->arg = NULL;
 
 #define REGISTER_ARG(_index_,_type_) \
-  {                                                                    \
-    size_t n = (_index_);                                              \
-    if (n >= a_allocated)                                              \
-      {                                                                        \
-       size_t memory_size;                                             \
-       argument *memory;                                               \
-                                                                       \
-       a_allocated = xtimes (a_allocated, 2);                          \
-       if (a_allocated <= n)                                           \
-         a_allocated = xsum (n, 1);                                    \
-       memory_size = xtimes (a_allocated, sizeof (argument));          \
-       if (size_overflow_p (memory_size))                              \
-         /* Overflow, would lead to out of memory.  */                 \
-         goto out_of_memory;                                           \
-       memory = (argument *) (a->arg                                   \
-                              ? realloc (a->arg, memory_size)          \
-                              : malloc (memory_size));                 \
-       if (memory == NULL)                                             \
-         /* Out of memory.  */                                         \
-         goto out_of_memory;                                           \
-       a->arg = memory;                                                \
-      }                                                                        \
-    while (a->count <= n)                                              \
-      a->arg[a->count++].type = TYPE_NONE;                             \
-    if (a->arg[n].type == TYPE_NONE)                                   \
-      a->arg[n].type = (_type_);                                       \
-    else if (a->arg[n].type != (_type_))                               \
-      /* Ambiguous type for positional argument.  */                   \
-      goto error;                                                      \
+  {                                                                     \
+    size_t n = (_index_);                                               \
+    if (n >= a_allocated)                                               \
+      {                                                                 \
+        size_t memory_size;                                             \
+        argument *memory;                                               \
+                                                                        \
+        a_allocated = xtimes (a_allocated, 2);                          \
+        if (a_allocated <= n)                                           \
+          a_allocated = xsum (n, 1);                                    \
+        memory_size = xtimes (a_allocated, sizeof (argument));          \
+        if (size_overflow_p (memory_size))                              \
+          /* Overflow, would lead to out of memory.  */                 \
+          goto out_of_memory;                                           \
+        memory = (argument *) (a->arg                                   \
+                               ? realloc (a->arg, memory_size)          \
+                               : malloc (memory_size));                 \
+        if (memory == NULL)                                             \
+          /* Out of memory.  */                                         \
+          goto out_of_memory;                                           \
+        a->arg = memory;                                                \
+      }                                                                 \
+    while (a->count <= n)                                               \
+      a->arg[a->count++].type = TYPE_NONE;                              \
+    if (a->arg[n].type == TYPE_NONE)                                    \
+      a->arg[n].type = (_type_);                                        \
+    else if (a->arg[n].type != (_type_))                                \
+      /* Ambiguous type for positional argument.  */                    \
+      goto error;                                                       \
   }
 
   while (*cp != '\0')
     {
       CHAR_T c = *cp++;
       if (c == '%')
-       {
-         size_t arg_index = ARG_NONE;
-         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
-
-         /* Initialize the next directive.  */
-         dp->dir_start = cp - 1;
-         dp->flags = 0;
-         dp->width_start = NULL;
-         dp->width_end = NULL;
-         dp->width_arg_index = ARG_NONE;
-         dp->precision_start = NULL;
-         dp->precision_end = NULL;
-         dp->precision_arg_index = ARG_NONE;
-         dp->arg_index = ARG_NONE;
-
-         /* Test for positional argument.  */
-         if (*cp >= '0' && *cp <= '9')
-           {
-             const CHAR_T *np;
-
-             for (np = cp; *np >= '0' && *np <= '9'; np++)
-               ;
-             if (*np == '$')
-               {
-                 size_t n = 0;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   n = xsum (xtimes (n, 10), *np - '0');
-                 if (n == 0)
-                   /* Positional argument 0.  */
-                   goto error;
-                 if (size_overflow_p (n))
-                   /* n too large, would lead to out of memory later.  */
-                   goto error;
-                 arg_index = n - 1;
-                 cp = np + 1;
-               }
-           }
-
-         /* Read the flags.  */
-         for (;;)
-           {
-             if (*cp == '\'')
-               {
-                 dp->flags |= FLAG_GROUP;
-                 cp++;
-               }
-             else if (*cp == '-')
-               {
-                 dp->flags |= FLAG_LEFT;
-                 cp++;
-               }
-             else if (*cp == '+')
-               {
-                 dp->flags |= FLAG_SHOWSIGN;
-                 cp++;
-               }
-             else if (*cp == ' ')
-               {
-                 dp->flags |= FLAG_SPACE;
-                 cp++;
-               }
-             else if (*cp == '#')
-               {
-                 dp->flags |= FLAG_ALT;
-                 cp++;
-               }
-             else if (*cp == '0')
-               {
-                 dp->flags |= FLAG_ZERO;
-                 cp++;
-               }
-             else
-               break;
-           }
-
-         /* Parse the field width.  */
-         if (*cp == '*')
-           {
-             dp->width_start = cp;
-             cp++;
-             dp->width_end = cp;
-             if (max_width_length < 1)
-               max_width_length = 1;
-
-             /* Test for positional argument.  */
-             if (*cp >= '0' && *cp <= '9')
-               {
-                 const CHAR_T *np;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   ;
-                 if (*np == '$')
-                   {
-                     size_t n = 0;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       n = xsum (xtimes (n, 10), *np - '0');
-                     if (n == 0)
-                       /* Positional argument 0.  */
-                       goto error;
-                     if (size_overflow_p (n))
-                       /* n too large, would lead to out of memory later.  */
-                       goto error;
-                     dp->width_arg_index = n - 1;
-                     cp = np + 1;
-                   }
-               }
-             if (dp->width_arg_index == ARG_NONE)
-               {
-                 dp->width_arg_index = arg_posn++;
-                 if (dp->width_arg_index == ARG_NONE)
-                   /* arg_posn wrapped around.  */
-                   goto error;
-               }
-             REGISTER_ARG (dp->width_arg_index, TYPE_INT);
-           }
-         else if (*cp >= '0' && *cp <= '9')
-           {
-             size_t width_length;
-
-             dp->width_start = cp;
-             for (; *cp >= '0' && *cp <= '9'; cp++)
-               ;
-             dp->width_end = cp;
-             width_length = dp->width_end - dp->width_start;
-             if (max_width_length < width_length)
-               max_width_length = width_length;
-           }
-
-         /* Parse the precision.  */
-         if (*cp == '.')
-           {
-             cp++;
-             if (*cp == '*')
-               {
-                 dp->precision_start = cp - 1;
-                 cp++;
-                 dp->precision_end = cp;
-                 if (max_precision_length < 2)
-                   max_precision_length = 2;
-
-                 /* Test for positional argument.  */
-                 if (*cp >= '0' && *cp <= '9')
-                   {
-                     const CHAR_T *np;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       ;
-                     if (*np == '$')
-                       {
-                         size_t n = 0;
-
-                         for (np = cp; *np >= '0' && *np <= '9'; np++)
-                           n = xsum (xtimes (n, 10), *np - '0');
-                         if (n == 0)
-                           /* Positional argument 0.  */
-                           goto error;
-                         if (size_overflow_p (n))
-                           /* n too large, would lead to out of memory
-                              later.  */
-                           goto error;
-                         dp->precision_arg_index = n - 1;
-                         cp = np + 1;
-                       }
-                   }
-                 if (dp->precision_arg_index == ARG_NONE)
-                   {
-                     dp->precision_arg_index = arg_posn++;
-                     if (dp->precision_arg_index == ARG_NONE)
-                       /* arg_posn wrapped around.  */
-                       goto error;
-                   }
-                 REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
-               }
-             else
-               {
-                 size_t precision_length;
-
-                 dp->precision_start = cp - 1;
-                 for (; *cp >= '0' && *cp <= '9'; cp++)
-                   ;
-                 dp->precision_end = cp;
-                 precision_length = dp->precision_end - dp->precision_start;
-                 if (max_precision_length < precision_length)
-                   max_precision_length = precision_length;
-               }
-           }
-
-         {
-           arg_type type;
-
-           /* Parse argument type/size specifiers.  */
-           {
-             int flags = 0;
-
-             for (;;)
-               {
-                 if (*cp == 'h')
-                   {
-                     flags |= (1 << (flags & 1));
-                     cp++;
-                   }
-                 else if (*cp == 'L')
-                   {
-                     flags |= 4;
-                     cp++;
-                   }
-                 else if (*cp == 'l')
-                   {
-                     flags += 8;
-                     cp++;
-                   }
-                 else if (*cp == 'j')
-                   {
-                     if (sizeof (intmax_t) > sizeof (long))
-                       {
-                         /* intmax_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (intmax_t) > sizeof (int))
-                       {
-                         /* intmax_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 'z' || *cp == 'Z')
-                   {
-                     /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
-                        because the warning facility in gcc-2.95.2 understands
-                        only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
-                     if (sizeof (size_t) > sizeof (long))
-                       {
-                         /* size_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (size_t) > sizeof (int))
-                       {
-                         /* size_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 't')
-                   {
-                     if (sizeof (ptrdiff_t) > sizeof (long))
-                       {
-                         /* ptrdiff_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (ptrdiff_t) > sizeof (int))
-                       {
-                         /* ptrdiff_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+        {
+          size_t arg_index = ARG_NONE;
+          DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
+
+          /* Initialize the next directive.  */
+          dp->dir_start = cp - 1;
+          dp->flags = 0;
+          dp->width_start = NULL;
+          dp->width_end = NULL;
+          dp->width_arg_index = ARG_NONE;
+          dp->precision_start = NULL;
+          dp->precision_end = NULL;
+          dp->precision_arg_index = ARG_NONE;
+          dp->arg_index = ARG_NONE;
+
+          /* Test for positional argument.  */
+          if (*cp >= '0' && *cp <= '9')
+            {
+              const CHAR_T *np;
+
+              for (np = cp; *np >= '0' && *np <= '9'; np++)
+                ;
+              if (*np == '$')
+                {
+                  size_t n = 0;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    n = xsum (xtimes (n, 10), *np - '0');
+                  if (n == 0)
+                    /* Positional argument 0.  */
+                    goto error;
+                  if (size_overflow_p (n))
+                    /* n too large, would lead to out of memory later.  */
+                    goto error;
+                  arg_index = n - 1;
+                  cp = np + 1;
+                }
+            }
+
+          /* Read the flags.  */
+          for (;;)
+            {
+              if (*cp == '\'')
+                {
+                  dp->flags |= FLAG_GROUP;
+                  cp++;
+                }
+              else if (*cp == '-')
+                {
+                  dp->flags |= FLAG_LEFT;
+                  cp++;
+                }
+              else if (*cp == '+')
+                {
+                  dp->flags |= FLAG_SHOWSIGN;
+                  cp++;
+                }
+              else if (*cp == ' ')
+                {
+                  dp->flags |= FLAG_SPACE;
+                  cp++;
+                }
+              else if (*cp == '#')
+                {
+                  dp->flags |= FLAG_ALT;
+                  cp++;
+                }
+              else if (*cp == '0')
+                {
+                  dp->flags |= FLAG_ZERO;
+                  cp++;
+                }
+              else
+                break;
+            }
+
+          /* Parse the field width.  */
+          if (*cp == '*')
+            {
+              dp->width_start = cp;
+              cp++;
+              dp->width_end = cp;
+              if (max_width_length < 1)
+                max_width_length = 1;
+
+              /* Test for positional argument.  */
+              if (*cp >= '0' && *cp <= '9')
+                {
+                  const CHAR_T *np;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    ;
+                  if (*np == '$')
+                    {
+                      size_t n = 0;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        n = xsum (xtimes (n, 10), *np - '0');
+                      if (n == 0)
+                        /* Positional argument 0.  */
+                        goto error;
+                      if (size_overflow_p (n))
+                        /* n too large, would lead to out of memory later.  */
+                        goto error;
+                      dp->width_arg_index = n - 1;
+                      cp = np + 1;
+                    }
+                }
+              if (dp->width_arg_index == ARG_NONE)
+                {
+                  dp->width_arg_index = arg_posn++;
+                  if (dp->width_arg_index == ARG_NONE)
+                    /* arg_posn wrapped around.  */
+                    goto error;
+                }
+              REGISTER_ARG (dp->width_arg_index, TYPE_INT);
+            }
+          else if (*cp >= '0' && *cp <= '9')
+            {
+              size_t width_length;
+
+              dp->width_start = cp;
+              for (; *cp >= '0' && *cp <= '9'; cp++)
+                ;
+              dp->width_end = cp;
+              width_length = dp->width_end - dp->width_start;
+              if (max_width_length < width_length)
+                max_width_length = width_length;
+            }
+
+          /* Parse the precision.  */
+          if (*cp == '.')
+            {
+              cp++;
+              if (*cp == '*')
+                {
+                  dp->precision_start = cp - 1;
+                  cp++;
+                  dp->precision_end = cp;
+                  if (max_precision_length < 2)
+                    max_precision_length = 2;
+
+                  /* Test for positional argument.  */
+                  if (*cp >= '0' && *cp <= '9')
+                    {
+                      const CHAR_T *np;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        ;
+                      if (*np == '$')
+                        {
+                          size_t n = 0;
+
+                          for (np = cp; *np >= '0' && *np <= '9'; np++)
+                            n = xsum (xtimes (n, 10), *np - '0');
+                          if (n == 0)
+                            /* Positional argument 0.  */
+                            goto error;
+                          if (size_overflow_p (n))
+                            /* n too large, would lead to out of memory
+                               later.  */
+                            goto error;
+                          dp->precision_arg_index = n - 1;
+                          cp = np + 1;
+                        }
+                    }
+                  if (dp->precision_arg_index == ARG_NONE)
+                    {
+                      dp->precision_arg_index = arg_posn++;
+                      if (dp->precision_arg_index == ARG_NONE)
+                        /* arg_posn wrapped around.  */
+                        goto error;
+                    }
+                  REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
+                }
+              else
+                {
+                  size_t precision_length;
+
+                  dp->precision_start = cp - 1;
+                  for (; *cp >= '0' && *cp <= '9'; cp++)
+                    ;
+                  dp->precision_end = cp;
+                  precision_length = dp->precision_end - dp->precision_start;
+                  if (max_precision_length < precision_length)
+                    max_precision_length = precision_length;
+                }
+            }
+
+          {
+            arg_type type;
+
+            /* Parse argument type/size specifiers.  */
+            {
+              int flags = 0;
+
+              for (;;)
+                {
+                  if (*cp == 'h')
+                    {
+                      flags |= (1 << (flags & 1));
+                      cp++;
+                    }
+                  else if (*cp == 'L')
+                    {
+                      flags |= 4;
+                      cp++;
+                    }
+                  else if (*cp == 'l')
+                    {
+                      flags += 8;
+                      cp++;
+                    }
+                  else if (*cp == 'j')
+                    {
+                      if (sizeof (intmax_t) > sizeof (long))
+                        {
+                          /* intmax_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (intmax_t) > sizeof (int))
+                        {
+                          /* intmax_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 'z' || *cp == 'Z')
+                    {
+                      /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
+                         because the warning facility in gcc-2.95.2 understands
+                         only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
+                      if (sizeof (size_t) > sizeof (long))
+                        {
+                          /* size_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (size_t) > sizeof (int))
+                        {
+                          /* size_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 't')
+                    {
+                      if (sizeof (ptrdiff_t) > sizeof (long))
+                        {
+                          /* ptrdiff_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (ptrdiff_t) > sizeof (int))
+                        {
+                          /* ptrdiff_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #if defined __APPLE__ && defined __MACH__
-                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'q')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* int64_t = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* int64_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+                  /* On MacOS X 10.3, PRIdMAX is defined as "qd".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'q')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* int64_t = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* int64_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #endif
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                 /* On native Win32, PRIdMAX is defined as "I64d".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* __int64 = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* __int64 = long */
-                         flags += 8;
-                       }
-                     cp += 3;
-                   }
+                  /* On native Win32, PRIdMAX is defined as "I64d".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* __int64 = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* __int64 = long */
+                          flags += 8;
+                        }
+                      cp += 3;
+                    }
 #endif
-                 else
-                   break;
-               }
-
-             /* Read the conversion character.  */
-             c = *cp++;
-             switch (c)
-               {
-               case 'd': case 'i':
+                  else
+                    break;
+                }
+
+              /* Read the conversion character.  */
+              c = *cp++;
+              switch (c)
+                {
+                case 'd': case 'i':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGLONGINT;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lld" into TYPE_LONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_LONGINT;
-                 else if (flags & 2)
-                   type = TYPE_SCHAR;
-                 else if (flags & 1)
-                   type = TYPE_SHORT;
-                 else
-                   type = TYPE_INT;
-                 break;
-               case 'o': case 'u': case 'x': case 'X':
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lld" into TYPE_LONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_LONGINT;
+                  else if (flags & 2)
+                    type = TYPE_SCHAR;
+                  else if (flags & 1)
+                    type = TYPE_SHORT;
+                  else
+                    type = TYPE_INT;
+                  break;
+                case 'o': case 'u': case 'x': case 'X':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_ULONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_ULONGLONGINT;
+                  else
 #endif
-                 /* If 'unsigned long long' exists and is the same as
-                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_ULONGINT;
-                 else if (flags & 2)
-                   type = TYPE_UCHAR;
-                 else if (flags & 1)
-                   type = TYPE_USHORT;
-                 else
-                   type = TYPE_UINT;
-                 break;
-               case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-               case 'a': case 'A':
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGDOUBLE;
-                 else
-                   type = TYPE_DOUBLE;
-                 break;
-               case 'c':
-                 if (flags >= 8)
+                  /* If 'unsigned long long' exists and is the same as
+                     'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_ULONGINT;
+                  else if (flags & 2)
+                    type = TYPE_UCHAR;
+                  else if (flags & 1)
+                    type = TYPE_USHORT;
+                  else
+                    type = TYPE_UINT;
+                  break;
+                case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                case 'a': case 'A':
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGDOUBLE;
+                  else
+                    type = TYPE_DOUBLE;
+                  break;
+                case 'c':
+                  if (flags >= 8)
 #if HAVE_WINT_T
-                   type = TYPE_WIDE_CHAR;
+                    type = TYPE_WIDE_CHAR;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_CHAR;
-                 break;
+                  else
+                    type = TYPE_CHAR;
+                  break;
 #if HAVE_WINT_T
-               case 'C':
-                 type = TYPE_WIDE_CHAR;
-                 c = 'c';
-                 break;
+                case 'C':
+                  type = TYPE_WIDE_CHAR;
+                  c = 'c';
+                  break;
 #endif
-               case 's':
-                 if (flags >= 8)
+                case 's':
+                  if (flags >= 8)
 #if HAVE_WCHAR_T
-                   type = TYPE_WIDE_STRING;
+                    type = TYPE_WIDE_STRING;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_STRING;
-                 break;
+                  else
+                    type = TYPE_STRING;
+                  break;
 #if HAVE_WCHAR_T
-               case 'S':
-                 type = TYPE_WIDE_STRING;
-                 c = 's';
-                 break;
+                case 'S':
+                  type = TYPE_WIDE_STRING;
+                  c = 's';
+                  break;
 #endif
-               case 'p':
-                 type = TYPE_POINTER;
-                 break;
-               case 'n':
+                case 'p':
+                  type = TYPE_POINTER;
+                  break;
+                case 'n':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_COUNT_LONGLONGINT_POINTER;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_COUNT_LONGLONGINT_POINTER;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
-                 if (flags >= 8)
-                   type = TYPE_COUNT_LONGINT_POINTER;
-                 else if (flags & 2)
-                   type = TYPE_COUNT_SCHAR_POINTER;
-                 else if (flags & 1)
-                   type = TYPE_COUNT_SHORT_POINTER;
-                 else
-                   type = TYPE_COUNT_INT_POINTER;
-                 break;
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lln" into TYPE_COUNT_LONGINT_POINTER.  */
+                  if (flags >= 8)
+                    type = TYPE_COUNT_LONGINT_POINTER;
+                  else if (flags & 2)
+                    type = TYPE_COUNT_SCHAR_POINTER;
+                  else if (flags & 1)
+                    type = TYPE_COUNT_SHORT_POINTER;
+                  else
+                    type = TYPE_COUNT_INT_POINTER;
+                  break;
 #if ENABLE_UNISTDIO
-               /* The unistdio extensions.  */
-               case 'U':
-                 if (flags >= 16)
-                   type = TYPE_U32_STRING;
-                 else if (flags >= 8)
-                   type = TYPE_U16_STRING;
-                 else
-                   type = TYPE_U8_STRING;
-                 break;
+                /* The unistdio extensions.  */
+                case 'U':
+                  if (flags >= 16)
+                    type = TYPE_U32_STRING;
+                  else if (flags >= 8)
+                    type = TYPE_U16_STRING;
+                  else
+                    type = TYPE_U8_STRING;
+                  break;
 #endif
-               case '%':
-                 type = TYPE_NONE;
-                 break;
-               default:
-                 /* Unknown conversion character.  */
-                 goto error;
-               }
-           }
-
-           if (type != TYPE_NONE)
-             {
-               dp->arg_index = arg_index;
-               if (dp->arg_index == ARG_NONE)
-                 {
-                   dp->arg_index = arg_posn++;
-                   if (dp->arg_index == ARG_NONE)
-                     /* arg_posn wrapped around.  */
-                     goto error;
-                 }
-               REGISTER_ARG (dp->arg_index, type);
-             }
-           dp->conversion = c;
-           dp->dir_end = cp;
-         }
-
-         d->count++;
-         if (d->count >= d_allocated)
-           {
-             size_t memory_size;
-             DIRECTIVE *memory;
-
-             d_allocated = xtimes (d_allocated, 2);
-             memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
-             if (size_overflow_p (memory_size))
-               /* Overflow, would lead to out of memory.  */
-               goto out_of_memory;
-             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
-             if (memory == NULL)
-               /* Out of memory.  */
-               goto out_of_memory;
-             d->dir = memory;
-           }
-       }
+                case '%':
+                  type = TYPE_NONE;
+                  break;
+                default:
+                  /* Unknown conversion character.  */
+                  goto error;
+                }
+            }
+
+            if (type != TYPE_NONE)
+              {
+                dp->arg_index = arg_index;
+                if (dp->arg_index == ARG_NONE)
+                  {
+                    dp->arg_index = arg_posn++;
+                    if (dp->arg_index == ARG_NONE)
+                      /* arg_posn wrapped around.  */
+                      goto error;
+                  }
+                REGISTER_ARG (dp->arg_index, type);
+              }
+            dp->conversion = c;
+            dp->dir_end = cp;
+          }
+
+          d->count++;
+          if (d->count >= d_allocated)
+            {
+              size_t memory_size;
+              DIRECTIVE *memory;
+
+              d_allocated = xtimes (d_allocated, 2);
+              memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
+              if (size_overflow_p (memory_size))
+                /* Overflow, would lead to out of memory.  */
+                goto out_of_memory;
+              memory = (DIRECTIVE *) realloc (d->dir, memory_size);
+              if (memory == NULL)
+                /* Out of memory.  */
+                goto out_of_memory;
+              d->dir = memory;
+            }
+        }
 #if CHAR_T_ONLY_ASCII
       else if (!c_isascii (c))
-       {
-         /* Non-ASCII character.  Not supported.  */
-         goto error;
-       }
+        {
+          /* Non-ASCII character.  Not supported.  */
+          goto error;
+        }
 #endif
     }
   d->dir[d->count].dir_start = cp;
index e5d68d758849ea134b723b87d03202a15f98838e..0f2b708209eedb792dfd8bf56848a6d899ccb781 100644 (file)
@@ -1,5 +1,6 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 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
 
 
 /* Flags */
-#define FLAG_GROUP      1      /* ' flag */
-#define FLAG_LEFT       2      /* - flag */
-#define FLAG_SHOWSIGN   4      /* + flag */
-#define FLAG_SPACE      8      /* space flag */
-#define FLAG_ALT       16      /* # flag */
-#define FLAG_ZERO      32
+#define FLAG_GROUP       1      /* ' flag */
+#define FLAG_LEFT        2      /* - flag */
+#define FLAG_SHOWSIGN    4      /* + flag */
+#define FLAG_SPACE       8      /* space flag */
+#define FLAG_ALT        16      /* # flag */
+#define FLAG_ZERO       32
 
 /* arg_index value indicating that no argument is consumed.  */
-#define ARG_NONE       (~(size_t)0)
+#define ARG_NONE        (~(size_t)0)
 
 /* xxx_directive: A parsed directive.
    xxx_directives: A parsed format string.  */
@@ -163,10 +164,10 @@ extern int
        u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
 extern int
        u16_printf_parse (const uint16_t *format, u16_directives *d,
-                        arguments *a);
+                         arguments *a);
 extern int
        u32_printf_parse (const uint32_t *format, u32_directives *d,
-                        arguments *a);
+                         arguments *a);
 #else
 # ifdef STATIC
 STATIC
index bfa374a528b9ad338beb1b65ad82f9a528c953cb..1415e6a55fe6097ca4081bdb8dacbac580fc9e06 100644 (file)
@@ -1,6 +1,6 @@
 /* Program name management.
-   Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
-   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+   Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    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
@@ -23,6 +23,8 @@
 #include "progname.h"
 
 #include <errno.h> /* get program_invocation_name declaration */
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 
@@ -30,7 +32,9 @@
    To be initialized by main().  */
 const char *program_name = NULL;
 
-/* Set program_name, based on argv[0].  */
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
 void
 set_program_name (const char *argv0)
 {
@@ -42,20 +46,30 @@ set_program_name (const char *argv0)
   const char *slash;
   const char *base;
 
+  /* Sanity check.  POSIX requires the invoking process to pass a non-NULL
+     argv[0].  */
+  if (argv0 == NULL)
+    {
+      /* It's a bug in the invoking program.  Help diagnosing it.  */
+      fputs ("A NULL argv[0] was passed through an exec system call.\n",
+             stderr);
+      abort ();
+    }
+
   slash = strrchr (argv0, '/');
   base = (slash != NULL ? slash + 1 : argv0);
   if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
     {
       argv0 = base;
       if (strncmp (base, "lt-", 3) == 0)
-       {
-         argv0 = base + 3;
-         /* On glibc systems, remove the "lt-" prefix from the variable
-            program_invocation_short_name.  */
+        {
+          argv0 = base + 3;
+          /* On glibc systems, remove the "lt-" prefix from the variable
+             program_invocation_short_name.  */
 #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
-         program_invocation_short_name = (char *) argv0;
+          program_invocation_short_name = (char *) argv0;
 #endif
-       }
+        }
     }
 
   /* But don't strip off a leading <dirname>/ in general, because when the user
index 82615c6bc05bffd10d9631f9c47b0e24ccd96b47..5ba303bd074a90b95584848b0d4f98cbe768579c 100644 (file)
@@ -1,6 +1,6 @@
 /* Program name management.
-   Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
-   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+   Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2001.
 
    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
@@ -31,7 +31,9 @@ extern "C" {
 /* String containing name the program is called with.  */
 extern const char *program_name;
 
-/* Set program_name, based on argv[0].  */
+/* Set program_name, based on argv[0].
+   argv0 must be a string allocated with indefinite extent, and must not be
+   modified after this call.  */
 extern void set_program_name (const char *argv0);
 
 #if ENABLE_RELOCATABLE
@@ -39,8 +41,8 @@ extern void set_program_name (const char *argv0);
 /* Set program_name, based on argv[0], and original installation prefix and
    directory, for relocatability.  */
 extern void set_program_name_and_installdir (const char *argv0,
-                                            const char *orig_installprefix,
-                                            const char *orig_installdir);
+                                             const char *orig_installprefix,
+                                             const char *orig_installdir);
 #undef set_program_name
 #define set_program_name(ARG0) \
   set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
index 0997b2e38739de9c3b9cbc69ab052efc19bbc35d..cc82bab98c1c59e57a163aa9d5d811a328314e5c 100644 (file)
@@ -1,5 +1,5 @@
 /* read-file.c -- read file contents into a string
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Bruno Haible.
 
    This program is free software; you can redistribute it and/or modify
@@ -45,36 +45,36 @@ fread_file (FILE * stream, size_t * length)
       size_t requested;
 
       if (size + BUFSIZ + 1 > alloc)
-       {
-         char *new_buf;
+        {
+          char *new_buf;
 
-         alloc += alloc / 2;
-         if (alloc < size + BUFSIZ + 1)
-           alloc = size + BUFSIZ + 1;
+          alloc += alloc / 2;
+          if (alloc < size + BUFSIZ + 1)
+            alloc = size + BUFSIZ + 1;
 
-         new_buf = realloc (buf, alloc);
-         if (!new_buf)
-           {
-             save_errno = errno;
-             break;
-           }
+          new_buf = realloc (buf, alloc);
+          if (!new_buf)
+            {
+              save_errno = errno;
+              break;
+            }
 
-         buf = new_buf;
-       }
+          buf = new_buf;
+        }
 
       requested = alloc - size - 1;
       count = fread (buf + size, 1, requested, stream);
       size += count;
 
       if (count != requested)
-       {
-         save_errno = errno;
-         if (ferror (stream))
-           break;
-         buf[size] = '\0';
-         *length = size;
-         return buf;
-       }
+        {
+          save_errno = errno;
+          if (ferror (stream))
+            break;
+          buf[size] = '\0';
+          *length = size;
+          return buf;
+        }
     }
 
   free (buf);
@@ -99,10 +99,10 @@ internal_read_file (const char *filename, size_t * length, const char *mode)
   if (fclose (stream) != 0)
     {
       if (out)
-       {
-         save_errno = errno;
-         free (out);
-       }
+        {
+          save_errno = errno;
+          free (out);
+        }
       errno = save_errno;
       return NULL;
     }
index c37804026a665c2e98cc0e5abce318bad2ade838..8b6ae436cdfac5b27f81985204536b09573c3a16 100644 (file)
@@ -1,5 +1,5 @@
 /* read-file.h -- read file contents into a string
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index 4be5f3457f6e2921f12f8a18c1abdf376500fb8b..d42f29669e3ca0add8b2a2ae98b9b6101237915d 100644 (file)
@@ -1,5 +1,5 @@
 /* readline.c --- Simple implementation of readline.
-   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson
 
    This program is free software: you can redistribute it and/or modify
@@ -48,7 +48,7 @@ readline (const char *prompt)
     return NULL;
 
   while (*out && (out[strlen (out) - 1] == '\r'
-                 || out[strlen (out) - 1] == '\n'))
+                  || out[strlen (out) - 1] == '\n'))
     out[strlen (out) - 1] = '\0';
 
   return out;
index 04b3adb4784adbdf72aa10c77f6cfcb0a84cd61d..44ec0140628ae9179e6078d2e4333e078e0da4f1 100644 (file)
@@ -1,5 +1,5 @@
 /* readline.h --- Simple implementation of readline.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson
 
    This program is free software: you can redistribute it and/or modify
index b61c2ca8294d05ba5561ff0ba380d33cd5748368..36aeecc41b7203574b658edaebb6bd9975c9f737 100644 (file)
@@ -1,6 +1,7 @@
 /* realloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2010 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
@@ -71,7 +72,7 @@ rpl_realloc (void *p, size_t n)
     {
 #if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
       if (n == 0)
-       n = 1;
+        n = 1;
 #endif
       result = malloc (n);
     }
index 78c046159351e6888bcb1a6baff01966c24313a3..73e2a11d30f524bec9d784314b03a0ea86fcb698 100644 (file)
--- a/gl/recv.c
+++ b/gl/recv.c
@@ -1,6 +1,6 @@
 /* recv.c --- wrappers for Windows recv function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index bb6952ebf559a854fae1ec5abde40ef6996344c2..5536bacc25275568652ecf654f6d6d3226213377 100644 (file)
@@ -1,7 +1,7 @@
 /* Emulation for select(2)
    Contributed by Paolo Bonzini.
 
-   Copyright 2008-2009 Free Software Foundation, Inc.
+   Copyright 2008-2010 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
@@ -71,10 +71,10 @@ typedef enum _FILE_INFORMATION_CLASS {
 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
 
 typedef DWORD (WINAPI *PNtQueryInformationFile)
-        (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
+         (HANDLE, IO_STATUS_BLOCK *, VOID *, ULONG, FILE_INFORMATION_CLASS);
 
 #ifndef PIPE_BUF
-#define PIPE_BUF       512
+#define PIPE_BUF        512
 #endif
 
 #define IsConsoleHandle(h) (((long) (h) & 3) == 3)
@@ -98,7 +98,7 @@ IsSocketHandle(HANDLE h)
 
 static int
 win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits,
-                  struct bitset *xbits)
+                   struct bitset *xbits)
 {
   BOOL read, write, except;
   int i, ret;
@@ -120,78 +120,78 @@ win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits,
 
     case FILE_TYPE_PIPE:
       if (!once_only)
-       {
-         NtQueryInformationFile = (PNtQueryInformationFile)
-           GetProcAddress (GetModuleHandle ("ntdll.dll"),
-                           "NtQueryInformationFile");
-         once_only = TRUE;
-       }
+        {
+          NtQueryInformationFile = (PNtQueryInformationFile)
+            GetProcAddress (GetModuleHandle ("ntdll.dll"),
+                            "NtQueryInformationFile");
+          once_only = TRUE;
+        }
 
       if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
-       {
-         if (avail)
-           read = TRUE;
-       }
+        {
+          if (avail)
+            read = TRUE;
+        }
 
       else
-       {
-         /* It was the write-end of the pipe.  Check if it is writable.
-            If NtQueryInformationFile fails, optimistically assume the pipe is
-            writable.  This could happen on Win9x, where NtQueryInformationFile
-            is not available, or if we inherit a pipe that doesn't permit
-            FILE_READ_ATTRIBUTES access on the write end (I think this should
-            not happen since WinXP SP2; WINE seems fine too).  Otherwise,
-            ensure that enough space is available for atomic writes.  */
+        {
+          /* It was the write-end of the pipe.  Check if it is writable.
+             If NtQueryInformationFile fails, optimistically assume the pipe is
+             writable.  This could happen on Win9x, where NtQueryInformationFile
+             is not available, or if we inherit a pipe that doesn't permit
+             FILE_READ_ATTRIBUTES access on the write end (I think this should
+             not happen since WinXP SP2; WINE seems fine too).  Otherwise,
+             ensure that enough space is available for atomic writes.  */
           memset (&iosb, 0, sizeof (iosb));
           memset (&fpli, 0, sizeof (fpli));
 
           if (!NtQueryInformationFile
               || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
-                                        FilePipeLocalInformation)
-             || fpli.WriteQuotaAvailable >= PIPE_BUF
-             || (fpli.OutboundQuota < PIPE_BUF &&
-                 fpli.WriteQuotaAvailable == fpli.OutboundQuota))
-           write = TRUE;
-       }
+                                         FilePipeLocalInformation)
+              || fpli.WriteQuotaAvailable >= PIPE_BUF
+              || (fpli.OutboundQuota < PIPE_BUF &&
+                  fpli.WriteQuotaAvailable == fpli.OutboundQuota))
+            write = TRUE;
+        }
       break;
 
     case FILE_TYPE_CHAR:
       write = TRUE;
       if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1)))))
-       break;
+        break;
 
       ret = WaitForSingleObject (h, 0);
       if (ret == WAIT_OBJECT_0)
         {
-         if (!IsConsoleHandle (h))
-           {
-             read = TRUE;
-             break;
-           }
-
-         nbuffer = avail = 0;
-         bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
-
-         /* Screen buffers handles are filtered earlier.  */
-         assert (bRet);
-         if (nbuffer == 0)
-           {
-             except = TRUE;
-             break;
-           }
-
-         irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
-         bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
-         if (!bRet || avail == 0)
-           {
-             except = TRUE;
-             break;
-           }
-
-         for (i = 0; i < avail; i++)
-           if (irbuffer[i].EventType == KEY_EVENT)
-             read = TRUE;
-       }
+          if (!IsConsoleHandle (h))
+            {
+              read = TRUE;
+              break;
+            }
+
+          nbuffer = avail = 0;
+          bRet = GetNumberOfConsoleInputEvents (h, &nbuffer);
+
+          /* Screen buffers handles are filtered earlier.  */
+          assert (bRet);
+          if (nbuffer == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD));
+          bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail);
+          if (!bRet || avail == 0)
+            {
+              except = TRUE;
+              break;
+            }
+
+          for (i = 0; i < avail; i++)
+            if (irbuffer[i].EventType == KEY_EVENT)
+              read = TRUE;
+        }
       break;
 
     default:
@@ -275,10 +275,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
     for (i = 0; i < rfds->fd_count; i++)
       {
         fd = rfds->fd_array[i];
-       h = (HANDLE) _get_osfhandle (fd);
-       if (IsConsoleHandle (h)
-           && !GetNumberOfConsoleInputEvents (h, &nbuffer))
-         continue;
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && !GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
 
         rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
         anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
@@ -290,10 +290,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
     for (i = 0; i < wfds->fd_count; i++)
       {
         fd = wfds->fd_array[i];
-       h = (HANDLE) _get_osfhandle (fd);
-       if (IsConsoleHandle (h)
-           && GetNumberOfConsoleInputEvents (h, &nbuffer))
-         continue;
+        h = (HANDLE) _get_osfhandle (fd);
+        if (IsConsoleHandle (h)
+            && GetNumberOfConsoleInputEvents (h, &nbuffer))
+          continue;
 
         wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
         anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1));
@@ -322,16 +322,14 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
   /* Classify handles.  Create fd sets for sockets, poll the others. */
   for (i = 0; i < nfds; i++)
     {
-      WSANETWORKEVENTS ev;
-
       if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-       continue;
+        continue;
 
       h = (HANDLE) _get_osfhandle (i);
       if (!h)
         {
-         errno = EBADF;
-         return -1;
+          errno = EBADF;
+          return -1;
         }
 
       if (IsSocketHandle (h))
@@ -339,37 +337,37 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
           int requested = FD_CLOSE;
 
           /* See above; socket handles are mapped onto select, but we
-            need to map descriptors to handles.  */
+             need to map descriptors to handles.  */
           if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_READ | FD_ACCEPT;
-             FD_SET ((SOCKET) h, rfds);
-             FD_SET ((SOCKET) h, &handle_rfds);
-           }
+              FD_SET ((SOCKET) h, rfds);
+              FD_SET ((SOCKET) h, &handle_rfds);
+            }
           if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_WRITE | FD_CONNECT;
-             FD_SET ((SOCKET) h, wfds);
-             FD_SET ((SOCKET) h, &handle_wfds);
-           }
+              FD_SET ((SOCKET) h, wfds);
+              FD_SET ((SOCKET) h, &handle_wfds);
+            }
           if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
-           {
+            {
               requested |= FD_OOB;
-             FD_SET ((SOCKET) h, xfds);
-             FD_SET ((SOCKET) h, &handle_xfds);
-           }
+              FD_SET ((SOCKET) h, xfds);
+              FD_SET ((SOCKET) h, &handle_xfds);
+            }
 
           WSAEventSelect ((SOCKET) h, hEvent, requested);
-         nsock++;
+          nsock++;
         }
       else
         {
           handle_array[nhandles++] = h;
 
-         /* Poll now.  If we get an event, do not wait below.  */
+          /* Poll now.  If we get an event, do not wait below.  */
           if (wait_timeout != 0
-             && win32_poll_handle (h, i, &rbits, &wbits, &xbits))
-           wait_timeout = 0;
+              && win32_poll_handle (h, i, &rbits, &wbits, &xbits))
+            wait_timeout = 0;
         }
     }
 
@@ -382,12 +380,12 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
          no need to call select again.  */
       rc = select (0, &handle_rfds, &handle_wfds, &handle_xfds, &tv0);
       if (rc == 0)
-       {
-         /* Restore the fd_sets for the other select we do below.  */
+        {
+          /* Restore the fd_sets for the other select we do below.  */
           memcpy (&handle_rfds, rfds, sizeof (fd_set));
           memcpy (&handle_wfds, wfds, sizeof (fd_set));
           memcpy (&handle_xfds, xfds, sizeof (fd_set));
-       }
+        }
       else
         wait_timeout = 0;
     }
@@ -395,20 +393,20 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
   for (;;)
     {
       ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
-                                      wait_timeout, QS_ALLINPUT);
+                                       wait_timeout, QS_ALLINPUT);
 
       if (ret == WAIT_OBJECT_0 + nhandles)
-       {
+        {
           /* new input of some other kind */
-         BOOL bRet;
+          BOOL bRet;
           while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0)
             {
               TranslateMessage (&msg);
               DispatchMessage (&msg);
             }
-       }
+        }
       else
-       break;
+        break;
     }
 
   /* If we haven't done it yet, check the status of the sockets.  */
@@ -426,13 +424,13 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
   for (i = 0; i < nfds; i++)
     {
       if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0)
-       continue;
+        continue;
 
       h = (HANDLE) _get_osfhandle (i);
       if (h != handle_array[nhandles])
-       {
-         /* Perform handle->descriptor mapping.  Don't update rc, as these
-            results are counted in the return value of Winsock's select.  */
+        {
+          /* Perform handle->descriptor mapping.  Don't update rc, as these
+             results are counted in the return value of Winsock's select.  */
           WSAEventSelect ((SOCKET) h, NULL, 0);
           if (FD_ISSET (h, &handle_rfds))
             FD_SET (i, rfds);
@@ -440,7 +438,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
             FD_SET (i, wfds);
           if (FD_ISSET (h, &handle_xfds))
             FD_SET (i, xfds);
-       }
+        }
       else
         {
           /* Not a socket.  */
@@ -448,19 +446,19 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
           win32_poll_handle (h, i, &rbits, &wbits, &xbits);
           if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, rfds);
-           }
+              rc++;
+              FD_SET (i, rfds);
+            }
           if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, wfds);
-           }
+              rc++;
+              FD_SET (i, wfds);
+            }
           if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))))
             {
-             rc++;
-             FD_SET (i, xfds);
-           }
+              rc++;
+              FD_SET (i, xfds);
+            }
         }
     }
 
index 4d2ca16c9f647fa5224b7d6dd879b1494b7dd121..83e2e8e6e847dbc61f7280d2c54bcb89557f867c 100644 (file)
--- a/gl/send.c
+++ b/gl/send.c
@@ -1,6 +1,6 @@
 /* send.c --- wrappers for Windows send function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 96a00cc2e7492e19265eae172e6175fc0befb53a..24a8d6e5bf136c03073a616e6f0ed25e7e5bf8c2 100644 (file)
@@ -1,6 +1,6 @@
 /* setsockopt.c --- wrappers for Windows setsockopt function
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
@@ -41,7 +41,8 @@ rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t op
     {
       const struct timeval *tv = optval;
       int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
-      r = setsockopt (sock, level, optname, &milliseconds, sizeof (int));
+      optval = &milliseconds;
+      r = setsockopt (sock, level, optname, optval, sizeof (int));
     }
   else
     {
index 290d70616e2d52f976b8c0a6d67cf94a6886bc73..251c890180409c046efb172e055d111d8ab35bc8 100644 (file)
@@ -1,6 +1,6 @@
 /* shutdown.c --- wrappers for Windows shutdown function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 2ccc5f08624ca8fe0b086237bdc7a2b1cd112376..56d5a9b1c58e3d235ad8ac0d20d28b7fb8806e14 100644 (file)
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index dafbda81682a7637d172f7345f43879601d09bbc..810ca14bc9e99c5fde7b985e2f6aa5f73bfa9914 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
@@ -53,11 +53,11 @@ snprintf (char *str, size_t size, const char *format, ...)
   if (output != str)
     {
       if (size)
-       {
-         size_t pruned_len = (len < size ? len : size - 1);
-         memcpy (str, output, pruned_len);
-         str[pruned_len] = '\0';
-       }
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
 
       free (output);
     }
index 8ce4bae8db6a5aee728b1689b29ebe032e7d2669..63e0aaea6e417295bdde6ed51ff9c5d45fd7357f 100644 (file)
@@ -1,6 +1,6 @@
 /* socket.c --- wrappers for Windows socket function
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
index cb169f8864b7ab6bcdec16a74a738ff7da915fc5..b946c7e63deca8440e6816abe4000cddeea381bc 100644 (file)
@@ -1,6 +1,6 @@
 /* sockets.c --- wrappers for Windows socket functions
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
@@ -46,21 +46,21 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
     {
       /* fd refers to a socket.  */
       /* FIXME: other applications, like squid, use an undocumented
-        _free_osfhnd free function.  But this is not enough: The 'osfile'
-        flags for fd also needs to be cleared, but it is hard to access it.
-        Instead, here we just close twice the file descriptor.  */
+         _free_osfhnd free function.  But this is not enough: The 'osfile'
+         flags for fd also needs to be cleared, but it is hard to access it.
+         Instead, here we just close twice the file descriptor.  */
       if (closesocket (sock))
-       {
-         set_winsock_errno ();
-         return -1;
-       }
+        {
+          set_winsock_errno ();
+          return -1;
+        }
       else
-       {
-         /* This call frees the file descriptor and does a
-            CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
-         _close (fd);
-         return 0;
-       }
+        {
+          /* This call frees the file descriptor and does a
+             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
+          _close (fd);
+          return 0;
+        }
     }
   else
     /* Some other type of file descriptor.  */
@@ -74,7 +74,7 @@ static int initialized_sockets_version /* = 0 */;
 #endif /* WINDOWS_SOCKETS */
 
 int
-gl_sockets_startup (int version _UNUSED_PARAMETER_)
+gl_sockets_startup (int version _GL_UNUSED)
 {
 #if WINDOWS_SOCKETS
   if (version > initialized_sockets_version)
@@ -84,13 +84,13 @@ gl_sockets_startup (int version _UNUSED_PARAMETER_)
 
       err = WSAStartup (version, &data);
       if (err != 0)
-       return 1;
+        return 1;
 
       if (data.wVersion < version)
-       return 2;
+        return 2;
 
       if (initialized_sockets_version == 0)
-       register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
 
       initialized_sockets_version = version;
     }
index b42e368d2180a45efc1af884402bd04500618311..921bf6f793893126ef869a1e0d58f65c8502f897 100644 (file)
@@ -1,6 +1,6 @@
 /* sockets.h - wrappers for Windows socket functions
 
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 186a4951508d6f4fffa8f86eca12cb59f760c48b..3e0c49d1cbb606bf3273fa1aa9f739710eef4007 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <stdarg.h>.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index cffa0ab2a37fd56c9d9ccb5ea519a85f59709f67..e2312ecb80af9e7c78f3b094aec9612c5f5a4753 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2010 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
index aff3b94c0fad7a890866d2dbf2b72c330f7448ff..08778a2336d55dbaf6560819907823f263b95e51 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index 53aa34a870e4fe38b329d2a5fc578ea1d7dcb14b..3fb87d51430f2e8f751efc133bf552ae50663db8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
    : /* The expression for the unsigned case.  The subtraction of (signed) \
-       is a nop in the unsigned case and avoids "signed integer overflow" \
-       warnings in the signed case.  */ \
+        is a nop in the unsigned case and avoids "signed integer overflow" \
+        warnings in the signed case.  */ \
      ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 /* 7.18.1.1. Exact-width integer types */
@@ -454,10 +454,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
 #undef SIG_ATOMIC_MAX
 #define SIG_ATOMIC_MIN  \
    _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 #define SIG_ATOMIC_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 
 
 /* size_t limit */
index c803e88c97cd0f6f5bca3d41040422289c46d7f5..7d719efe1b4fcfae109ccfcafb972236a63b1b36 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation details of FILE streams.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 # if defined __DragonFly__          /* DragonFly */
   /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.  */
 #  define fp_ ((struct { struct __FILE_public pub; \
-                        struct { unsigned char *_base; int _size; } _bf; \
-                        void *cookie; \
-                        void *_close; \
-                        void *_read; \
-                        void *_seek; \
-                        void *_write; \
-                        struct { unsigned char *_base; int _size; } _ub; \
-                        int _ur; \
-                        unsigned char _ubuf[3]; \
-                        unsigned char _nbuf[1]; \
-                        struct { unsigned char *_base; int _size; } _lb; \
-                        int _blksize; \
-                        fpos_t _offset; \
-                        /* More fields, not relevant here.  */ \
-                      } *) fp)
+                         struct { unsigned char *_base; int _size; } _bf; \
+                         void *cookie; \
+                         void *_close; \
+                         void *_read; \
+                         void *_seek; \
+                         void *_write; \
+                         struct { unsigned char *_base; int _size; } _ub; \
+                         int _ur; \
+                         unsigned char _ubuf[3]; \
+                         unsigned char _nbuf[1]; \
+                         struct { unsigned char *_base; int _size; } _lb; \
+                         int _blksize; \
+                         fpos_t _offset; \
+                         /* More fields, not relevant here.  */ \
+                       } *) fp)
   /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.  */
 #  define _p pub._p
 #  define _flags pub._flags
 
 # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
 #  define fp_ ((struct { unsigned char *_ptr; \
-                        unsigned char *_base; \
-                        unsigned char *_end; \
-                        long _cnt; \
-                        int _file; \
-                        unsigned int _flag; \
-                      } *) fp)
+                         unsigned char *_base; \
+                         unsigned char *_end; \
+                         long _cnt; \
+                         int _file; \
+                         unsigned int _flag; \
+                       } *) fp)
 # else
 #  define fp_ fp
 # endif
index 15cc5ed742c9bf15996a105c388ccf9145d2d030..f7da9e420bf3ac8b6dce83bf92fb82e6a8fc3ee4 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX compatible FILE stream write function.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
 #  include <windows.h>
 
 #  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
-  if (ferror (stream))                                                       \
-    return (EXPRESSION);                                                     \
-  else                                                                       \
-    {                                                                        \
-      RETTYPE ret;                                                           \
-      SetLastError (0);                                                              \
-      ret = (EXPRESSION);                                                    \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      SetLastError (0);                                                       \
+      ret = (EXPRESSION);                                                     \
       if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
-       {                                                                     \
-         int fd = fileno (stream);                                           \
-         if (fd >= 0                                                         \
-             && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
-           {                                                                 \
-             /* Try to raise signal SIGPIPE.  */                             \
-             raise (SIGPIPE);                                                \
-             /* If it is currently blocked or ignored, change errno from     \
-                EINVAL to EPIPE.  */                                         \
-             errno = EPIPE;                                                  \
-           }                                                                 \
-       }                                                                     \
-      return ret;                                                            \
+        {                                                                     \
+          int fd = fileno (stream);                                           \
+          if (fd >= 0                                                         \
+              && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
+            {                                                                 \
+              /* Try to raise signal SIGPIPE.  */                             \
+              raise (SIGPIPE);                                                \
+              /* If it is currently blocked or ignored, change errno from     \
+                 EINVAL to EPIPE.  */                                         \
+              errno = EPIPE;                                                  \
+            }                                                                 \
+        }                                                                     \
+      return ret;                                                             \
     }
 
 #  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
index ee53703826c8163ffeef09737640995306c43518..6b72c39cb7773fb25478644ee5b855bb39619f23 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2010 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
 #ifndef _GL_STDIO_H
 #define _GL_STDIO_H
 
+/* Get va_list.  Needed on many systems, including glibc 2.8.  */
 #include <stdarg.h>
+
 #include <stddef.h>
 
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
-  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
-/* Get off_t and ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
+#include <sys/types.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -74,29 +72,27 @@ extern "C" {
 # endif
 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
 extern int dprintf (int fd, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf(d,f,a) \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf (d, f, a))
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_FCLOSE@
 # if @REPLACE_FCLOSE@
 #  define fclose rpl_fclose
   /* Close STREAM and its underlying file descriptor.  */
-extern int fclose (FILE *stream);
+extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -112,44 +108,49 @@ extern int fclose (FILE *stream);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
 #endif
 
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning.  Assume it is
+   always declared, since it is required by C89.  */
+#undef gets
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #  undef fopen
 #  define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode);
+extern FILE * fopen (const char *filename, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
 #endif
 
 #if @GNULIB_FPRINTF_POSIX@
 # if @REPLACE_FPRINTF@
 #  define fprintf rpl_fprintf
 extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define fprintf rpl_fprintf
 extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_FPURGE@
@@ -163,134 +164,179 @@ extern int fprintf (FILE *fp, const char *format, ...)
      was before the write calls.  When discarding pending input, the file
      position is advanced to match the end of the previously read input.
      Return 0 if successful.  Upon error, return -1 and set errno.  */
-  extern int fpurge (FILE *gl_stream);
+  extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #endif
 
 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fputc
 # define fputc rpl_fputc
-extern int fputc (int c, FILE *stream);
+extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
 #endif
 
 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fputs
 # define fputs rpl_fputs
-extern int fputs (const char *string, FILE *stream);
+extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
 #  undef freopen
 #  define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
-#endif
-
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      rpl_fseek (f, o, w))
-# else
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module freopen for portability");
+#endif
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+
+   Most gnulib clients that perform stream operations should fall into
+   category three.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  undef fseek
 #  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef fseek
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseek (f, o, w))
+extern int fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FSEEKO@
+# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
+# endif
 # if @REPLACE_FSEEKO@
 /* Provide fseek, fseeko functions that are aware of a preceding
    fflush(), and which detect pipes.  */
+#  undef fseeko
 #  define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence);
+extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FSEEK@
 #   undef fseek
-#   define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseeko (f, o, w))
+#   define fseek rpl_fseek
+static inline int _GL_ARG_NONNULL ((1))
+rpl_fseek (FILE *fp, long offset, int whence)
+{
+  return fseeko (fp, offset, whence);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
 # undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
 #endif
 
-#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
+#endif
+
+/* See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
 # endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef ftell
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftell (f))
+# if @REPLACE_FTELL@
+#  undef ftell
+#  define ftell rpl_ftell
+extern long ftell (FILE *fp) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FTELLO@
+# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
+# endif
 # if @REPLACE_FTELLO@
+#  undef ftello
 #  define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
+extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FTELL@
 #   undef ftell
-#   define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftello (f))
+#   define ftell rpl_ftell
+static inline long _GL_ARG_NONNULL ((1))
+rpl_ftell (FILE *f)
+{
+  return ftello (f);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
 # undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
+#endif
+
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
 #endif
 
 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fwrite
 # define fwrite rpl_fwrite
-extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+     _GL_ARG_NONNULL ((1, 4));
 #endif
 
 #if @GNULIB_GETDELIM@
@@ -302,14 +348,15 @@ extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
-                        FILE *stream);
+                         FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                      \
-  (GL_LINK_WARNING ("getdelim is unportable - "                            \
-                   "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLINE@
@@ -324,14 +371,15 @@ extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
    bytes of space.  It is realloc'd as necessary.
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
-extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                              \
-  (GL_LINK_WARNING ("getline is unportable - "                         \
-                   "use gnulib module getline for portability"),       \
-   getline (l, s, f))
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
 #endif
 
 #if @GNULIB_OBSTACK_PRINTF@
@@ -347,10 +395,10 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
      memory allocation error, call obstack_alloc_failed_handler.  Upon
      other error, return -1.  */
   extern int obstack_printf (struct obstack *obs, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
   extern int obstack_vprintf (struct obstack *obs, const char *format,
-                             va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
+                              va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
 # endif
 #endif
 
@@ -364,24 +412,24 @@ extern void perror (const char *string);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
 #if @GNULIB_POPEN@
 # if @REPLACE_POPEN@
 #  undef popen
 #  define popen rpl_popen
-extern FILE *popen (const char *cmd, const char *mode);
+extern FILE *popen (const char *cmd, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef popen
-# define popen(c,m) \
-   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
-                     "use gnulib module popen or pipe for more portability"), \
-    popen (c, m))
+# 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
 
 #if @GNULIB_PRINTF_POSIX@
@@ -389,33 +437,25 @@ extern FILE *popen (const char *cmd, const char *mode);
 /* Don't break __attribute__((format(printf,M,N))).  */
 #  define printf __printf__
 extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 # endif
 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 /* Don't break __attribute__((format(printf,M,N))).  */
 # define printf __printf__
 extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef putc
 # define putc rpl_fputc
-extern int putc (int c, FILE *stream);
+extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
 #endif
 
 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -427,35 +467,34 @@ extern int putchar (int c);
 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef puts
 # define puts rpl_puts
-extern int puts (const char *string);
+extern int puts (const char *string) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
 #  undef remove
 #  define remove rpl_remove
-extern int remove (const char *name);
+extern int remove (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef remove
-# define remove(n)                                        \
-   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
-                     "use gnulib module remove for more portability"), \
-    remove (n))
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
 #endif
 
 #if @GNULIB_RENAME@
 # if @REPLACE_RENAME@
 #  undef rename
 #  define rename rpl_rename
-extern int rename (const char *old, const char *new);
+extern int rename (const char *old_filename, const char *new_filename)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rename
-# define rename(o,n)                                      \
-   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
-                     "use gnulib module rename for more portability"), \
-    rename (o, n))
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
 #if @GNULIB_RENAMEAT@
@@ -464,14 +503,15 @@ extern int rename (const char *old, const char *new);
 #  define renameat rpl_renameat
 # endif
 # if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
-extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
+extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
+     _GL_ARG_NONNULL ((2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef renameat
-# define renameat(d1,f1,d2,f2)            \
-    (GL_LINK_WARNING ("renameat is not portable - " \
-                      "use gnulib module renameat for portability"), \
-     renameat (d1, f1, d2, f2))
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
@@ -480,29 +520,39 @@ extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
 # endif
 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
 extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
+       __attribute__ ((__format__ (__printf__, 3, 4)))
+       _GL_ARG_NONNULL ((3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #endif
 
+/* Some people would argue that sprintf should be handled like gets
+   (for example, OpenBSD issues a link warning for both functions),
+   since both can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
+
 #if @GNULIB_SPRINTF_POSIX@
 # if @REPLACE_SPRINTF@
 #  define sprintf rpl_sprintf
 extern int sprintf (char *str, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VASPRINTF@
@@ -516,9 +566,9 @@ extern int sprintf (char *str, const char *format, ...)
      *RESULT and return the number of resulting bytes, excluding the trailing
      NUL.  Upon memory allocation error, or some other error, return -1.  */
   extern int asprintf (char **result, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
   extern int vasprintf (char **result, const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
 # endif
 #endif
 
@@ -528,52 +578,52 @@ extern int sprintf (char *str, const char *format, ...)
 # endif
 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
 extern int vdprintf (int fd, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VFPRINTF_POSIX@
 # if @REPLACE_VFPRINTF@
 #  define vfprintf rpl_vfprintf
 extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define vfprintf rpl_vfprintf
 extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #if @GNULIB_VPRINTF_POSIX@
 # if @REPLACE_VPRINTF@
 #  define vprintf rpl_vprintf
 extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 # endif
 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define vprintf rpl_vprintf
 extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VSNPRINTF@
@@ -582,29 +632,30 @@ extern int vprintf (const char *format, va_list args)
 # endif
 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
+       __attribute__ ((__format__ (__printf__, 3, 0)))
+       _GL_ARG_NONNULL ((3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VSPRINTF_POSIX@
 # if @REPLACE_VSPRINTF@
 #  define vsprintf rpl_vsprintf
 extern int vsprintf (char *str, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #ifdef __cplusplus
index e2c6bbf35ed2921de889c306159cccae3d25f760..7f86496f175139d46e6bb76c567d6bda9859baf7 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2010 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
@@ -39,7 +39,7 @@
 #include <stddef.h>
 
 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
-#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
 # include <sys/loadavg.h>
 #endif
 
 # include <random.h>
 #endif
 
-#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
+#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
+    || defined GNULIB_POSIXCHECK
 # include <stdint.h>
 #endif
 
 #if !@HAVE_STRUCT_RANDOM_DATA@
 struct random_data
 {
-  int32_t *fptr;               /* Front pointer.  */
-  int32_t *rptr;               /* Rear pointer.  */
-  int32_t *state;              /* Array of state values.  */
-  int rand_type;               /* Type of random number generator.  */
-  int rand_deg;                        /* Degree of random number generator.  */
-  int rand_sep;                        /* Distance between front and rear.  */
-  int32_t *end_ptr;            /* Pointer behind state table.  */
+  int32_t *fptr;                /* Front pointer.  */
+  int32_t *rptr;                /* Rear pointer.  */
+  int32_t *state;               /* Array of state values.  */
+  int rand_type;                /* Type of random number generator.  */
+  int rand_deg;                 /* Degree of random number generator.  */
+  int rand_sep;                 /* Distance between front and rear.  */
+  int32_t *end_ptr;             /* Pointer behind state table.  */
 };
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
@@ -91,14 +101,14 @@ extern "C" {
 # if !@HAVE_ATOLL@
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
-extern long long atoll (const char *string);
+extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
@@ -109,10 +119,9 @@ extern void * calloc (size_t nmemb, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -120,14 +129,14 @@ extern void * calloc (size_t nmemb, size_t size);
 #  define canonicalize_file_name rpl_canonicalize_file_name
 # endif
 # if !@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@
-extern char *canonicalize_file_name (const char *name);
+extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# 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
 
 #if @GNULIB_GETLOADAVG@
@@ -136,14 +145,14 @@ extern char *canonicalize_file_name (const char *name);
    The three numbers are the load average of the last 1 minute, the last 5
    minutes, and the last 15 minutes, respectively.
    LOADAVG is an array of NELEM numbers.  */
-extern int getloadavg (double loadavg[], int nelem);
+extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -159,14 +168,15 @@ extern int getloadavg (double loadavg[], int nelem);
    For more details see the POSIX:2001 specification.
    http://www.opengroup.org/susv3xsh/getsubopt.html */
 # if !@HAVE_GETSUBOPT@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
@@ -177,10 +187,9 @@ extern void * malloc (size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -190,14 +199,14 @@ extern void * malloc (size_t size);
    they are replaced with a string that makes the directory name unique.
    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
    The directory is created mode 700.  */
-extern char * mkdtemp (char * /*template*/);
+extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
@@ -214,14 +223,14 @@ extern char * mkdtemp (char * /*template*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemp (char * /*template*/, int /*flags*/);
+extern int mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
@@ -239,14 +248,15 @@ extern int mkostemp (char * /*template*/, int /*flags*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
+extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
@@ -261,17 +271,14 @@ extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
 #  define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/);
-# else
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-#  include <unistd.h>
+extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
@@ -286,21 +293,22 @@ extern int mkstemp (char * /*template*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkstemps (char * /*template*/, int /*suffixlen*/);
+extern int mkstemps (char * /*template*/, int /*suffixlen*/)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
 #  undef putenv
 #  define putenv rpl_putenv
-extern int putenv (char *string);
+extern int putenv (char *string) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
@@ -311,33 +319,37 @@ extern int putenv (char *string);
 #   define RAND_MAX 2147483647
 #  endif
 
-int srandom_r (unsigned int seed, struct random_data *rand_state);
+int srandom_r (unsigned int seed, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2));
 int initstate_r (unsigned int seed, char *buf, size_t buf_size,
-                struct random_data *rand_state);
-int setstate_r (char *arg_state, struct random_data *rand_state);
-int random_r (struct random_data *buf, int32_t *result);
+                 struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2, 4));
+int setstate_r (char *arg_state, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((1, 2));
+int random_r (struct random_data *buf, int32_t *result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                           \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                      \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef srandom_r
-# define srandom_r(s,r)                                   \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef setstate_r
-# define setstate_r(a,r)                                   \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
 #if @GNULIB_REALLOC_POSIX@
@@ -348,10 +360,9 @@ extern void * realloc (void *ptr, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
@@ -359,35 +370,46 @@ extern void * realloc (void *ptr, size_t size);
 #  define realpath rpl_realpath
 # endif
 # if !@HAVE_REALPATH@ || @REPLACE_REALPATH@
-extern char *realpath (const char *name, char *resolved);
+extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
 # if !@HAVE_RPMATCH@
 /* Test a user response to a question.
    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
-extern int rpmatch (const char *response);
+extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
-# if !@HAVE_SETENV@
+# if @REPLACE_SETENV@
+#  undef setenv
+#  define setenv rpl_setenv
+# endif
+# if !@HAVE_SETENV@ || @REPLACE_SETENV@
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
-extern int setenv (const char *name, const char *value, int replace);
+extern int setenv (const char *name, const char *value, int replace)
+     _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
 # endif
 #endif
 
@@ -397,14 +419,14 @@ extern int setenv (const char *name, const char *value, int replace);
 # endif
 # if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
  /* Parse a double from STRING, updating ENDP if appropriate.  */
-extern double strtod (const char *str, char **endp);
+extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
@@ -417,14 +439,15 @@ extern double strtod (const char *str, char **endp);
    stored in *ENDPTR.
    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
    to ERANGE.  */
-extern long long strtoll (const char *string, char **endptr, int base);
+extern long long strtoll (const char *string, char **endptr, int base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
@@ -437,26 +460,31 @@ extern long long strtoll (const char *string, char **endptr, int base);
    stored in *ENDPTR.
    Upon overflow, the return value is ULLONG_MAX, and errno is set to
    ERANGE.  */
-extern unsigned long long strtoull (const char *string, char **endptr, int base);
+extern unsigned long long strtoull (const char *string, char **endptr, int base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
-# if @HAVE_UNSETENV@
-#  if @VOID_UNSETENV@
-/* On some systems, unsetenv() returns void.
-   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
-#   define unsetenv(name) ((unsetenv)(name), 0)
-#  endif
-# else
+# if @REPLACE_UNSETENV@
+#  undef unsetenv
+#  define unsetenv rpl_unsetenv
+# endif
+# if !@HAVE_UNSETENV@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
-extern int unsetenv (const char *name);
+extern int unsetenv (const char *name) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
 # endif
 #endif
 
index dfe6c25f2faf121c921ee941bb802b68a90ba972..b0df7784898a90c5f284cd30bd880c92f1165621 100644 (file)
@@ -1,6 +1,6 @@
 /* strerror.c --- POSIX compatible system error routine
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -334,10 +334,10 @@ rpl_strerror (int n)
 
     if (result == NULL || result[0] == '\0')
       {
-       static char const fmt[] = "Unknown error (%d)";
-       static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
-       sprintf (msg_buf, fmt, n);
-       return msg_buf;
+        static char const fmt[] = "Unknown error (%d)";
+        static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)];
+        sprintf (msg_buf, fmt, n);
+        return msg_buf;
       }
 
     return result;
index 3d0c7d1d2dfcc5b5d0ad10c1540afb8b4260380f..8d88bda1668c0d2d7794c6c6318ce61e613dc0f9 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2010 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
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* MirBSD defines mbslen as a macro.  */
+#if @GNULIB_MBSLEN@ && defined __MirBSD__
+# include <wchar.h>
+#endif
+
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
@@ -43,7 +48,9 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -56,14 +63,13 @@ extern "C" {
 # if @REPLACE_MEMCHR@
 #  define memchr rpl_memchr
 extern void *memchr (void const *__s, int __c, size_t __n)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -73,16 +79,16 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 # if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
 extern void *memmem (void const *__haystack, size_t __haystack_len,
-                    void const *__needle, size_t __needle_len)
-  __attribute__ ((__pure__));
+                     void const *__needle, size_t __needle_len)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -90,28 +96,29 @@ extern void *memmem (void const *__haystack, size_t __haystack_len,
 #if @GNULIB_MEMPCPY@
 # if ! @HAVE_MEMPCPY@
 extern void *mempcpy (void *restrict __dest, void const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
 #if @GNULIB_MEMRCHR@
 # if ! @HAVE_DECL_MEMRCHR@
 extern void *memrchr (void const *, int, size_t)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -120,27 +127,28 @@ extern void *memrchr (void const *, int, size_t)
 #if @GNULIB_RAWMEMCHR@
 # if ! @HAVE_RAWMEMCHR@
 extern void *rawmemchr (void const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
 #if @GNULIB_STPCPY@
 # if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+extern char *stpcpy (char *restrict __dst, char const *restrict __src)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -149,39 +157,39 @@ extern char *stpcpy (char *restrict __dst, char const *restrict __src);
 # if ! @HAVE_STPNCPY@
 #  define stpncpy gnu_stpncpy
 extern char *stpncpy (char *restrict __dst, char const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 #if @GNULIB_STRCHRNUL@
 # if ! @HAVE_STRCHRNUL@
 extern char *strchrnul (char const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -191,14 +199,14 @@ extern char *strchrnul (char const *__s, int __c_in)
 #  define strdup rpl_strdup
 # endif
 # if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
-extern char *strdup (char const *__s);
+extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -208,14 +216,14 @@ extern char *strdup (char const *__s);
 #  define strndup rpl_strndup
 # endif
 # if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n);
+extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -224,14 +232,14 @@ extern char *strndup (char const *__string, size_t __n);
 #if @GNULIB_STRNLEN@
 # if ! @HAVE_DECL_STRNLEN@
 extern size_t strnlen (char const *__string, size_t __maxlen)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -240,18 +248,17 @@ extern size_t strnlen (char const *__string, size_t __maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
 #if @GNULIB_STRPBRK@
 # if ! @HAVE_STRPBRK@
 extern char *strpbrk (char const *__s, char const *__accept)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 /* strpbrk() assumes the second argument is a list of single-byte characters.
@@ -259,40 +266,36 @@ extern char *strpbrk (char const *__s, char const *__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -313,29 +316,28 @@ extern char *strpbrk (char const *__s, char const *__accept)
    See also strtok_r().  */
 #if @GNULIB_STRSEP@
 # if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+extern char *strsep (char **restrict __stringp, char const *restrict __delim)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
 # if @REPLACE_STRSTR@
 #  define strstr rpl_strstr
-char *strstr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+extern char *strstr (const char *haystack, const char *needle)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strstr() does not work with multibyte strings if the locale encoding is
@@ -343,13 +345,12 @@ char *strstr (const char *haystack, const char *needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -360,31 +361,31 @@ char *strstr (const char *haystack, const char *needle)
 # endif
 # if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
 extern char *strcasestr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strcasestr() does not work with multibyte strings:
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = strtok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    This is a variant of strtok() that is multithread-safe.
 
@@ -402,27 +403,25 @@ extern char *strcasestr (const char *haystack, const char *needle)
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
 extern char *strtok_r (char *restrict s, char const *restrict delim,
-                      char **restrict save_ptr);
+                       char **restrict save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -432,13 +431,19 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
 #if @GNULIB_MBSLEN@
 /* Return the number of multibyte characters in the character string STRING.
    This considers multibyte characters, unlike strlen, which counts bytes.  */
-extern size_t mbslen (const char *string);
+# ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
+#  undef mbslen
+# endif
+# if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
+#  define mbslen rpl_mbslen
+# endif
+extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSNLEN@
 /* Return the number of multibyte characters in the character string starting
    at STRING and ending at STRING + LEN.  */
-extern size_t mbsnlen (const char *string, size_t len);
+extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSCHR@
@@ -447,7 +452,7 @@ extern size_t mbsnlen (const char *string, size_t len);
    Unlike strchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c);
+extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSRCHR@
@@ -456,7 +461,7 @@ extern char * mbschr (const char *string, int c);
    Unlike strrchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c);
+extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSSTR@
@@ -464,7 +469,8 @@ extern char * mbsrchr (const char *string, int c);
    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
    Unlike strstr(), this function works correctly in multibyte locales with
    encodings different from UTF-8.  */
-extern char * mbsstr (const char *haystack, const char *needle);
+extern char * mbsstr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASECMP@
@@ -474,7 +480,8 @@ extern char * mbsstr (const char *haystack, const char *needle);
    Note: This function may, in multibyte locales, return 0 for strings of
    different lengths!
    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
-extern int mbscasecmp (const char *s1, const char *s2);
+extern int mbscasecmp (const char *s1, const char *s2)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSNCASECMP@
@@ -487,7 +494,8 @@ extern int mbscasecmp (const char *s1, const char *s2);
    of different lengths!
    Unlike strncasecmp(), this function works correctly in multibyte locales.
    But beware that N is not a byte count but a character count!  */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPCASECMP@
@@ -500,7 +508,8 @@ extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
    smaller length than PREFIX!
    Unlike strncasecmp(), this function works correctly in multibyte
    locales.  */
-extern char * mbspcasecmp (const char *string, const char *prefix);
+extern char * mbspcasecmp (const char *string, const char *prefix)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASESTR@
@@ -509,7 +518,8 @@ extern char * mbspcasecmp (const char *string, const char *prefix);
    Note: This function may, in multibyte locales, return success even if
    strlen (haystack) < strlen (needle) !
    Unlike strcasestr(), this function works correctly in multibyte locales.  */
-extern char * mbscasestr (const char *haystack, const char *needle);
+extern char * mbscasestr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCSPN@
@@ -518,7 +528,8 @@ extern char * mbscasestr (const char *haystack, const char *needle);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strcspn(), this function works correctly in multibyte locales.  */
-extern size_t mbscspn (const char *string, const char *accept);
+extern size_t mbscspn (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPBRK@
@@ -527,7 +538,8 @@ extern size_t mbscspn (const char *string, const char *accept);
    exists.
    Unlike strpbrk(), this function works correctly in multibyte locales.  */
 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept);
+extern char * mbspbrk (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSPN@
@@ -536,7 +548,8 @@ extern char * mbspbrk (const char *string, const char *accept);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strspn(), this function works correctly in multibyte locales.  */
-extern size_t mbsspn (const char *string, const char *reject);
+extern size_t mbsspn (const char *string, const char *reject)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSEP@
@@ -554,7 +567,8 @@ extern size_t mbsspn (const char *string, const char *reject);
    Caveat: The identity of the delimiting character is lost.
 
    See also mbstok_r().  */
-extern char * mbssep (char **stringp, const char *delim);
+extern char * mbssep (char **stringp, const char *delim)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSTOK_R@
@@ -562,19 +576,20 @@ extern char * mbssep (char **stringp, const char *delim);
    the character string DELIM.
    If STRING is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = mbstok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = mbstok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    Caveat: It modifies the original string.
    Caveat: These functions cannot be used on constant strings.
    Caveat: The identity of the delimiting character is lost.
 
    See also mbssep().  */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 #endif
 
 /* Map any int, typically from errno, into an error message.  */
@@ -586,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -601,22 +615,22 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
 # if !@HAVE_STRVERSCMP@
-extern int strverscmp (const char *, const char *);
+extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
index 7d392a04aa08983ca2eb171e7437b606a9bf5d75..8910c826c11ebe4b4b6d038396017939e3d059f4 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for <sys/select.h>.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 # include <sys/types.h>
 
 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
-   of 'struct timeval', and no definition of this type.  */
-# include <sys/time.h>
+   of 'struct timeval', and no definition of this type.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <sys/time.h>
+# endif
 
 /* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
-   that relies on memset(), but without including <string.h>.  */
-# include <string.h>
+   that relies on memset(), but without including <string.h>.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <string.h>
+# endif
 
 /* The include_next requires a split double-inclusion guard.  */
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
@@ -63,7 +69,7 @@
 
 # include <sys/socket.h>
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # ifdef __cplusplus
 extern "C" {
@@ -80,10 +86,10 @@ extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
 #  define select select_used_without_requesting_gnulib_module_select
 # elif defined GNULIB_POSIXCHECK
 #  undef select
-#  define select(n,r,w,e,t) \
-     (GL_LINK_WARNING ("select is not always POSIX compliant - " \
-                       "use gnulib module select for portability"), \
-      select (n, r, w, e, t))
+#  if HAVE_RAW_DECL_SELECT
+_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
+                 "use gnulib module select for portability");
+#  endif
 # endif
 
 # ifdef __cplusplus
index 16a7568453e7a9523d9151f573b3a371580431c4..44a82bd3a078d6b9a90911c2bd8ed544f0773ca9 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,8 @@
 #ifndef _GL_SYS_SOCKET_H
 #define _GL_SYS_SOCKET_H
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #if !@HAVE_SA_FAMILY_T@
 typedef unsigned short  sa_family_t;
 #endif
@@ -54,10 +56,10 @@ typedef unsigned short  sa_family_t;
 # define __ss_aligntype unsigned long int
 # define _SS_SIZE 256
 # define _SS_PADSIZE \
-    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)     \
-                 ? sizeof (sa_family_t)                                \
-                 : alignof (__ss_aligntype))                           \
-                + sizeof (__ss_aligntype)))
+    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
+                  ? sizeof (sa_family_t)                                \
+                  : alignof (__ss_aligntype))                           \
+                 + sizeof (__ss_aligntype)))
 
 struct sockaddr_storage
 {
@@ -124,7 +126,7 @@ struct sockaddr_storage
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
@@ -177,7 +179,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 # if @GNULIB_SOCKET@
 #  if @HAVE_WINSOCK2_H@
 #   undef socket
-#   define socket              rpl_socket
+#   define socket               rpl_socket
 extern int rpl_socket (int, int, int protocol);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -185,33 +187,33 @@ extern int rpl_socket (int, int, int protocol);
 #  define socket socket_used_without_requesting_gnulib_module_socket
 # elif defined GNULIB_POSIXCHECK
 #  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
+#  if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+#  endif
 # endif
 
 # if @GNULIB_CONNECT@
 #  if @HAVE_WINSOCK2_H@
 #   undef connect
-#   define connect             rpl_connect
-extern int rpl_connect (int, struct sockaddr *, int);
+#   define connect              rpl_connect
+extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef connect
 #  define connect socket_used_without_requesting_gnulib_module_connect
 # elif defined GNULIB_POSIXCHECK
 #  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
+#  if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+#  endif
 # endif
 
 # if @GNULIB_ACCEPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef accept
-#   define accept              rpl_accept
+#   define accept               rpl_accept
 extern int rpl_accept (int, struct sockaddr *, int *);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -219,84 +221,87 @@ extern int rpl_accept (int, struct sockaddr *, int *);
 #  define accept accept_used_without_requesting_gnulib_module_accept
 # elif defined GNULIB_POSIXCHECK
 #  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+#  endif
 # endif
 
 # if @GNULIB_BIND@
 #  if @HAVE_WINSOCK2_H@
 #   undef bind
-#   define bind                        rpl_bind
-extern int rpl_bind (int, struct sockaddr *, int);
+#   define bind                 rpl_bind
+extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef bind
 #  define bind bind_used_without_requesting_gnulib_module_bind
 # elif defined GNULIB_POSIXCHECK
 #  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
+#  if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETPEERNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getpeername
-#   define getpeername         rpl_getpeername
-extern int rpl_getpeername (int, struct sockaddr *, int *);
+#   define getpeername          rpl_getpeername
+extern int rpl_getpeername (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getpeername
 #  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 # elif defined GNULIB_POSIXCHECK
 #  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
+#  if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockname
-#   define getsockname         rpl_getsockname
-extern int rpl_getsockname (int, struct sockaddr *, int *);
+#   define getsockname          rpl_getsockname
+extern int rpl_getsockname (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockname
 #  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
+#  if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockopt
-#   define getsockopt          rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
+#   define getsockopt           rpl_getsockopt
+extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
+     _GL_ARG_NONNULL ((4, 5));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockopt
 #  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_LISTEN@
 #  if @HAVE_WINSOCK2_H@
 #   undef listen
-#   define listen              rpl_listen
+#   define listen               rpl_listen
 extern int rpl_listen (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -304,101 +309,104 @@ extern int rpl_listen (int, int);
 #  define listen listen_used_without_requesting_gnulib_module_listen
 # elif defined GNULIB_POSIXCHECK
 #  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
+#  if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECV@
 #  if @HAVE_WINSOCK2_H@
 #   undef recv
-#   define recv                        rpl_recv
-extern int rpl_recv (int, void *, int, int);
+#   define recv                 rpl_recv
+extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recv
 #  define recv recv_used_without_requesting_gnulib_module_recv
 # elif defined GNULIB_POSIXCHECK
 #  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
+#  if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+#  endif
 # endif
 
 # if @GNULIB_SEND@
 #  if @HAVE_WINSOCK2_H@
 #   undef send
-#   define send                        rpl_send
-extern int rpl_send (int, const void *, int, int);
+#   define send                 rpl_send
+extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef send
 #  define send send_used_without_requesting_gnulib_module_send
 # elif defined GNULIB_POSIXCHECK
 #  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
+#  if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECVFROM@
 #  if @HAVE_WINSOCK2_H@
 #   undef recvfrom
-#   define recvfrom            rpl_recvfrom
-extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
+#   define recvfrom             rpl_recvfrom
+extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recvfrom
 #  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 # elif defined GNULIB_POSIXCHECK
 #  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+#  endif
 # endif
 
 # if @GNULIB_SENDTO@
 #  if @HAVE_WINSOCK2_H@
 #   undef sendto
-#   define sendto              rpl_sendto
-extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
+#   define sendto               rpl_sendto
+extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef sendto
 #  define sendto sendto_used_without_requesting_gnulib_module_sendto
 # elif defined GNULIB_POSIXCHECK
 #  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+#  endif
 # endif
 
 # if @GNULIB_SETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef setsockopt
-#   define setsockopt          rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
+#   define setsockopt           rpl_setsockopt
+extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
+     _GL_ARG_NONNULL ((4));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef setsockopt
 #  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_SHUTDOWN@
 #  if @HAVE_WINSOCK2_H@
 #   undef shutdown
-#   define shutdown            rpl_shutdown
+#   define shutdown             rpl_shutdown
 extern int rpl_shutdown (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -406,15 +414,15 @@ extern int rpl_shutdown (int, int);
 #  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 # elif defined GNULIB_POSIXCHECK
 #  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+#  if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+#  endif
 # endif
 
 # if @HAVE_WINSOCK2_H@
 #  undef select
-#  define select               select_used_without_including_sys_select_h
+#  define select                select_used_without_including_sys_select_h
 # endif
 
 # ifdef __cplusplus
@@ -437,13 +445,13 @@ extern "C" {
 #  define accept4 rpl_accept4
 # endif
 extern int accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
-                   int flags);
+                    int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef accept4
-# define accept4(s,a,l,f) \
-    (GL_LINK_WARNING ("accept4 is unportable - " \
-                      "use gnulib module accept4 for portability"), \
-     accept4 (s, a, l, f))
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index 8c735c834c5df55b538601a33e130869c8944ee8..8edf420f498cf6fe80ec5348d1a76ae9d7295405 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 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
@@ -47,7 +47,9 @@
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
@@ -295,20 +297,21 @@ extern "C" {
 
 #if @GNULIB_FCHMODAT@
 # if !@HAVE_FCHMODAT@
-extern int fchmodat (int fd, char const *file, mode_t mode, int flag);
+extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_FSTAT@
 # define fstat rpl_fstat
-extern int fstat (int fd, struct stat *buf);
+extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
 #endif
 
 
@@ -318,14 +321,15 @@ extern int fstat (int fd, struct stat *buf);
 #  define fstatat rpl_fstatat
 # endif
 # if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@
-extern int fstatat (int fd, char const *name, struct stat *st, int flags);
+extern int fstatat (int fd, char const *name, struct stat *st, int flags)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -339,10 +343,10 @@ extern int futimens (int fd, struct timespec const times[2]);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -360,14 +364,14 @@ extern int futimens (int fd, struct timespec const times[2]);
 #  define lchmod chmod
 # endif
 # if 0 /* assume already declared */
-extern int lchmod (const char *filename, mode_t mode);
+extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -379,21 +383,22 @@ extern int lchmod (const char *filename, mode_t mode);
 # elif @REPLACE_LSTAT@
 #  undef lstat
 #  define lstat rpl_lstat
-extern int rpl_lstat (const char *name, struct stat *buf);
+extern int rpl_lstat (const char *name, struct stat *buf)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                    \
-  (GL_LINK_WARNING ("lstat is unportable - "                           \
-                   "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_MKDIR@
 # undef mkdir
 # define mkdir rpl_mkdir
-extern int mkdir (char const *name, mode_t mode);
+extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
 #else
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
@@ -413,14 +418,15 @@ rpl_mkdir (char const *name, mode_t mode)
 
 #if @GNULIB_MKDIRAT@
 # if !@HAVE_MKDIRAT@
-extern int mkdirat (int fd, char const *file, mode_t mode);
+extern int mkdirat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -430,27 +436,28 @@ extern int mkdirat (int fd, char const *file, mode_t mode);
 #  define mkfifo rpl_mkfifo
 # endif
 # if !@HAVE_MKFIFO@ || @REPLACE_MKFIFO@
-int mkfifo (char const *file, mode_t mode);
+extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKFIFOAT@
 # if !@HAVE_MKFIFOAT@
-int mkfifoat (int fd, char const *file, mode_t mode);
+extern int mkfifoat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                    \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -460,27 +467,29 @@ int mkfifoat (int fd, char const *file, mode_t mode);
 #  define mknod rpl_mknod
 # endif
 # if !@HAVE_MKNOD@ || @REPLACE_MKNOD@
-int mknod (char const *file, mode_t mode, dev_t dev);
+extern int mknod (char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKNODAT@
 # if !@HAVE_MKNODAT@
-int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
+extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                           \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -499,14 +508,14 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
 #  else /* !_LARGE_FILES */
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
-extern int stat (const char *name, struct stat *buf);
+extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                     \
-  (GL_LINK_WARNING ("stat is unportable - "                            \
-                   "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
@@ -517,14 +526,15 @@ extern int stat (const char *name, struct stat *buf);
 # endif
 # if !@HAVE_UTIMENSAT@ || @REPLACE_UTIMENSAT@
    extern int utimensat (int fd, char const *name,
-                         struct timespec const times[2], int flag);
+                         struct timespec const times[2], int flag)
+        _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
index 454078f7958ac19edcd7cc20d2ff780553fa4695..028093c62796ace94c4e59a77334001f7f6f273c 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -39,6 +39,8 @@
 #  include <time.h>
 # endif
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -54,7 +56,8 @@ struct timeval
 # if @REPLACE_GETTIMEOFDAY@
 #  undef gettimeofday
 #  define gettimeofday rpl_gettimeofday
-int gettimeofday (struct timeval *restrict, void *restrict);
+extern int gettimeofday (struct timeval *restrict, void *restrict)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 #ifdef __cplusplus
index 0734bb7c05a74abadff63d5a304d123fc223d372..85b6dfbd733789e40022c9496f3dc77fdf75baec 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
@@ -42,6 +43,8 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
 EXTRA_libtests_a_SOURCES =
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+
 ## begin gnulib module alignof-tests
 
 TESTS += test-alignof
@@ -60,11 +63,34 @@ EXTRA_DIST += test-alloca-opt.c
 
 ## end   gnulib module alloca-opt-tests
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module arpa_inet-tests
 
 TESTS += test-arpa_inet
 check_PROGRAMS += test-arpa_inet
-
 EXTRA_DIST += test-arpa_inet.c
 
 ## end   gnulib module arpa_inet-tests
@@ -74,7 +100,7 @@ EXTRA_DIST += test-arpa_inet.c
 TESTS += test-c-ctype
 check_PROGRAMS += test-c-ctype
 
-EXTRA_DIST += test-c-ctype.c
+EXTRA_DIST += test-c-ctype.c macros.h
 
 ## end   gnulib module c-ctype-tests
 
@@ -90,9 +116,8 @@ EXTRA_DIST += test-errno.c
 ## begin gnulib module fseeko-tests
 
 TESTS += test-fseeko.sh test-fseeko2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fseeko
-EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh
+EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h
 
 ## end   gnulib module fseeko-tests
 
@@ -101,8 +126,7 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh
 TESTS += test-getaddrinfo
 check_PROGRAMS += test-getaddrinfo
 test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@
-
-EXTRA_DIST += test-getaddrinfo.c
+EXTRA_DIST += signature.h test-getaddrinfo.c
 
 ## end   gnulib module getaddrinfo-tests
 
@@ -111,7 +135,7 @@ EXTRA_DIST += test-getaddrinfo.c
 TESTS += test-getdelim
 check_PROGRAMS += test-getdelim
 MOSTLYCLEANFILES += test-getdelim.txt
-EXTRA_DIST += test-getdelim.c
+EXTRA_DIST += test-getdelim.c signature.h macros.h
 
 ## end   gnulib module getdelim-tests
 
@@ -120,7 +144,7 @@ EXTRA_DIST += test-getdelim.c
 TESTS += test-getline
 check_PROGRAMS += test-getline
 MOSTLYCLEANFILES += test-getline.txt
-EXTRA_DIST += test-getline.c
+EXTRA_DIST += test-getline.c signature.h macros.h
 
 ## end   gnulib module getline-tests
 
@@ -138,7 +162,7 @@ EXTRA_libtests_a_SOURCES += gettimeofday.c
 TESTS += test-gettimeofday
 check_PROGRAMS += test-gettimeofday
 
-EXTRA_DIST += test-gettimeofday.c
+EXTRA_DIST += signature.h test-gettimeofday.c
 
 ## end   gnulib module gettimeofday-tests
 
@@ -147,7 +171,7 @@ EXTRA_DIST += test-gettimeofday.c
 TESTS += test-inet_ntop
 check_PROGRAMS += test-inet_ntop
 test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@
-EXTRA_DIST += test-inet_ntop.c
+EXTRA_DIST += test-inet_ntop.c signature.h macros.h
 
 ## end   gnulib module inet_ntop-tests
 
@@ -156,7 +180,7 @@ EXTRA_DIST += test-inet_ntop.c
 TESTS += test-inet_pton
 check_PROGRAMS += test-inet_pton
 test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@
-EXTRA_DIST += test-inet_pton.c
+EXTRA_DIST += test-inet_pton.c signature.h macros.h
 
 ## end   gnulib module inet_pton-tests
 
@@ -169,20 +193,11 @@ EXTRA_libtests_a_SOURCES += ioctl.c
 
 ## end   gnulib module ioctl
 
-## begin gnulib module link-warning
-
-LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module lseek-tests
 
 TESTS += test-lseek.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-lseek
-EXTRA_DIST += test-lseek.c test-lseek.sh
+EXTRA_DIST += test-lseek.c test-lseek.sh signature.h macros.h
 
 ## end   gnulib module lseek-tests
 
@@ -190,7 +205,7 @@ EXTRA_DIST += test-lseek.c test-lseek.sh
 
 TESTS += test-memchr
 check_PROGRAMS += test-memchr
-EXTRA_DIST += test-memchr.c zerosize-ptr.h
+EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h
 
 ## end   gnulib module memchr-tests
 
@@ -198,7 +213,6 @@ EXTRA_DIST += test-memchr.c zerosize-ptr.h
 
 TESTS += test-netdb
 check_PROGRAMS += test-netdb
-
 EXTRA_DIST += test-netdb.c
 
 ## end   gnulib module netdb-tests
@@ -207,7 +221,6 @@ EXTRA_DIST += test-netdb.c
 
 TESTS += test-netinet_in
 check_PROGRAMS += test-netinet_in
-
 EXTRA_DIST += test-netinet_in.c
 
 ## end   gnulib module netinet_in-tests
@@ -215,9 +228,8 @@ EXTRA_DIST += test-netinet_in.c
 ## begin gnulib module perror-tests
 
 TESTS += test-perror.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-perror
-EXTRA_DIST += test-perror.c test-perror.sh
+EXTRA_DIST += signature.h test-perror.c test-perror.sh
 
 ## end   gnulib module perror-tests
 
@@ -233,13 +245,11 @@ EXTRA_DIST += test-read-file.c
 
 TESTS += test-select test-select-in.sh test-select-out.sh
 # test-select-stdin has to be run by hand.
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-select test-select-fd test-select-stdin
 test_select_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
 test_select_fd_LDADD = $(LDADD) @LIBSOCKET@
 test_select_stdin_LDADD = $(LDADD) @LIBSOCKET@
-
-EXTRA_DIST += test-select.c test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c
+EXTRA_DIST += signature.h test-select.c test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c
 
 ## end   gnulib module select-tests
 
@@ -248,7 +258,7 @@ EXTRA_DIST += test-select.c test-select-fd.c test-select-in.sh test-select-out.s
 TESTS += test-snprintf
 check_PROGRAMS += test-snprintf
 
-EXTRA_DIST += test-snprintf.c
+EXTRA_DIST += test-snprintf.c signature.h macros.h
 
 ## end   gnulib module snprintf-tests
 
@@ -265,7 +275,6 @@ EXTRA_DIST += test-sockets.c
 
 TESTS += test-stdbool
 check_PROGRAMS += test-stdbool
-
 EXTRA_DIST += test-stdbool.c
 
 ## end   gnulib module stdbool-tests
@@ -274,7 +283,6 @@ EXTRA_DIST += test-stdbool.c
 
 TESTS += test-stddef
 check_PROGRAMS += test-stddef
-
 EXTRA_DIST += test-stddef.c
 
 ## end   gnulib module stddef-tests
@@ -283,7 +291,6 @@ EXTRA_DIST += test-stddef.c
 
 TESTS += test-stdint
 check_PROGRAMS += test-stdint
-
 EXTRA_DIST += test-stdint.c
 
 ## end   gnulib module stdint-tests
@@ -292,7 +299,6 @@ EXTRA_DIST += test-stdint.c
 
 TESTS += test-stdio
 check_PROGRAMS += test-stdio
-
 EXTRA_DIST += test-stdio.c
 
 ## end   gnulib module stdio-tests
@@ -301,7 +307,6 @@ EXTRA_DIST += test-stdio.c
 
 TESTS += test-stdlib
 check_PROGRAMS += test-stdlib
-
 EXTRA_DIST += test-stdlib.c
 
 ## end   gnulib module stdlib-tests
@@ -310,7 +315,7 @@ EXTRA_DIST += test-stdlib.c
 
 TESTS += test-strerror
 check_PROGRAMS += test-strerror
-EXTRA_DIST += test-strerror.c
+EXTRA_DIST += test-strerror.c signature.h macros.h
 
 ## end   gnulib module strerror-tests
 
@@ -318,18 +323,17 @@ EXTRA_DIST += test-strerror.c
 
 TESTS += test-string
 check_PROGRAMS += test-string
-
 EXTRA_DIST += test-string.c
 
 ## end   gnulib module string-tests
 
 ## begin gnulib module sys_ioctl
 
-BUILT_SOURCES += $(SYS_IOCTL_H)
+BUILT_SOURCES += sys/ioctl.h
 
 # We need the following in order to create <sys/ioctl.h> when the system
 # does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h
+sys/ioctl.h: sys_ioctl.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -340,7 +344,7 @@ sys/ioctl.h: sys_ioctl.in.h
              -e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
              -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
              -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_ioctl.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -351,11 +355,18 @@ EXTRA_DIST += sys_ioctl.in.h
 
 ## end   gnulib module sys_ioctl
 
+## begin gnulib module sys_ioctl-tests
+
+TESTS += test-sys_ioctl
+check_PROGRAMS += test-sys_ioctl
+EXTRA_DIST += test-sys_ioctl.c
+
+## end   gnulib module sys_ioctl-tests
+
 ## begin gnulib module sys_select-tests
 
 TESTS += test-sys_select
 check_PROGRAMS += test-sys_select
-
 EXTRA_DIST += test-sys_select.c
 
 ## end   gnulib module sys_select-tests
@@ -364,7 +375,6 @@ EXTRA_DIST += test-sys_select.c
 
 TESTS += test-sys_socket
 check_PROGRAMS += test-sys_socket
-
 EXTRA_DIST += test-sys_socket.c
 
 ## end   gnulib module sys_socket-tests
@@ -373,7 +383,6 @@ EXTRA_DIST += test-sys_socket.c
 
 TESTS += test-sys_stat
 check_PROGRAMS += test-sys_stat
-
 EXTRA_DIST += test-sys_stat.c
 
 ## end   gnulib module sys_stat-tests
@@ -382,7 +391,6 @@ EXTRA_DIST += test-sys_stat.c
 
 TESTS += test-sys_time
 check_PROGRAMS += test-sys_time
-
 EXTRA_DIST += test-sys_time.c
 
 ## end   gnulib module sys_time-tests
@@ -391,7 +399,6 @@ EXTRA_DIST += test-sys_time.c
 
 TESTS += test-time
 check_PROGRAMS += test-time
-
 EXTRA_DIST += test-time.c
 
 ## end   gnulib module time-tests
@@ -400,7 +407,6 @@ EXTRA_DIST += test-time.c
 
 TESTS += test-unistd
 check_PROGRAMS += test-unistd
-
 EXTRA_DIST += test-unistd.c
 
 ## end   gnulib module unistd-tests
@@ -410,7 +416,7 @@ EXTRA_DIST += test-unistd.c
 TESTS += test-vasnprintf
 check_PROGRAMS += test-vasnprintf
 
-EXTRA_DIST += test-vasnprintf.c
+EXTRA_DIST += test-vasnprintf.c macros.h
 
 ## end   gnulib module vasnprintf-tests
 
@@ -432,18 +438,35 @@ libtests_a_SOURCES += verify.h
 ## begin gnulib module version-etc-tests
 
 TESTS += test-version-etc.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-version-etc
 test_version_etc_LDADD = $(LDADD) @LIBINTL@
 EXTRA_DIST += test-version-etc.c test-version-etc.sh
 
 ## end   gnulib module version-etc-tests
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar-tests
 
 TESTS += test-wchar
 check_PROGRAMS += test-wchar
-
 EXTRA_DIST += test-wchar.c
 
 ## end   gnulib module wchar-tests
index ccb5c26f873bb2f1b41d198cae67547e0b3da030..0f9a277962f2fa79b8b444d303b4acdb49a4dcc9 100644 (file)
@@ -1,5 +1,5 @@
 /* A dummy file, to prevent empty libraries from breaking builds.
-   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2009, 2010 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
index 63ee747c0cc001aabc58292040fea75038608b59..271c7e980ec0e90e4c0dcab06f8a75bb105cb080 100644 (file)
@@ -1,7 +1,6 @@
 /* Provide gettimeofday for systems that don't have it or for which it's broken.
 
-   Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software
-   Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2010 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
index 75ed5c06f48f93675fddf36e22245022e87f7506..de3f82bd17d9763eacffcda02d350132cce55d26 100644 (file)
@@ -1,6 +1,6 @@
 /* ioctl.c --- wrappers for Windows ioctl function
 
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index ae98f88ba5cad30e3035256b84c95157ee06c33a..07a030f89c315b57104154886230dd1d60fd5176 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <sys/ioctl.h>.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
 #define _GL_SYS_IOCTL_H
 
 /* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>,
-   but not in <sys/ioctl.h>.  */
-#include <unistd.h>
+   but not in <sys/ioctl.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <unistd.h>
+#endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Declare overridden functions.  */
@@ -54,10 +57,10 @@ extern int ioctl (int fd, int request, ... /* {void *,char *} arg */);
 # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
 #elif defined GNULIB_POSIXCHECK
 # undef ioctl
-# define ioctl(f,c,a) \
-    (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \
-                      "use gnulib module ioctl for portability"), \
-     ioctl (f, c, a))
+# if HAVE_RAW_DECL_IOCTL
+_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
+                 "use gnulib module ioctl for portability");
+# endif
 #endif
 
 
index d42bdf5e643f5981b1c00ec420ba5892845d94c2..a8b6d18996f0c2d1ad573ea4cbe2a11bad7e315f 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <alignof.h>.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index 68d906d8695b4f7610457580377e0d608cd40cf0..cfbecafcb9a58910e27ef2d4e2a0165edf3b09c1 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of optional automatic memory allocation.
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009, 2010 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
index 1e2479f4f91bad2bbbf1ea1746344bca98879753..262686ac4708c881a4e3859ac38678727fdc5697 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <arpa/inet.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 6d7fe1b7a3566ff63b3426b779c968eac7b93553..ebe594dd4f534ca15e10b5b36a347c01b6021afb 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of character handling in C locale.
-   Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007-2010 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
 #include "c-ctype.h"
 
 #include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static void
 test_all (void)
@@ -46,81 +34,81 @@ test_all (void)
       ASSERT (c_isascii (c) == (c >= 0 && c < 0x80));
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-         ASSERT (c_isalnum (c) == 1);
-         break;
-       default:
-         ASSERT (c_isalnum (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+          ASSERT (c_isalnum (c) == 1);
+          break;
+        default:
+          ASSERT (c_isalnum (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-         ASSERT (c_isalpha (c) == 1);
-         break;
-       default:
-         ASSERT (c_isalpha (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+          ASSERT (c_isalpha (c) == 1);
+          break;
+        default:
+          ASSERT (c_isalpha (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case '\t': case ' ':
-         ASSERT (c_isblank (c) == 1);
-         break;
-       default:
-         ASSERT (c_isblank (c) == 0);
-         break;
-       }
+        {
+        case '\t': case ' ':
+          ASSERT (c_isblank (c) == 1);
+          break;
+        default:
+          ASSERT (c_isblank (c) == 0);
+          break;
+        }
 
       ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f));
 
       switch (c)
-       {
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-         ASSERT (c_isdigit (c) == 1);
-         break;
-       default:
-         ASSERT (c_isdigit (c) == 0);
-         break;
-       }
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+          ASSERT (c_isdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isdigit (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-         ASSERT (c_islower (c) == 1);
-         break;
-       default:
-         ASSERT (c_islower (c) == 0);
-         break;
-       }
+        {
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+          ASSERT (c_islower (c) == 1);
+          break;
+        default:
+          ASSERT (c_islower (c) == 0);
+          break;
+        }
 
       ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' '));
 
@@ -129,257 +117,257 @@ test_all (void)
       ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c)));
 
       switch (c)
-       {
-       case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
-         ASSERT (c_isspace (c) == 1);
-         break;
-       default:
-         ASSERT (c_isspace (c) == 0);
-         break;
-       }
+        {
+        case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
+          ASSERT (c_isspace (c) == 1);
+          break;
+        default:
+          ASSERT (c_isspace (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-         ASSERT (c_isupper (c) == 1);
-         break;
-       default:
-         ASSERT (c_isupper (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+          ASSERT (c_isupper (c) == 1);
+          break;
+        default:
+          ASSERT (c_isupper (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-         ASSERT (c_isxdigit (c) == 1);
-         break;
-       default:
-         ASSERT (c_isxdigit (c) == 0);
-         break;
-       }
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+          ASSERT (c_isxdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isxdigit (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A':
-         ASSERT (c_tolower (c) == 'a');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'B':
-         ASSERT (c_tolower (c) == 'b');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'C':
-         ASSERT (c_tolower (c) == 'c');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'D':
-         ASSERT (c_tolower (c) == 'd');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'E':
-         ASSERT (c_tolower (c) == 'e');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'F':
-         ASSERT (c_tolower (c) == 'f');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'G':
-         ASSERT (c_tolower (c) == 'g');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'H':
-         ASSERT (c_tolower (c) == 'h');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'I':
-         ASSERT (c_tolower (c) == 'i');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'J':
-         ASSERT (c_tolower (c) == 'j');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'K':
-         ASSERT (c_tolower (c) == 'k');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'L':
-         ASSERT (c_tolower (c) == 'l');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'M':
-         ASSERT (c_tolower (c) == 'm');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'N':
-         ASSERT (c_tolower (c) == 'n');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'O':
-         ASSERT (c_tolower (c) == 'o');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'P':
-         ASSERT (c_tolower (c) == 'p');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Q':
-         ASSERT (c_tolower (c) == 'q');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'R':
-         ASSERT (c_tolower (c) == 'r');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'S':
-         ASSERT (c_tolower (c) == 's');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'T':
-         ASSERT (c_tolower (c) == 't');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'U':
-         ASSERT (c_tolower (c) == 'u');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'V':
-         ASSERT (c_tolower (c) == 'v');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'W':
-         ASSERT (c_tolower (c) == 'w');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'X':
-         ASSERT (c_tolower (c) == 'x');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Y':
-         ASSERT (c_tolower (c) == 'y');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Z':
-         ASSERT (c_tolower (c) == 'z');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'a':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'A');
-         break;
-       case 'b':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'B');
-         break;
-       case 'c':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'C');
-         break;
-       case 'd':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'D');
-         break;
-       case 'e':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'E');
-         break;
-       case 'f':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'F');
-         break;
-       case 'g':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'G');
-         break;
-       case 'h':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'H');
-         break;
-       case 'i':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'I');
-         break;
-       case 'j':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'J');
-         break;
-       case 'k':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'K');
-         break;
-       case 'l':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'L');
-         break;
-       case 'm':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'M');
-         break;
-       case 'n':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'N');
-         break;
-       case 'o':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'O');
-         break;
-       case 'p':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'P');
-         break;
-       case 'q':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Q');
-         break;
-       case 'r':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'R');
-         break;
-       case 's':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'S');
-         break;
-       case 't':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'T');
-         break;
-       case 'u':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'U');
-         break;
-       case 'v':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'V');
-         break;
-       case 'w':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'W');
-         break;
-       case 'x':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'X');
-         break;
-       case 'y':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Y');
-         break;
-       case 'z':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Z');
-         break;
-       default:
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == c);
-         break;
-       }
+        {
+        case 'A':
+          ASSERT (c_tolower (c) == 'a');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'B':
+          ASSERT (c_tolower (c) == 'b');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'C':
+          ASSERT (c_tolower (c) == 'c');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'D':
+          ASSERT (c_tolower (c) == 'd');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'E':
+          ASSERT (c_tolower (c) == 'e');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'F':
+          ASSERT (c_tolower (c) == 'f');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'G':
+          ASSERT (c_tolower (c) == 'g');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'H':
+          ASSERT (c_tolower (c) == 'h');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'I':
+          ASSERT (c_tolower (c) == 'i');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'J':
+          ASSERT (c_tolower (c) == 'j');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'K':
+          ASSERT (c_tolower (c) == 'k');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'L':
+          ASSERT (c_tolower (c) == 'l');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'M':
+          ASSERT (c_tolower (c) == 'm');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'N':
+          ASSERT (c_tolower (c) == 'n');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'O':
+          ASSERT (c_tolower (c) == 'o');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'P':
+          ASSERT (c_tolower (c) == 'p');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Q':
+          ASSERT (c_tolower (c) == 'q');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'R':
+          ASSERT (c_tolower (c) == 'r');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'S':
+          ASSERT (c_tolower (c) == 's');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'T':
+          ASSERT (c_tolower (c) == 't');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'U':
+          ASSERT (c_tolower (c) == 'u');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'V':
+          ASSERT (c_tolower (c) == 'v');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'W':
+          ASSERT (c_tolower (c) == 'w');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'X':
+          ASSERT (c_tolower (c) == 'x');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Y':
+          ASSERT (c_tolower (c) == 'y');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Z':
+          ASSERT (c_tolower (c) == 'z');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'a':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'A');
+          break;
+        case 'b':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'B');
+          break;
+        case 'c':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'C');
+          break;
+        case 'd':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'D');
+          break;
+        case 'e':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'E');
+          break;
+        case 'f':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'F');
+          break;
+        case 'g':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'G');
+          break;
+        case 'h':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'H');
+          break;
+        case 'i':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'I');
+          break;
+        case 'j':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'J');
+          break;
+        case 'k':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'K');
+          break;
+        case 'l':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'L');
+          break;
+        case 'm':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'M');
+          break;
+        case 'n':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'N');
+          break;
+        case 'o':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'O');
+          break;
+        case 'p':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'P');
+          break;
+        case 'q':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Q');
+          break;
+        case 'r':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'R');
+          break;
+        case 's':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'S');
+          break;
+        case 't':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'T');
+          break;
+        case 'u':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'U');
+          break;
+        case 'v':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'V');
+          break;
+        case 'w':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'W');
+          break;
+        case 'x':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'X');
+          break;
+        case 'y':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Y');
+          break;
+        case 'z':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Z');
+          break;
+        default:
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == c);
+          break;
+        }
     }
 }
 
index 4642027dcea4a03b5f9ef2cd94bff031dded437c..129b236fe9c086bcacaf216e89fa10856b896b3a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <errno.h> substitute.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 93b0adc3613ea4bb1c7b9a928bb7a41fa860a433..be2a78dce1b702e291637dece49ab522afa36637 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of fseeko() function.
-   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010 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
 
 #include <config.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
 /* None of the files accessed by this test are large, so disable the
    fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int));
+
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 #ifndef FUNC_UNGETC_BROKEN
 # define FUNC_UNGETC_BROKEN 0
 #endif
 
 int
-main (int argc, char **argv)
+main (int argc, char **argv _GL_UNUSED)
 {
   /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
      iff argc > 1.  */
index 57c1a4d7120c175048a1d0ac659739f91d4c3ee8..bd245b427bcfbc571eb679ecf89a62636fdd6fa9 100644 (file)
@@ -1,6 +1,6 @@
 /* Test the getaddrinfo module.
 
-   Copyright (C) 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 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
 /* Written by Simon Josefsson.  */
 
 #include <config.h>
+
 #include <netdb.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *));
+SIGNATURE_CHECK (gai_strerror, char const *, (int));
+SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *,
+                                    struct addrinfo const *,
+                                    struct addrinfo **));
+
 #include <arpa/inet.h>
 #include <errno.h>
 #include <netinet/in.h>
@@ -75,31 +83,31 @@ simple (char const *host, char const *service)
   if (res != 0)
     {
       /* EAI_AGAIN is returned if no network is available. Don't fail
-        the test merely because someone is down the country on their
-        in-law's farm. */
+         the test merely because someone is down the country on their
+         in-law's farm. */
       if (res == EAI_AGAIN)
-       {
-         skip++;
-         fprintf (stderr, "skipping getaddrinfo test: no network?\n");
-         return 77;
-       }
+        {
+          skip++;
+          fprintf (stderr, "skipping getaddrinfo test: no network?\n");
+          return 77;
+        }
       /* IRIX reports EAI_NONAME for "https".  Don't fail the test
-        merely because of this.  */
+         merely because of this.  */
       if (res == EAI_NONAME)
-       return 0;
+        return 0;
       /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
-        fail the test merely because of this.  */
+         fail the test merely because of this.  */
       if (res == EAI_SERVICE)
-       return 0;
+        return 0;
 #ifdef EAI_NODATA
       /* AIX reports EAI_NODATA for "https".  Don't fail the test
-        merely because of this.  */
+         merely because of this.  */
       if (res == EAI_NODATA)
-       return 0;
+        return 0;
 #endif
       /* Provide details if errno was set.  */
       if (res == EAI_SYSTEM)
-       dbgprintf ("system error: %s\n", strerror (err));
+        dbgprintf ("system error: %s\n", strerror (err));
 
       return 1;
     }
@@ -112,27 +120,27 @@ simple (char const *host, char const *service)
       dbgprintf ("\tprotocol %x\n", ai->ai_protocol);
       dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
       dbgprintf ("\tFound %s\n",
-                inet_ntop (ai->ai_family,
-                           &((struct sockaddr_in *)
-                             ai->ai_addr)->sin_addr,
-                           buf, sizeof (buf) - 1));
+                 inet_ntop (ai->ai_family,
+                            &((struct sockaddr_in *)
+                              ai->ai_addr)->sin_addr,
+                            buf, sizeof (buf) - 1));
       if (ai->ai_canonname)
-       dbgprintf ("\tFound %s...\n", ai->ai_canonname);
+        dbgprintf ("\tFound %s...\n", ai->ai_canonname);
 
       {
-       char ipbuf[BUFSIZ];
-       char portbuf[BUFSIZ];
-
-       res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
-                          ipbuf, sizeof (ipbuf) - 1,
-                          portbuf, sizeof (portbuf) - 1,
-                          NI_NUMERICHOST|NI_NUMERICSERV);
-       dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
-       if (res == 0)
-         {
-           dbgprintf ("\t\tip %s\n", ipbuf);
-           dbgprintf ("\t\tport %s\n", portbuf);
-         }
+        char ipbuf[BUFSIZ];
+        char portbuf[BUFSIZ];
+
+        res = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+                           ipbuf, sizeof (ipbuf) - 1,
+                           portbuf, sizeof (portbuf) - 1,
+                           NI_NUMERICHOST|NI_NUMERICSERV);
+        dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res));
+        if (res == 0)
+          {
+            dbgprintf ("\t\tip %s\n", ipbuf);
+            dbgprintf ("\t\tport %s\n", portbuf);
+          }
       }
 
     }
@@ -166,8 +174,8 @@ int main (void)
 
     if (data.wVersion < requested)
       {
-       WSACleanup ();
-       return 2;
+        WSACleanup ();
+        return 2;
       }
   }
 #endif
index da4fe6b313005317b0475122782efb62e89e6b33..df9966497e46a26a30d6a8429586d2955efcff9e 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of getdelim() function.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 #include <config.h>
 
 #include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *));
+
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (void)
index 50722cd48d5aa3309419f665321e2b3baf134aaa..7112b52a4cf11375049b9e673049562c05d985a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of getline() function.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 #include <config.h>
 
 #include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *));
+
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (void)
index 3b858791a42173d4caa8df909bce503e1dfa4589..bd6698d1cf3f12ae503e087ef1bb13056f653702 100644 (file)
 #include <config.h>
 
 #include <sys/time.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, void *));
+
 #include <time.h>
 
 #include <stdio.h>
index 71ba5c31ef68457c974f7764e0b51424a821eea6..d3b045c3535321aedc953df3156590d25f1c9e68 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of inet_ntop function.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
 
 #include <arpa/inet.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *,
+                                           socklen_t));
+
 #include <netinet/in.h>
 #include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (void)
index b6c3ab2985be11de6e2c8c5dbc86bc5065b428cd..74afc0c07b1ac2a756b2e016c09490605f9b97a8 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of inet_pton function.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
 
 #include <arpa/inet.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *));
+
 #include <netinet/in.h>
 #include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (void)
index 5d9b5c044e94af244548ea50c2c0f60168125009..3d893a0d05666887de74198ff2c8be47fa68498c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of lseek() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <config.h>
 
-#include <errno.h>
-#include <stdio.h>
 #include <unistd.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (lseek, off_t, (int, off_t, int));
+
+#include <errno.h>
+
+#include "macros.h"
 
 /* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1'
    if they are pipes, and '2' if they are closed.  Check for proper
@@ -51,7 +44,7 @@ main (int argc, char **argv)
       errno = 0;
 #if ! defined __BEOS__
       /* POSIX says that the last lseek call, when failing, does not change
-        the current offset.  But BeOS sets it to 0.  */
+         the current offset.  But BeOS sets it to 0.  */
       ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2);
 #endif
 #if 0 /* leads to SIGSYS on IRIX 6.5 */
@@ -65,7 +58,7 @@ main (int argc, char **argv)
       errno = 0;
 #if ! defined __BEOS__
       /* POSIX says that the last lseek call, when failing, does not change
-        the current offset.  But BeOS sets it to 0.  */
+         the current offset.  But BeOS sets it to 0.  */
       ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2);
 #endif
 #if 0 /* leads to SIGSYS on IRIX 6.5 */
index d5e53e0081b1ae57b85157777840f25a11bad6e5..5d31e76f27afa35376509b31116fcce56a140483 100644 (file)
 
 #include <string.h>
 
-#include <stdio.h>
+#include "signature.h"
+SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t));
+
 #include <stdlib.h>
 
 #include "zerosize-ptr.h"
-
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-       {                                                                    \
-         fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-         fflush (stderr);                                                   \
-         abort ();                                                          \
-       }                                                                    \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 /* Calculating void * + int is not portable, so this wrapper converts
    to char * to make the tests easier to write.  */
@@ -76,7 +67,7 @@ main (void)
     size_t repeat = 10000;
     for (; repeat > 0; repeat--)
       {
-       ASSERT (MEMCHR (input, 'c', n) == input + 2);
+        ASSERT (MEMCHR (input, 'c', n) == input + 2);
       }
   }
 
@@ -85,12 +76,12 @@ main (void)
     int i, j;
     for (i = 0; i < 32; i++)
       {
-       for (j = 0; j < 256; j++)
-         input[i + j] = j;
-       for (j = 0; j < 256; j++)
-         {
-           ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
-         }
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
+          }
       }
   }
 
@@ -102,23 +93,23 @@ main (void)
 
     if (page_boundary != NULL)
       {
-       for (n = 1; n <= 500; n++)
-         {
-           char *mem = page_boundary - n;
-           memset (mem, 'X', n);
-           ASSERT (MEMCHR (mem, 'U', n) == NULL);
-
-           {
-             size_t i;
-
-             for (i = 0; i < n; i++)
-               {
-                 mem[i] = 'U';
-                 ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
-                 mem[i] = 'X';
-               }
-           }
-         }
+        for (n = 1; n <= 500; n++)
+          {
+            char *mem = page_boundary - n;
+            memset (mem, 'X', n);
+            ASSERT (MEMCHR (mem, 'U', n) == NULL);
+
+            {
+              size_t i;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
       }
   }
 
index cde9105fdeb4f16aaea86311ea63185cc17b33fb..5f2bcd4e52e1a0879872e937dbd8e19dc1bb23bf 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <netdb.h> substitute.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index 5a61557c94ec02b72d642eef43625f6459a65e2e..af403ed32326bb0567e75b84d834d2d2d5a376c4 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <netinet/in.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 2faa8aeaf08c13876f6d5a021de3c347198c219c..2b7640c06a16c3d7d3926c459fa2a2fc4ddba553 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of perror() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -19,6 +19,9 @@
 
 #include <stdio.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (perror, void, (char const *));
+
 #include <errno.h>
 
 int
index 392c4f7eaf3962c14a9254c26b6c43f69c44a854..2509680bae435695f805765d5a6564acca64005e 100644 (file)
@@ -41,25 +41,25 @@ main (void)
 
       if (!out)
         {
-         perror ("Could not read file");
-         err = 1;
-       }
+          perror ("Could not read file");
+          err = 1;
+        }
       else
-       {
-         if (out[len] != '\0')
-           {
-             perror ("BAD: out[len] not zero");
-             err = 1;
-           }
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
 
-         /* Assume FILE1 is a regular file or a symlink to a regular file.  */
-         if (len != statbuf.st_size)
-           {
-             fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
-             err = 1;
-           }
-         free (out);
-       }
+          /* Assume FILE1 is a regular file or a symlink to a regular file.  */
+          if (len != statbuf.st_size)
+            {
+              fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
+              err = 1;
+            }
+          free (out);
+        }
     }
 
   /* We can perform the test only if the file exists and is readable.
@@ -71,26 +71,26 @@ main (void)
 
       if (!out)
         {
-         perror ("Could not read file");
-         err = 1;
-       }
+          perror ("Could not read file");
+          err = 1;
+        }
       else
-       {
-         if (out[len] != '\0')
-           {
-             perror ("BAD: out[len] not zero");
-             err = 1;
-           }
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
 
-         /* /dev/null should always be empty.  Ignore statbuf.st_size, since it
-            is not a regular file.  */
-         if (len != 0)
-           {
-             fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2);
-             err = 1;
-           }
-         free (out);
-       }
+          /* /dev/null should always be empty.  Ignore statbuf.st_size, since it
+             is not a regular file.  */
+          if (len != 0)
+            {
+              fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2);
+              err = 1;
+            }
+          free (out);
+        }
     }
 
   return err;
index ddd2013de0af00010779895f711b86812899a590..4527a2fb49bffbeae6873ee6028313897cc4c670 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of select() substitute, reading or writing from a given file descriptor.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -30,42 +30,42 @@ main (int argc, char *argv[])
       char mode = argv[1][0];
 
       if (mode == 'r' || mode == 'w')
-       {
-         int fd = atoi (argv[2]);
+        {
+          int fd = atoi (argv[2]);
 
-         if (fd >= 0)
-           {
-             const char *result_file_name = argv[3];
-             FILE *result_file = fopen (result_file_name, "wb");
+          if (fd >= 0)
+            {
+              const char *result_file_name = argv[3];
+              FILE *result_file = fopen (result_file_name, "wb");
 
-             if (result_file != NULL)
-               {
-                 fd_set fds;
-                 struct timeval timeout;
-                 int ret;
+              if (result_file != NULL)
+                {
+                  fd_set fds;
+                  struct timeval timeout;
+                  int ret;
 
-                 FD_ZERO (&fds);
-                 FD_SET (fd, &fds);
-                 timeout.tv_sec = 0;
-                 timeout.tv_usec = 10000;
-                 ret = (mode == 'r'
-                        ? select (fd + 1, &fds, NULL, NULL, &timeout)
-                        : select (fd + 1, NULL, &fds, NULL, &timeout));
-                 if (ret < 0)
-                   {
-                     perror ("select failed");
-                     exit (1);
-                   }
-                 if ((ret == 0) != ! FD_ISSET (fd, &fds))
-                   {
-                     fprintf (stderr, "incorrect return value\n");
-                     exit (1);
-                   }
-                 fprintf (result_file, "%d\n", ret);
-                 exit (0);
-               }
-           }
-       }
+                  FD_ZERO (&fds);
+                  FD_SET (fd, &fds);
+                  timeout.tv_sec = 0;
+                  timeout.tv_usec = 10000;
+                  ret = (mode == 'r'
+                         ? select (fd + 1, &fds, NULL, NULL, &timeout)
+                         : select (fd + 1, NULL, &fds, NULL, &timeout));
+                  if (ret < 0)
+                    {
+                      perror ("select failed");
+                      exit (1);
+                    }
+                  if ((ret == 0) != ! FD_ISSET (fd, &fds))
+                    {
+                      fprintf (stderr, "incorrect return value\n");
+                      exit (1);
+                    }
+                  fprintf (result_file, "%d\n", ret);
+                  exit (0);
+                }
+            }
+        }
     }
   fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n");
   exit (1);
index 079dec50e709d6a23d23c0eb70e1a29987023dfa..e9cee96f1fac7ea64677d903dbf31dc2ac5104f6 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of select() substitute, reading from stdin.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -47,34 +47,34 @@ main (void)
 
       gettimeofday (&after, NULL);
       spent_usec = (after.tv_sec - before.tv_sec) * 1000000
-                  + after.tv_usec - before.tv_usec;
+                   + after.tv_usec - before.tv_usec;
 
       if (ret < 0)
-       {
-         perror ("select failed");
-         exit (1);
-       }
+        {
+          perror ("select failed");
+          exit (1);
+        }
       if ((ret == 0) != ! FD_ISSET (0, &readfds))
-       {
-         fprintf (stderr, "incorrect return value\n");
-         exit (1);
-       }
+        {
+          fprintf (stderr, "incorrect return value\n");
+          exit (1);
+        }
       if (ret == 0)
-       {
-         if (spent_usec < 250000)
-           {
-             fprintf (stderr, "returned too early\n");
-             exit (1);
-           }
-         /* Timeout */
-         printf ("."); fflush (stdout);
-       }
+        {
+          if (spent_usec < 250000)
+            {
+              fprintf (stderr, "returned too early\n");
+              exit (1);
+            }
+          /* Timeout */
+          printf ("."); fflush (stdout);
+        }
       else
-       {
-         char c;
+        {
+          char c;
 
-         printf ("Input available! Trying to read 1 byte...\n");
-         read (0, &c, 1);
-       }
+          printf ("Input available! Trying to read 1 byte...\n");
+          read (0, &c, 1);
+        }
     }
 }
index d6d6b063aca6311bcfdb714cd1bff2d188d4cc26..884e823394a3986af991d3062f0966cf6795cbe5 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of select() substitute.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
 
 #include <sys/select.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *,
+                               struct timeval *));
+/* The following may be macros without underlying functions, so only
+   check signature if they are not macros.  */
+#ifndef FD_CLR
+SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *));
+#endif
+#ifndef FD_ISSET
+SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *));
+#endif
+#ifndef FD_SET
+SIGNATURE_CHECK (FD_SET, int, (int, fd_set *));
+#endif
+#ifndef FD_ZERO
+SIGNATURE_CHECK (FD_ZERO, void, (fd_set *));
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <netinet/in.h>
@@ -51,7 +69,7 @@ enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 };
 #define SO_REUSEPORT    SO_REUSEADDR
 #endif
 
-#define TEST_PORT      12345
+#define TEST_PORT       12345
 
 
 /* Minimal testing infrastructure.  */
index 790c999649465907f22fd1f78c0fc2d1e571119c..62a411bf913415c82d57555dfa2801a02a7e4065 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of snprintf() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <stdio.h>
 
-#include <stdlib.h>
+#include "signature.h"
+SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...));
+
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (int argc, char *argv[])
@@ -47,25 +39,25 @@ main (int argc, char *argv[])
       memcpy (buf, "DEADBEEF", 8);
       retval = snprintf (buf, size, "%d", 12345);
       if (size < 6)
-       {
+        {
 #if CHECK_SNPRINTF_POSIX
-         ASSERT (retval < 0 || retval >= size);
+          ASSERT (retval < 0 || retval >= size);
 #endif
-         if (size > 0)
-           {
-             ASSERT (memcmp (buf, "12345", size - 1) == 0);
-             ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
-           }
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
 #if !CHECK_SNPRINTF_POSIX
-         if (size > 0)
+          if (size > 0)
 #endif
-           ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
-       }
+            ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+        }
       else
-       {
-         ASSERT (retval == 5);
-         ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
-       }
+        {
+          ASSERT (retval == 5);
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
     }
 
   return 0;
index 30d53217a551cd962a7290262bb019222f068a27..560e0e534d3653dcec4ecaaebbf5ad5921afd3ae 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdbool.h> substitute.
-   Copyright (C) 2002-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009-2010 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
index c0a7515ecca1dfe0732bc7932ac2bed89724d0af..d047e57b6566bbd776555591b809bc332f9676cb 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stddef.h> substitute.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index 4e9b3621eeb3829d372c7cf8bbdacbb77a2f2249..9cec2e2f808b4af5ab7d1a07b9899972336a3f38 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 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
index 3f2f0677f0c7db62b28579e246d80d552ca36bad..87100576f0769b469e7c5eb4d48709995380eb9a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2010 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
@@ -29,6 +29,13 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
    per POSIX 2008.  */
 verify (sizeof NULL == sizeof (void *));
 
+/* Check that the types are all defined.  */
+fpos_t t1;
+off_t t2;
+size_t t3;
+ssize_t t4;
+va_list t5;
+
 int
 main (void)
 {
index fad5cf450e58bf42c1651dda278c752944e56a09..4bd8715f3d619615d80421bdb4f201cdc64e202d 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdlib.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 27eb969a7023ff54fd6f1d75d028729e91a80edb..11ab7e3939a9c74a38f74d82659ed41b7dbe1b32 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of strerror() function.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <config.h>
 
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (strerror, char *, (int));
+
+#include <errno.h>
+
+#include "macros.h"
 
 int
 main (void)
index 69df747eb675b6d820019029b2394cc6a42a3c6c..019a8174acbcd542226b742385fe864c66abc5be 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index aef8941071a79e50aa9c85b08ef8122925fdda02..3a06c64828ed914f89637cdf4d0f0405220a4d51 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/select.h> substitute.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index 606708dc1a5bdf49f71bb22c82c42313ec87cb9f..badf308b7a1468f25d0cbea48b2ffd9308727c7b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/socket.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 4a85c9f08b48f08899cf4848981551369b21d641..5f1aacd1cc982ac7ce1dbed4618097676613dd1e 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/stat.h> substitute.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index 74f35acfe41c2d6be77a768730fce0ec150b572a..2ab849e927ab3889529807b1babd506e74db036c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/time.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 4afa3b39881abaef3203ce5950a9583aeeb8a013..8e250bd2d5496cdd272191b3a848fecfb836236a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <time.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index dd907f4ebe9d4c227de732efcf2aae611df87930..ec02eeefcae397f195e6c1309f96624a102c92e8 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <unistd.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 2f3f8900d797ba9a80c5d45ee4196991767abe16..e2831420b43f87c1c20b97bcb4d8c14d7843371c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 #include "vasnprintf.h"
 
 #include <stdarg.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static char *
 my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
@@ -77,10 +66,10 @@ test_vasnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-       ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-       free (result);
+        free (result);
     }
 }
 
@@ -112,10 +101,10 @@ test_asnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-       ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-       free (result);
+        free (result);
     }
 }
 
index 12c93664d2141c37b462de60f81c0dc8da439c6a..110be03f54f3b580831fca2181ddca3512f191ea 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Unit tests for vc-list-files
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
index f1627e7e503b2cf7160f3c12524600751b37117e..7b7ff1a564c1cbf9af3c08ac66914ee9f05efdd5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Unit tests for vc-list-files
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
index 9ff97c45a8b12c22fdc61f277a18a4164faf1e52..fcc86218f87deac0c4c904adaea8af82cf9e3356 100644 (file)
@@ -1,5 +1,5 @@
 /* Test suite for version-etc.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNUlib Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,7 @@
 #define AUTHORS "Sergey Poznyakoff", "Eric Blake"
 
 int
-main (int argc _UNUSED_PARAMETER_, char **argv)
+main (int argc _GL_UNUSED, char **argv)
 {
   set_program_name (argv[0]);
   version_etc (stdout, "test-version-etc", "dummy", "0", AUTHORS,
index 528fadd9ece388c770849526529d6a8e0e2c3422..61d404684f6b5585319c66784ecea08061a0ea7a 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Test suite for version-etc.
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 # This file is part of the GNUlib Library.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -33,7 +33,8 @@ EOT
 
 ./test-version-etc${EXEEXT} --version |
  sed '1s/test-version-etc (.*) .*/test-version-etc (PROJECT) VERSION/
-      2s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
+      /^Packaged by/d
+      2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' |
  tr -d '\015' |
  diff -c $TMP - || ERR=1
 
index 2e60bb86db298b13e4dd656028ea8460a009fe1a..2a03d6b669d5a367193b721d16656ec975de4ba1 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <wchar.h> substitute.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index fac53f6fc4ac94e4452f9d1ee63712dd3d04c14f..bcd3f5a09dceebb70a7d97f726297f315dbf60a1 100644 (file)
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 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
 
        #if 4 <= __GNUC__
        # define verify(R) \
-          extern int (* verify_function__ (void)) \
-                     [__builtin_constant_p (R) && (R) ? 1 : -1]
+           extern int (* verify_function__ (void)) \
+                      [__builtin_constant_p (R) && (R) ? 1 : -1]
        #endif
 
    * In C++, any struct definition inside sizeof is invalid.
index 0622985b8197a31c1687b29f7231d306ca710ec1..b472bd0501c725c1c3a13ef9505b57b4cb66e669 100644 (file)
@@ -1,6 +1,6 @@
 /* w32sock.h --- internal auxilliary functions for Windows socket functions
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -32,7 +32,6 @@ static inline void
 set_winsock_errno (void)
 {
   int err = WSAGetLastError ();
-  WSASetLastError (0);
 
   /* Map some WSAE* errors to the runtime library's error codes.  */
   switch (err)
index a38a2cf4941ab810d59019f69b9458f8d66bcebe..cfab200871d555ae80ec05fef686067498fa314b 100644 (file)
@@ -1,5 +1,5 @@
 /* Return a pointer to a zero-size object in memory.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -57,11 +57,11 @@ zerosize_ptr (void)
     {
       int pagesize = getpagesize ();
       char *two_pages =
-       (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
-                      flags, fd, 0);
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
       if (two_pages != (char *)(-1)
-         && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
-       return two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        return two_pages + pagesize;
     }
 #endif
   return NULL;
index ef8d0ba8755997a9f4a194712658cfd5466440b8..d0c9830ec5db49479ef6794f3f96904d9fca079d 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -40,6 +40,8 @@
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -66,13 +68,14 @@ struct timespec
    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
 # if @REPLACE_NANOSLEEP@
 #  define nanosleep rpl_nanosleep
-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
 # if @REPLACE_MKTIME@
 #  define mktime rpl_mktime
-extern time_t mktime (struct tm *__tp);
+extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -83,10 +86,12 @@ extern time_t mktime (struct tm *__tp);
 #  define localtime_r rpl_localtime_r
 #  undef gmtime_r
 #  define gmtime_r rpl_gmtime_r
-struct tm *localtime_r (time_t const *restrict __timer,
-                       struct tm *restrict __result);
-struct tm *gmtime_r (time_t const *restrict __timer,
-                    struct tm *restrict __result);
+extern struct tm *localtime_r (time_t const *restrict __timer,
+                               struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
+extern struct tm *gmtime_r (time_t const *restrict __timer,
+                            struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
@@ -95,15 +100,17 @@ struct tm *gmtime_r (time_t const *restrict __timer,
 # if @REPLACE_STRPTIME@
 #  undef strptime
 #  define strptime rpl_strptime
-char *strptime (char const *restrict __buf, char const *restrict __format,
-               struct tm *restrict __tm);
+extern char *strptime (char const *restrict __buf,
+                       char const *restrict __format,
+                       struct tm *restrict __tm)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 
 /* Convert TM to a time_t value, assuming UTC.  */
 # if @REPLACE_TIMEGM@
 #  undef timegm
 #  define timegm rpl_timegm
-time_t timegm (struct tm *__tm);
+extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
index 73a4d8ec9369c3e67cafb1961d5ea9fd64c785ce..27c8b1713b8f26876c5b4b5e6f19cef926c4289b 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2010 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
 #include <stddef.h>
 
 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
+    && ! defined __GLIBC__
 # include <stdio.h>
 #endif
 
+/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+# include <fcntl.h>
+#endif
+
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
-#include <stdlib.h>
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdlib.h>
+#endif
 
-#if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@)   \
-     || (@GNULIB_READLINK@ && (!@HAVE_READLINK@ || @REPLACE_READLINK@)) \
-     || (@GNULIB_READLINKAT@ && !@HAVE_READLINKAT@))
+/* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
+#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
+     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# include <io.h>
+#endif
+
+#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+     || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK)
 /* Get ssize_t.  */
 # include <sys/types.h>
 #endif
 
-/* Get getopt(), optarg, optind, opterr, optopt.  */
-#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
+/* Get getopt(), optarg, optind, opterr, optopt.
+   But avoid namespace pollution on glibc systems.  */
+#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
 # include <getopt.h>
 #endif
 
 #  include <winsock2.h>
 #  if !defined _GL_SYS_SOCKET_H
 #   undef socket
-#   define socket              socket_used_without_including_sys_socket_h
+#   define socket               socket_used_without_including_sys_socket_h
 #   undef connect
-#   define connect             connect_used_without_including_sys_socket_h
+#   define connect              connect_used_without_including_sys_socket_h
 #   undef accept
-#   define accept              accept_used_without_including_sys_socket_h
+#   define accept               accept_used_without_including_sys_socket_h
 #   undef bind
-#   define bind                        bind_used_without_including_sys_socket_h
+#   define bind                 bind_used_without_including_sys_socket_h
 #   undef getpeername
-#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   define getpeername          getpeername_used_without_including_sys_socket_h
 #   undef getsockname
-#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   define getsockname          getsockname_used_without_including_sys_socket_h
 #   undef getsockopt
-#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   define getsockopt           getsockopt_used_without_including_sys_socket_h
 #   undef listen
-#   define listen              listen_used_without_including_sys_socket_h
+#   define listen               listen_used_without_including_sys_socket_h
 #   undef recv
-#   define recv                        recv_used_without_including_sys_socket_h
+#   define recv                 recv_used_without_including_sys_socket_h
 #   undef send
-#   define send                        send_used_without_including_sys_socket_h
+#   define send                 send_used_without_including_sys_socket_h
 #   undef recvfrom
-#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   define recvfrom             recvfrom_used_without_including_sys_socket_h
 #   undef sendto
-#   define sendto              sendto_used_without_including_sys_socket_h
+#   define sendto               sendto_used_without_including_sys_socket_h
 #   undef setsockopt
-#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   define setsockopt           setsockopt_used_without_including_sys_socket_h
 #   undef shutdown
-#   define shutdown            shutdown_used_without_including_sys_socket_h
+#   define shutdown             shutdown_used_without_including_sys_socket_h
 #  endif
 #  if !defined _GL_SYS_SELECT_H
 #   undef select
-#   define select              select_used_without_including_sys_select_h
+#   define select               select_used_without_including_sys_select_h
 #  endif
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* OS/2 EMX lacks these macros.  */
@@ -135,15 +157,16 @@ extern "C" {
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-extern int chown (const char *file, uid_t uid, gid_t gid);
+extern int chown (const char *file, uid_t uid, gid_t gid)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -159,10 +182,9 @@ extern int close (int);
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
@@ -186,10 +208,10 @@ extern int dup2 (int oldfd, int newfd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -208,10 +230,10 @@ extern int dup2 (int oldfd, int newfd);
 extern int dup3 (int oldfd, int newfd, int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -227,11 +249,17 @@ extern char **environ;
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef environ
-# define environ \
-    (GL_LINK_WARNING ("environ is unportable - " \
-                      "use gnulib module environ for portability"), \
-     environ)
+# if HAVE_RAW_DECL_ENVIRON
+static inline char ***
+rpl_environ (void)
+{
+  return &environ;
+}
+_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
+                 "use gnulib module environ for portability");
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
 #endif
 
 
@@ -239,27 +267,28 @@ extern char **environ;
 # if !@HAVE_EUIDACCESS@
 /* Like access(), except that it uses the effective user id and group id of
    the current process.  */
-extern int euidaccess (const char *filename, int mode);
+extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FACCESSAT@
 # if !@HAVE_FACCESSAT@
-int faccessat (int fd, char const *file, int mode, int flag);
+extern int faccessat (int fd, char const *file, int mode, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                        \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
@@ -273,7 +302,8 @@ int faccessat (int fd, char const *file, int mode, int flag);
 extern int fchdir (int /*fd*/);
 
 /* Gnulib internal hooks needed to maintain the fchdir metadata.  */
-extern int _gl_register_fd (int fd, const char *filename);
+extern int _gl_register_fd (int fd, const char *filename)
+     _GL_ARG_NONNULL ((2));
 extern void _gl_unregister_fd (int fd);
 extern int _gl_register_dup (int oldfd, int newfd);
 extern const char *_gl_directory_name (int fd);
@@ -281,10 +311,10 @@ extern const char *_gl_directory_name (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
@@ -294,14 +324,15 @@ extern const char *_gl_directory_name (int fd);
 #  define fchownat rpl_fchownat
 # endif
 # if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@
-extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
+extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                       \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -315,10 +346,10 @@ extern int fsync (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -332,17 +363,14 @@ extern int ftruncate (int fd, off_t length);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETCWD@
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-# include <stdlib.h>
 # if @REPLACE_GETCWD@
 /* Get the name of the current working directory, and put it in SIZE bytes
    of BUF.
@@ -359,10 +387,10 @@ extern char * getcwd (char *buf, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -378,14 +406,14 @@ extern char * getcwd (char *buf, size_t size);
    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
    Return 0 if successful, otherwise set errno and return -1.  */
 # if !@HAVE_GETDOMAINNAME@
-extern int getdomainname(char *name, size_t len);
+extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
@@ -397,10 +425,10 @@ extern int getdtablesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
@@ -419,10 +447,10 @@ int getgroups (int n, gid_t *groups);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -439,17 +467,40 @@ int getgroups (int n, gid_t *groups);
 #  define gethostname rpl_gethostname
 # endif
 # if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
-extern int gethostname(char *name, size_t len);
+extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif @UNISTD_H_HAVE_WINSOCK2_H@
 # undef gethostname
 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if !@HAVE_GETLOGIN@
+extern char *getlogin (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -462,16 +513,21 @@ extern int gethostname(char *name, size_t len);
    provided (this case is hopefully rare but is left open by the POSIX spec).
 
    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
  */
 # if !@HAVE_DECL_GETLOGIN_R@
-extern int getlogin_r (char *name, size_t size);
+extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -526,10 +582,10 @@ extern int getpagesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -546,20 +602,20 @@ extern void endusershell (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
@@ -574,14 +630,15 @@ extern void endusershell (void);
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-extern int lchown (char const *file, uid_t owner, gid_t group);
+extern int lchown (char const *file, uid_t owner, gid_t group)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
@@ -594,14 +651,15 @@ extern int lchown (char const *file, uid_t owner, gid_t group);
    See POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/link.html>.  */
 # if !@HAVE_LINK@ || @REPLACE_LINK@
-extern int link (const char *path1, const char *path2);
+extern int link (const char *path1, const char *path2)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
 #if @GNULIB_LINKAT@
@@ -614,14 +672,15 @@ extern int link (const char *path1, const char *path2);
    Return 0 if successful, otherwise -1 and errno set.  */
 # if !@HAVE_LINKAT@ || @REPLACE_LINKAT@
 extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
-                  int flag);
+                   int flag)
+     _GL_ARG_NONNULL ((2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define link(f1,path1,f2,path2,f)             \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
 #if @GNULIB_LSEEK@
@@ -635,10 +694,10 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -654,13 +713,34 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # if @HAVE_PIPE2@
 #  define pipe2 rpl_pipe2
 # endif
-extern int pipe2 (int fd[2], int flags);
+extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
+#endif
+
+
+#if @GNULIB_PREAD@
+# if @REPLACE_PREAD@
+#  define pread rpl_pread
+# endif
+/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
+   Return the number of bytes placed into BUF if successful, otherwise
+   set errno and return -1.  0 indicates EOF.  See the POSIX:2001
+   specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
+# if !@HAVE_PREAD@ || @REPLACE_PREAD@
+  extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
+       _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pread
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
@@ -674,27 +754,29 @@ extern int pipe2 (int fd[2], int flags);
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
 # if !@HAVE_READLINK@ || @REPLACE_READLINK@
-extern ssize_t readlink (const char *file, char *buf, size_t bufsize);
+extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_READLINKAT@
 # if !@HAVE_READLINKAT@
-ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
+extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                        \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -702,31 +784,35 @@ ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
 # if @REPLACE_RMDIR@
 #  define rmdir rpl_rmdir
 /* Remove the directory DIR.  */
-extern int rmdir (char const *name);
+extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SLEEP@
+# if @REPLACE_SLEEP@
+#  undef sleep
+#  define sleep rpl_sleep
+# endif
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if !@HAVE_SLEEP@
+# if !@HAVE_SLEEP@ || @REPLACE_SLEEP@
 extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
@@ -736,27 +822,29 @@ extern unsigned int sleep (unsigned int n);
 #  define symlink rpl_symlink
 # endif
 # if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
-int symlink (char const *contents, char const *file);
+extern int symlink (char const *contents, char const *file)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                       \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SYMLINKAT@
 # if !@HAVE_SYMLINKAT@
-int symlinkat (char const *contents, int fd, char const *file);
+extern int symlinkat (char const *contents, int fd, char const *file)
+     _GL_ARG_NONNULL ((1, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                           \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -764,14 +852,14 @@ int symlinkat (char const *contents, int fd, char const *file);
 # if @REPLACE_UNLINK@
 #  undef unlink
 #  define unlink rpl_unlink
-extern int unlink (char const *file);
+extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
@@ -781,14 +869,35 @@ extern int unlink (char const *file);
 #  define unlinkat rpl_unlinkat
 # endif
 # if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
-extern int unlinkat (int fd, char const *file, int flag);
+extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_USLEEP@
+# if @REPLACE_USLEEP@
+#  undef usleep
+#  define usleep rpl_usleep
+# endif
+# if !@HAVE_USLEEP@ || @REPLACE_USLEEP@
+/* Pause the execution of the current thread for N microseconds.
+   Returns 0 on completion, or -1 on range error.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+extern int usleep (useconds_t n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef usleep
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
@@ -798,7 +907,8 @@ extern int unlinkat (int fd, char const *file, int flag);
    <http://www.opengroup.org/susv3xsh/write.html>.  */
 # undef write
 # define write rpl_write
-extern ssize_t write (int fd, const void *buf, size_t count);
+extern ssize_t write (int fd, const void *buf, size_t count)
+     _GL_ARG_NONNULL ((2));
 #endif
 
 
index e47e00c748f2c869533d06bcedba728ad70664d9..99d921e9c789de9cbf9cb79896a7a1bfef24e31a 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2010 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
 # endif
 #endif
 
-#include <locale.h>    /* localeconv() */
-#include <stdio.h>     /* snprintf(), sprintf() */
-#include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
-#include <string.h>    /* memcpy(), strlen() */
-#include <errno.h>     /* errno */
-#include <limits.h>    /* CHAR_BIT */
-#include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
+#include <locale.h>     /* localeconv() */
+#include <stdio.h>      /* snprintf(), sprintf() */
+#include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
+#include <string.h>     /* memcpy(), strlen() */
+#include <errno.h>      /* errno */
+#include <limits.h>     /* CHAR_BIT */
+#include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */
 #if HAVE_NL_LANGINFO
 # include <langinfo.h>
 #endif
@@ -261,10 +261,10 @@ decimal_point_char (void)
 {
   const char *point;
   /* Determine it in a multithread-safe way.  We know nl_langinfo is
-     multithread-safe on glibc systems, but is not required to be multithread-
-     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
-     is rarely multithread-safe.  */
-#  if HAVE_NL_LANGINFO && __GLIBC__
+     multithread-safe on glibc systems and MacOS X systems, but is not required
+     to be multithread-safe by POSIX.  sprintf(), however, is multithread-safe.
+     localeconv() is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__))
   point = nl_langinfo (RADIXCHAR);
 #  elif 1
   char pointbuf[5];
@@ -364,26 +364,26 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
       dlen = len1 + len2;
       dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
       if (dp == NULL)
-       return NULL;
+        return NULL;
       for (k = len2; k > 0; )
-       dp[--k] = 0;
+        dp[--k] = 0;
       for (i = 0; i < len1; i++)
-       {
-         mp_limb_t digit1 = p1[i];
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < len2; j++)
-           {
-             mp_limb_t digit2 = p2[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             carry += dp[i + j];
-             dp[i + j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         dp[i + len2] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = p1[i];
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < len2; j++)
+            {
+              mp_limb_t digit2 = p2[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              carry += dp[i + j];
+              dp[i + j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          dp[i + len2] = (mp_limb_t) carry;
+        }
       /* Normalise.  */
       while (dlen > 0 && dp[dlen - 1] == 0)
-       dlen--;
+        dlen--;
       dest->nlimbs = dlen;
       dest->limbs = dp;
     }
@@ -477,12 +477,12 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   for (;;)
     {
       if (b_len == 0)
-       /* Division by zero.  */
-       abort ();
+        /* Division by zero.  */
+        abort ();
       if (b_ptr[b_len - 1] == 0)
-       b_len--;
+        b_len--;
       else
-       break;
+        break;
     }
 
   /* Here m = a_len >= 0 and n = b_len > 0.  */
@@ -499,261 +499,261 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   else if (b_len == 1)
     {
       /* n=1: single precision division.
-        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
+         beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
       r_ptr = roomptr;
       q_ptr = roomptr + 1;
       {
-       mp_limb_t den = b_ptr[0];
-       mp_limb_t remainder = 0;
-       const mp_limb_t *sourceptr = a_ptr + a_len;
-       mp_limb_t *destptr = q_ptr + a_len;
-       size_t count;
-       for (count = a_len; count > 0; count--)
-         {
-           mp_twolimb_t num =
-             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
-           *--destptr = num / den;
-           remainder = num % den;
-         }
-       /* Normalise and store r.  */
-       if (remainder > 0)
-         {
-           r_ptr[0] = remainder;
-           r_len = 1;
-         }
-       else
-         r_len = 0;
-       /* Normalise q.  */
-       q_len = a_len;
-       if (q_ptr[q_len - 1] == 0)
-         q_len--;
+        mp_limb_t den = b_ptr[0];
+        mp_limb_t remainder = 0;
+        const mp_limb_t *sourceptr = a_ptr + a_len;
+        mp_limb_t *destptr = q_ptr + a_len;
+        size_t count;
+        for (count = a_len; count > 0; count--)
+          {
+            mp_twolimb_t num =
+              ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
+            *--destptr = num / den;
+            remainder = num % den;
+          }
+        /* Normalise and store r.  */
+        if (remainder > 0)
+          {
+            r_ptr[0] = remainder;
+            r_len = 1;
+          }
+        else
+          r_len = 0;
+        /* Normalise q.  */
+        q_len = a_len;
+        if (q_ptr[q_len - 1] == 0)
+          q_len--;
       }
     }
   else
     {
       /* n>1: multiple precision division.
-        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
-        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
+         beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
+         beta^(m-n-1) <= a/b < beta^(m-n+1).  */
       /* Determine s.  */
       size_t s;
       {
-       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
-       s = 31;
-       if (msd >= 0x10000)
-         {
-           msd = msd >> 16;
-           s -= 16;
-         }
-       if (msd >= 0x100)
-         {
-           msd = msd >> 8;
-           s -= 8;
-         }
-       if (msd >= 0x10)
-         {
-           msd = msd >> 4;
-           s -= 4;
-         }
-       if (msd >= 0x4)
-         {
-           msd = msd >> 2;
-           s -= 2;
-         }
-       if (msd >= 0x2)
-         {
-           msd = msd >> 1;
-           s -= 1;
-         }
+        mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
+        s = 31;
+        if (msd >= 0x10000)
+          {
+            msd = msd >> 16;
+            s -= 16;
+          }
+        if (msd >= 0x100)
+          {
+            msd = msd >> 8;
+            s -= 8;
+          }
+        if (msd >= 0x10)
+          {
+            msd = msd >> 4;
+            s -= 4;
+          }
+        if (msd >= 0x4)
+          {
+            msd = msd >> 2;
+            s -= 2;
+          }
+        if (msd >= 0x2)
+          {
+            msd = msd >> 1;
+            s -= 1;
+          }
       }
       /* 0 <= s < GMP_LIMB_BITS.
-        Copy b, shifting it left by s bits.  */
+         Copy b, shifting it left by s bits.  */
       if (s > 0)
-       {
-         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
-         if (tmp_roomptr == NULL)
-           {
-             free (roomptr);
-             return NULL;
-           }
-         {
-           const mp_limb_t *sourceptr = b_ptr;
-           mp_limb_t *destptr = tmp_roomptr;
-           mp_twolimb_t accu = 0;
-           size_t count;
-           for (count = b_len; count > 0; count--)
-             {
-               accu += (mp_twolimb_t) *sourceptr++ << s;
-               *destptr++ = (mp_limb_t) accu;
-               accu = accu >> GMP_LIMB_BITS;
-             }
-           /* accu must be zero, since that was how s was determined.  */
-           if (accu != 0)
-             abort ();
-         }
-         b_ptr = tmp_roomptr;
-       }
+        {
+          tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
+          if (tmp_roomptr == NULL)
+            {
+              free (roomptr);
+              return NULL;
+            }
+          {
+            const mp_limb_t *sourceptr = b_ptr;
+            mp_limb_t *destptr = tmp_roomptr;
+            mp_twolimb_t accu = 0;
+            size_t count;
+            for (count = b_len; count > 0; count--)
+              {
+                accu += (mp_twolimb_t) *sourceptr++ << s;
+                *destptr++ = (mp_limb_t) accu;
+                accu = accu >> GMP_LIMB_BITS;
+              }
+            /* accu must be zero, since that was how s was determined.  */
+            if (accu != 0)
+              abort ();
+          }
+          b_ptr = tmp_roomptr;
+        }
       /* Copy a, shifting it left by s bits, yields r.
-        Memory layout:
-        At the beginning: r = roomptr[0..a_len],
-        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
+         Memory layout:
+         At the beginning: r = roomptr[0..a_len],
+         at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
       r_ptr = roomptr;
       if (s == 0)
-       {
-         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
-         r_ptr[a_len] = 0;
-       }
+        {
+          memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+          r_ptr[a_len] = 0;
+        }
       else
-       {
-         const mp_limb_t *sourceptr = a_ptr;
-         mp_limb_t *destptr = r_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *sourceptr++ << s;
-             *destptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         *destptr++ = (mp_limb_t) accu;
-       }
+        {
+          const mp_limb_t *sourceptr = a_ptr;
+          mp_limb_t *destptr = r_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *sourceptr++ << s;
+              *destptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          *destptr++ = (mp_limb_t) accu;
+        }
       q_ptr = roomptr + b_len;
       q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
       {
-       size_t j = a_len - b_len; /* m-n */
-       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
-       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
-       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
-         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
-       /* Division loop, traversed m-n+1 times.
-          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
-       for (;;)
-         {
-           mp_limb_t q_star;
-           mp_limb_t c1;
-           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
-             {
-               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
-               mp_twolimb_t num =
-                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
-                 | r_ptr[j + b_len - 1];
-               q_star = num / b_msd;
-               c1 = num % b_msd;
-             }
-           else
-             {
-               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
-               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
-               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
-                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
-                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
-                       {<= beta !}.
-                  If yes, jump directly to the subtraction loop.
-                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
-                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
-               if (r_ptr[j + b_len] > b_msd
-                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
-                 /* r[j+n] >= b[n-1]+1 or
-                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
-                    carry.  */
-                 goto subtract;
-             }
-           /* q_star = q*,
-              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
-           {
-             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
-               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
-             mp_twolimb_t c3 = /* b[n-2] * q* */
-               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
-             /* While c2 < c3, increase c2 and decrease c3.
-                Consider c3-c2.  While it is > 0, decrease it by
-                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
-                this can happen only twice.  */
-             if (c3 > c2)
-               {
-                 q_star = q_star - 1; /* q* := q* - 1 */
-                 if (c3 - c2 > b_msdd)
-                   q_star = q_star - 1; /* q* := q* - 1 */
-               }
-           }
-           if (q_star > 0)
-             subtract:
-             {
-               /* Subtract r := r - b * q* * beta^j.  */
-               mp_limb_t cr;
-               {
-                 const mp_limb_t *sourceptr = b_ptr;
-                 mp_limb_t *destptr = r_ptr + j;
-                 mp_twolimb_t carry = 0;
-                 size_t count;
-                 for (count = b_len; count > 0; count--)
-                   {
-                     /* Here 0 <= carry <= q*.  */
-                     carry =
-                       carry
-                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
-                       + (mp_limb_t) ~(*destptr);
-                     /* Here 0 <= carry <= beta*q* + beta-1.  */
-                     *destptr++ = ~(mp_limb_t) carry;
-                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
-                   }
-                 cr = (mp_limb_t) carry;
-               }
-               /* Subtract cr from r_ptr[j + b_len], then forget about
-                  r_ptr[j + b_len].  */
-               if (cr > r_ptr[j + b_len])
-                 {
-                   /* Subtraction gave a carry.  */
-                   q_star = q_star - 1; /* q* := q* - 1 */
-                   /* Add b back.  */
-                   {
-                     const mp_limb_t *sourceptr = b_ptr;
-                     mp_limb_t *destptr = r_ptr + j;
-                     mp_limb_t carry = 0;
-                     size_t count;
-                     for (count = b_len; count > 0; count--)
-                       {
-                         mp_limb_t source1 = *sourceptr++;
-                         mp_limb_t source2 = *destptr;
-                         *destptr++ = source1 + source2 + carry;
-                         carry =
-                           (carry
-                            ? source1 >= (mp_limb_t) ~source2
-                            : source1 > (mp_limb_t) ~source2);
-                       }
-                   }
-                   /* Forget about the carry and about r[j+n].  */
-                 }
-             }
-           /* q* is determined.  Store it as q[j].  */
-           q_ptr[j] = q_star;
-           if (j == 0)
-             break;
-           j--;
-         }
+        size_t j = a_len - b_len; /* m-n */
+        mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
+        mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
+        mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
+          ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
+        /* Division loop, traversed m-n+1 times.
+           j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
+        for (;;)
+          {
+            mp_limb_t q_star;
+            mp_limb_t c1;
+            if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
+              {
+                /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
+                mp_twolimb_t num =
+                  ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
+                  | r_ptr[j + b_len - 1];
+                q_star = num / b_msd;
+                c1 = num % b_msd;
+              }
+            else
+              {
+                /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
+                q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
+                /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
+                   <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
+                   <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
+                        {<= beta !}.
+                   If yes, jump directly to the subtraction loop.
+                   (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
+                    <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
+                if (r_ptr[j + b_len] > b_msd
+                    || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
+                  /* r[j+n] >= b[n-1]+1 or
+                     r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
+                     carry.  */
+                  goto subtract;
+              }
+            /* q_star = q*,
+               c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
+            {
+              mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
+                ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
+              mp_twolimb_t c3 = /* b[n-2] * q* */
+                (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
+              /* While c2 < c3, increase c2 and decrease c3.
+                 Consider c3-c2.  While it is > 0, decrease it by
+                 b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
+                 this can happen only twice.  */
+              if (c3 > c2)
+                {
+                  q_star = q_star - 1; /* q* := q* - 1 */
+                  if (c3 - c2 > b_msdd)
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                }
+            }
+            if (q_star > 0)
+              subtract:
+              {
+                /* Subtract r := r - b * q* * beta^j.  */
+                mp_limb_t cr;
+                {
+                  const mp_limb_t *sourceptr = b_ptr;
+                  mp_limb_t *destptr = r_ptr + j;
+                  mp_twolimb_t carry = 0;
+                  size_t count;
+                  for (count = b_len; count > 0; count--)
+                    {
+                      /* Here 0 <= carry <= q*.  */
+                      carry =
+                        carry
+                        + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
+                        + (mp_limb_t) ~(*destptr);
+                      /* Here 0 <= carry <= beta*q* + beta-1.  */
+                      *destptr++ = ~(mp_limb_t) carry;
+                      carry = carry >> GMP_LIMB_BITS; /* <= q* */
+                    }
+                  cr = (mp_limb_t) carry;
+                }
+                /* Subtract cr from r_ptr[j + b_len], then forget about
+                   r_ptr[j + b_len].  */
+                if (cr > r_ptr[j + b_len])
+                  {
+                    /* Subtraction gave a carry.  */
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                    /* Add b back.  */
+                    {
+                      const mp_limb_t *sourceptr = b_ptr;
+                      mp_limb_t *destptr = r_ptr + j;
+                      mp_limb_t carry = 0;
+                      size_t count;
+                      for (count = b_len; count > 0; count--)
+                        {
+                          mp_limb_t source1 = *sourceptr++;
+                          mp_limb_t source2 = *destptr;
+                          *destptr++ = source1 + source2 + carry;
+                          carry =
+                            (carry
+                             ? source1 >= (mp_limb_t) ~source2
+                             : source1 > (mp_limb_t) ~source2);
+                        }
+                    }
+                    /* Forget about the carry and about r[j+n].  */
+                  }
+              }
+            /* q* is determined.  Store it as q[j].  */
+            q_ptr[j] = q_star;
+            if (j == 0)
+              break;
+            j--;
+          }
       }
       r_len = b_len;
       /* Normalise q.  */
       if (q_ptr[q_len - 1] == 0)
-       q_len--;
+        q_len--;
 # if 0 /* Not needed here, since we need r only to compare it with b/2, and
-         b is shifted left by s bits.  */
+          b is shifted left by s bits.  */
       /* Shift r right by s bits.  */
       if (s > 0)
-       {
-         mp_limb_t ptr = r_ptr + r_len;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = r_len; count > 0; count--)
-           {
-             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
-             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
-             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
-           }
-       }
+        {
+          mp_limb_t ptr = r_ptr + r_len;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = r_len; count > 0; count--)
+            {
+              accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
+              accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
+              *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
+            }
+        }
 # endif
       /* Normalise r.  */
       while (r_len > 0 && r_ptr[r_len - 1] == 0)
-       r_len--;
+        r_len--;
     }
   /* Compare r << 1 with b.  */
   if (r_len > b_len)
@@ -762,17 +762,17 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     size_t i;
     for (i = b_len;;)
       {
-       mp_limb_t r_i =
-         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
-         | (i < r_len ? r_ptr[i] << 1 : 0);
-       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
-       if (r_i > b_i)
-         goto increment_q;
-       if (r_i < b_i)
-         goto keep_q;
-       if (i == 0)
-         break;
-       i--;
+        mp_limb_t r_i =
+          (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
+          | (i < r_len ? r_ptr[i] << 1 : 0);
+        mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
+        if (r_i > b_i)
+          goto increment_q;
+        if (r_i < b_i)
+          goto keep_q;
+        if (i == 0)
+          break;
+        i--;
       }
   }
   if (q_len > 0 && ((q_ptr[0] & 1) != 0))
@@ -781,8 +781,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     {
       size_t i;
       for (i = 0; i < q_len; i++)
-       if (++(q_ptr[i]) != 0)
-         goto keep_q;
+        if (++(q_ptr[i]) != 0)
+          goto keep_q;
       q_ptr[q_len++] = 1;
     }
   keep_q:
@@ -811,36 +811,36 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
     {
       char *d_ptr = c_ptr;
       for (; extra_zeroes > 0; extra_zeroes--)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       while (a_len > 0)
-       {
-         /* Divide a by 10^9, in-place.  */
-         mp_limb_t remainder = 0;
-         mp_limb_t *ptr = a_ptr + a_len;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             mp_twolimb_t num =
-               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
-             *ptr = num / 1000000000;
-             remainder = num % 1000000000;
-           }
-         /* Store the remainder as 9 decimal digits.  */
-         for (count = 9; count > 0; count--)
-           {
-             *d_ptr++ = '0' + (remainder % 10);
-             remainder = remainder / 10;
-           }
-         /* Normalize a.  */
-         if (a_ptr[a_len - 1] == 0)
-           a_len--;
-       }
+        {
+          /* Divide a by 10^9, in-place.  */
+          mp_limb_t remainder = 0;
+          mp_limb_t *ptr = a_ptr + a_len;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              mp_twolimb_t num =
+                ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
+              *ptr = num / 1000000000;
+              remainder = num % 1000000000;
+            }
+          /* Store the remainder as 9 decimal digits.  */
+          for (count = 9; count > 0; count--)
+            {
+              *d_ptr++ = '0' + (remainder % 10);
+              remainder = remainder / 10;
+            }
+          /* Normalize a.  */
+          if (a_ptr[a_len - 1] == 0)
+            a_len--;
+        }
       /* Remove leading zeroes.  */
       while (d_ptr > c_ptr && d_ptr[-1] == '0')
-       d_ptr--;
+        d_ptr--;
       /* But keep at least one zero.  */
       if (d_ptr == c_ptr)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       /* Terminate the string.  */
       *d_ptr = '\0';
     }
@@ -885,12 +885,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #   else
@@ -900,7 +900,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -912,12 +912,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
@@ -973,12 +973,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #   else
@@ -988,7 +988,7 @@ decode_double (double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -1000,12 +1000,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
   if (!(y == 0.0))
@@ -1063,8 +1063,8 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
   abs_n = (n >= 0 ? n : -n);
   abs_s = (s >= 0 ? s : -s);
   pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
-                                   + abs_s / GMP_LIMB_BITS + 1)
-                                  * sizeof (mp_limb_t));
+                                    + abs_s / GMP_LIMB_BITS + 1)
+                                   * sizeof (mp_limb_t));
   if (pow5_ptr == NULL)
     {
       free (memory);
@@ -1077,26 +1077,26 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
   if (abs_n > 0)
     {
       static mp_limb_t const small_pow5[13 + 1] =
-       {
-         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
-         48828125, 244140625, 1220703125
-       };
+        {
+          1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
+          48828125, 244140625, 1220703125
+        };
       unsigned int n13;
       for (n13 = 0; n13 <= abs_n; n13 += 13)
-       {
-         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
-         size_t j;
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < pow5_len; j++)
-           {
-             mp_limb_t digit2 = pow5_ptr[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             pow5_ptr[j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         if (carry > 0)
-           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
+          size_t j;
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < pow5_len; j++)
+            {
+              mp_limb_t digit2 = pow5_ptr[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              pow5_ptr[j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          if (carry > 0)
+            pow5_ptr[pow5_len++] = (mp_limb_t) carry;
+        }
     }
   s_limbs = abs_s / GMP_LIMB_BITS;
   s_bits = abs_s % GMP_LIMB_BITS;
@@ -1104,129 +1104,129 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
     {
       /* Multiply with 2^|s|.  */
       if (s_bits > 0)
-       {
-         mp_limb_t *ptr = pow5_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = pow5_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *ptr << s_bits;
-             *ptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         if (accu > 0)
-           {
-             *ptr = (mp_limb_t) accu;
-             pow5_len++;
-           }
-       }
+        {
+          mp_limb_t *ptr = pow5_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = pow5_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *ptr << s_bits;
+              *ptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          if (accu > 0)
+            {
+              *ptr = (mp_limb_t) accu;
+              pow5_len++;
+            }
+        }
       if (s_limbs > 0)
-       {
-         size_t count;
-         for (count = pow5_len; count > 0;)
-           {
-             count--;
-             pow5_ptr[s_limbs + count] = pow5_ptr[count];
-           }
-         for (count = s_limbs; count > 0;)
-           {
-             count--;
-             pow5_ptr[count] = 0;
-           }
-         pow5_len += s_limbs;
-       }
+        {
+          size_t count;
+          for (count = pow5_len; count > 0;)
+            {
+              count--;
+              pow5_ptr[s_limbs + count] = pow5_ptr[count];
+            }
+          for (count = s_limbs; count > 0;)
+            {
+              count--;
+              pow5_ptr[count] = 0;
+            }
+          pow5_len += s_limbs;
+        }
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* Multiply m with pow5.  No division needed.  */
-         z_memory = multiply (m, pow5, &z);
-       }
+        {
+          /* Multiply m with pow5.  No division needed.  */
+          z_memory = multiply (m, pow5, &z);
+        }
       else
-       {
-         /* Divide m by pow5 and round.  */
-         z_memory = divide (m, pow5, &z);
-       }
+        {
+          /* Divide m by pow5 and round.  */
+          z_memory = divide (m, pow5, &z);
+        }
     }
   else
     {
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* n >= 0, s < 0.
-            Multiply m with pow5, then divide by 2^|s|.  */
-         mpn_t numerator;
-         mpn_t denominator;
-         void *tmp_memory;
-         tmp_memory = multiply (m, pow5, &numerator);
-         if (tmp_memory == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         /* Construct 2^|s|.  */
-         {
-           mp_limb_t *ptr = pow5_ptr + pow5_len;
-           size_t i;
-           for (i = 0; i < s_limbs; i++)
-             ptr[i] = 0;
-           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
-           denominator.limbs = ptr;
-           denominator.nlimbs = s_limbs + 1;
-         }
-         z_memory = divide (numerator, denominator, &z);
-         free (tmp_memory);
-       }
+        {
+          /* n >= 0, s < 0.
+             Multiply m with pow5, then divide by 2^|s|.  */
+          mpn_t numerator;
+          mpn_t denominator;
+          void *tmp_memory;
+          tmp_memory = multiply (m, pow5, &numerator);
+          if (tmp_memory == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          /* Construct 2^|s|.  */
+          {
+            mp_limb_t *ptr = pow5_ptr + pow5_len;
+            size_t i;
+            for (i = 0; i < s_limbs; i++)
+              ptr[i] = 0;
+            ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
+            denominator.limbs = ptr;
+            denominator.nlimbs = s_limbs + 1;
+          }
+          z_memory = divide (numerator, denominator, &z);
+          free (tmp_memory);
+        }
       else
-       {
-         /* n < 0, s > 0.
-            Multiply m with 2^s, then divide by pow5.  */
-         mpn_t numerator;
-         mp_limb_t *num_ptr;
-         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
-                                         * sizeof (mp_limb_t));
-         if (num_ptr == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         {
-           mp_limb_t *destptr = num_ptr;
-           {
-             size_t i;
-             for (i = 0; i < s_limbs; i++)
-               *destptr++ = 0;
-           }
-           if (s_bits > 0)
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               mp_twolimb_t accu = 0;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 {
-                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
-                   *destptr++ = (mp_limb_t) accu;
-                   accu = accu >> GMP_LIMB_BITS;
-                 }
-               if (accu > 0)
-                 *destptr++ = (mp_limb_t) accu;
-             }
-           else
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 *destptr++ = *sourceptr++;
-             }
-           numerator.limbs = num_ptr;
-           numerator.nlimbs = destptr - num_ptr;
-         }
-         z_memory = divide (numerator, pow5, &z);
-         free (num_ptr);
-       }
+        {
+          /* n < 0, s > 0.
+             Multiply m with 2^s, then divide by pow5.  */
+          mpn_t numerator;
+          mp_limb_t *num_ptr;
+          num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
+                                          * sizeof (mp_limb_t));
+          if (num_ptr == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          {
+            mp_limb_t *destptr = num_ptr;
+            {
+              size_t i;
+              for (i = 0; i < s_limbs; i++)
+                *destptr++ = 0;
+            }
+            if (s_bits > 0)
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                mp_twolimb_t accu = 0;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  {
+                    accu += (mp_twolimb_t) *sourceptr++ << s_bits;
+                    *destptr++ = (mp_limb_t) accu;
+                    accu = accu >> GMP_LIMB_BITS;
+                  }
+                if (accu > 0)
+                  *destptr++ = (mp_limb_t) accu;
+              }
+            else
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  *destptr++ = *sourceptr++;
+              }
+            numerator.limbs = num_ptr;
+            numerator.nlimbs = destptr - num_ptr;
+          }
+          z_memory = divide (numerator, pow5, &z);
+          free (num_ptr);
+        }
     }
   free (pow5_ptr);
   free (memory);
@@ -1298,35 +1298,35 @@ floorlog10l (long double x)
   if (y < 0.5L)
     {
       while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
-       {
-         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0L / (1 << 16)))
-       {
-         y *= 1.0L * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0L * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0L / (1 << 8)))
-       {
-         y *= 1.0L * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0L * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0L / (1 << 4)))
-       {
-         y *= 1.0L * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0L * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0L / (1 << 2)))
-       {
-         y *= 1.0L * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0L * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0L / (1 << 1)))
-       {
-         y *= 1.0L * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0L * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5L && y < 1.0L))
     abort ();
@@ -1389,35 +1389,35 @@ floorlog10 (double x)
   if (y < 0.5)
     {
       while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
-       {
-         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0 / (1 << 16)))
-       {
-         y *= 1.0 * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0 * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0 / (1 << 8)))
-       {
-         y *= 1.0 * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0 * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0 / (1 << 4)))
-       {
-         y *= 1.0 * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0 * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0 / (1 << 2)))
-       {
-         y *= 1.0 * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0 * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0 / (1 << 1)))
-       {
-         y *= 1.0 * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0 * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5 && y < 1.0))
     abort ();
@@ -1476,7 +1476,7 @@ is_borderline (const char *digits, size_t precision)
 
 DCHAR_T *
 VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
-           const FCHAR_T *format, va_list args)
+            const FCHAR_T *format, va_list args)
 {
   DIRECTIVES d;
   arguments a;
@@ -1486,8 +1486,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     return NULL;
 
 #define CLEANUP() \
-  free (d.dir);                                                                \
-  if (a.arg)                                                           \
+  free (d.dir);                                                         \
+  if (a.arg)                                                            \
     free (a.arg);
 
   if (PRINTF_FETCHARGS (args, &a) < 0)
@@ -1516,30 +1516,30 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #if HAVE_ALLOCA
     if (buf_neededlength < 4000 / sizeof (TCHAR_T))
       {
-       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
-       buf_malloced = NULL;
+        buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
+        buf_malloced = NULL;
       }
     else
 #endif
       {
-       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
-       if (size_overflow_p (buf_memsize))
-         goto out_of_memory_1;
-       buf = (TCHAR_T *) malloc (buf_memsize);
-       if (buf == NULL)
-         goto out_of_memory_1;
-       buf_malloced = buf;
+        size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
+        if (size_overflow_p (buf_memsize))
+          goto out_of_memory_1;
+        buf = (TCHAR_T *) malloc (buf_memsize);
+        if (buf == NULL)
+          goto out_of_memory_1;
+        buf_malloced = buf;
       }
 
     if (resultbuf != NULL)
       {
-       result = resultbuf;
-       allocated = *lengthp;
+        result = resultbuf;
+        allocated = *lengthp;
       }
     else
       {
-       result = NULL;
-       allocated = 0;
+        result = NULL;
+        allocated = 0;
       }
     length = 0;
     /* Invariants:
@@ -1549,3881 +1549,3881 @@ 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) \
-    if ((needed) > allocated)                                               \
-      {                                                                             \
-       size_t memory_size;                                                  \
-       DCHAR_T *memory;                                                     \
-                                                                            \
-       allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
-       if ((needed) > allocated)                                            \
-         allocated = (needed);                                              \
-       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
-       if (size_overflow_p (memory_size))                                   \
-         goto out_of_memory;                                                \
-       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;                                                \
-       if (result == resultbuf && length > 0)                               \
-         DCHAR_CPY (memory, result, length);                                \
-       result = memory;                                                     \
+    if ((needed) > allocated)                                                \
+      {                                                                      \
+        size_t memory_size;                                                  \
+        DCHAR_T *memory;                                                     \
+                                                                             \
+        allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
+        if ((needed) > allocated)                                            \
+          allocated = (needed);                                              \
+        memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
+        if (size_overflow_p (memory_size))                                   \
+          goto out_of_memory;                                                \
+        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;                                                \
+        if (result == resultbuf && length > 0)                               \
+          DCHAR_CPY (memory, result, length);                                \
+        result = memory;                                                     \
       }
 
     for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
       {
-       if (cp != dp->dir_start)
-         {
-           size_t n = dp->dir_start - cp;
-           size_t augmented_length = xsum (length, n);
-
-           ENSURE_ALLOCATION (augmented_length);
-           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
-              need that the format string contains only ASCII characters
-              if FCHAR_T and DCHAR_T are not the same type.  */
-           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
-             {
-               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
-               length = augmented_length;
-             }
-           else
-             {
-               do
-                 result[length++] = (unsigned char) *cp++;
-               while (--n > 0);
-             }
-         }
-       if (i == d.count)
-         break;
-
-       /* Execute a single directive.  */
-       if (dp->conversion == '%')
-         {
-           size_t augmented_length;
-
-           if (!(dp->arg_index == ARG_NONE))
-             abort ();
-           augmented_length = xsum (length, 1);
-           ENSURE_ALLOCATION (augmented_length);
-           result[length] = '%';
-           length = augmented_length;
-         }
-       else
-         {
-           if (!(dp->arg_index != ARG_NONE))
-             abort ();
-
-           if (dp->conversion == 'n')
-             {
-               switch (a.arg[dp->arg_index].type)
-                 {
-                 case TYPE_COUNT_SCHAR_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
-                   break;
-                 case TYPE_COUNT_SHORT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
-                   break;
-                 case TYPE_COUNT_INT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
-                   break;
-                 case TYPE_COUNT_LONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
-                   break;
+        if (cp != dp->dir_start)
+          {
+            size_t n = dp->dir_start - cp;
+            size_t augmented_length = xsum (length, n);
+
+            ENSURE_ALLOCATION (augmented_length);
+            /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
+               need that the format string contains only ASCII characters
+               if FCHAR_T and DCHAR_T are not the same type.  */
+            if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
+              {
+                DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
+                length = augmented_length;
+              }
+            else
+              {
+                do
+                  result[length++] = (unsigned char) *cp++;
+                while (--n > 0);
+              }
+          }
+        if (i == d.count)
+          break;
+
+        /* Execute a single directive.  */
+        if (dp->conversion == '%')
+          {
+            size_t augmented_length;
+
+            if (!(dp->arg_index == ARG_NONE))
+              abort ();
+            augmented_length = xsum (length, 1);
+            ENSURE_ALLOCATION (augmented_length);
+            result[length] = '%';
+            length = augmented_length;
+          }
+        else
+          {
+            if (!(dp->arg_index != ARG_NONE))
+              abort ();
+
+            if (dp->conversion == 'n')
+              {
+                switch (a.arg[dp->arg_index].type)
+                  {
+                  case TYPE_COUNT_SCHAR_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
+                    break;
+                  case TYPE_COUNT_SHORT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_short_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_pointer = length;
+                    break;
+                  case TYPE_COUNT_LONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
+                    break;
 #if HAVE_LONG_LONG_INT
-                 case TYPE_COUNT_LONGLONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
-                   break;
+                  case TYPE_COUNT_LONGLONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
+                    break;
 #endif
-                 default:
-                   abort ();
-                 }
-             }
+                  default:
+                    abort ();
+                  }
+              }
 #if ENABLE_UNISTDIO
-           /* The unistdio extensions.  */
-           else if (dp->conversion == 'U')
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               switch (type)
-                 {
-                 case TYPE_U8_STRING:
-                   {
-                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
-                     const uint8_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u8_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+            /* The unistdio extensions.  */
+            else if (dp->conversion == 'U')
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                switch (type)
+                  {
+                  case TYPE_U8_STRING:
+                    {
+                      const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
+                      const uint8_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u8_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT8_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-8 to locale encoding.  */
-                       converted =
-                         u8_conv_to_encoding (locale_charset (),
-                                              iconveh_question_mark,
-                                              arg, arg_end - arg, NULL,
-                                              converted, &converted_len);
+                        /* Convert from UTF-8 to locale encoding.  */
+                        converted =
+                          u8_conv_to_encoding (locale_charset (),
+                                               iconveh_question_mark,
+                                               arg, arg_end - arg, NULL,
+                                               converted, &converted_len);
 #  else
-                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
-                       converted =
-                         U8_TO_DCHAR (arg, arg_end - arg,
-                                      converted, &converted_len);
+                        /* Convert from UTF-8 to UTF-16/UTF-32.  */
+                        converted =
+                          U8_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U16_STRING:
-                   {
-                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
-                     const uint16_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u16_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U16_STRING:
+                    {
+                      const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
+                      const uint16_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u16_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT16_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-16 to locale encoding.  */
-                       converted =
-                         u16_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-16 to locale encoding.  */
+                        converted =
+                          u16_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
-                       converted =
-                         U16_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-16 to UTF-8/UTF-32.  */
+                        converted =
+                          U16_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U32_STRING:
-                   {
-                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
-                     const uint32_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u32_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U32_STRING:
+                    {
+                      const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
+                      const uint32_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u32_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT32_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-32 to locale encoding.  */
-                       converted =
-                         u32_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-32 to locale encoding.  */
+                        converted =
+                          u32_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
-                       converted =
-                         U32_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-32 to UTF-8/UTF-16.  */
+                        converted =
+                          U32_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 default:
-                   abort ();
-                 }
-             }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  default:
+                    abort ();
+                  }
+              }
 #endif
 #if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T
-           else if (dp->conversion == 's'
+            else if (dp->conversion == 's'
 # if WIDE_CHAR_VERSION
-                    && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
 # else
-                    && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
 # endif
-                   )
-             {
-               /* The normal handling of the 's' directive below requires
-                  allocating a temporary buffer.  The determination of its
-                  length (tmp_length), in the case when a precision is
-                  specified, below requires a conversion between a char[]
-                  string and a wchar_t[] wide string.  It could be done, but
-                  we have no guarantee that the implementation of sprintf will
-                  use the exactly same algorithm.  Without this guarantee, it
-                  is possible to have buffer overrun bugs.  In order to avoid
-                  such bugs, we implement the entire processing of the 's'
-                  directive ourselves.  */
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
+                    )
+              {
+                /* The normal handling of the 's' directive below requires
+                   allocating a temporary buffer.  The determination of its
+                   length (tmp_length), in the case when a precision is
+                   specified, below requires a conversion between a char[]
+                   string and a wchar_t[] wide string.  It could be done, but
+                   we have no guarantee that the implementation of sprintf will
+                   use the exactly same algorithm.  Without this guarantee, it
+                   is possible to have buffer overrun bugs.  In order to avoid
+                   such bugs, we implement the entire processing of the 's'
+                   directive ourselves.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
 
 # if WIDE_CHAR_VERSION
-               /* %s in vasnwprintf.  See the specification of fwprintf.  */
-               {
-                 const char *arg = a.arg[dp->arg_index].a.a_string;
-                 const char *arg_end;
-                 size_t characters;
-
-                 if (has_precision)
-                   {
-                     /* Use only as many bytes as needed to produce PRECISION
-                        wide characters, from the left.  */
+                /* %s in vasnwprintf.  See the specification of fwprintf.  */
+                {
+                  const char *arg = a.arg[dp->arg_index].a.a_string;
+                  const char *arg_end;
+                  size_t characters;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many bytes as needed to produce PRECISION
+                         wide characters, from the left.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (; precision > 0; precision--)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (; precision > 0; precision--)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else if (has_width)
-                   {
-                     /* Use the entire string, and count the number of wide
-                        characters.  */
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else if (has_width)
+                    {
+                      /* Use the entire string, and count the number of wide
+                         characters.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + strlen (arg);
-                     /* The number of characters doesn't matter.  */
-                     characters = 0;
-                   }
-
-                 if (has_width && width > characters
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of wide characters in advance.  */
-                     size_t remaining;
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + strlen (arg);
+                      /* The number of characters doesn't matter.  */
+                      characters = 0;
+                    }
+
+                  if (has_width && width > characters
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of wide characters in advance.  */
+                      size_t remaining;
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; remaining--)
-                       {
-                         wchar_t wc;
-                         int count;
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; remaining--)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     while (arg < arg_end)
-                       {
-                         wchar_t wc;
-                         int count;
+                      while (arg < arg_end)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, 1));
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                   }
-
-                 if (has_width && width > characters
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, 1));
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                    }
+
+                  if (has_width && width > characters
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
 # else
-               /* %ls in vasnprintf.  See the specification of fprintf.  */
-               {
-                 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
-                 const wchar_t *arg_end;
-                 size_t characters;
+                /* %ls in vasnprintf.  See the specification of fprintf.  */
+                {
+                  const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                  const wchar_t *arg_end;
+                  size_t characters;
 #  if !DCHAR_IS_TCHAR
-                 /* This code assumes that TCHAR_T is 'char'.  */
-                 typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
-                 TCHAR_T *tmpsrc;
-                 DCHAR_T *tmpdst;
-                 size_t tmpdst_len;
+                  /* This code assumes that TCHAR_T is 'char'.  */
+                  typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
+                  TCHAR_T *tmpsrc;
+                  DCHAR_T *tmpdst;
+                  size_t tmpdst_len;
 #  endif
-                 size_t w;
-
-                 if (has_precision)
-                   {
-                     /* Use only as many wide characters as needed to produce
-                        at most PRECISION bytes, from the left.  */
-#  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                  size_t w;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many wide characters as needed to produce
+                         at most PRECISION bytes, from the left.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     while (precision > 0)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
-#  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                      arg_end = arg;
+                      characters = 0;
+                      while (precision > 0)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         if (precision < count)
-                           break;
-                         arg_end++;
-                         characters += count;
-                         precision -= count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          if (precision < count)
+                            break;
+                          arg_end++;
+                          characters += count;
+                          precision -= count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else if (has_width)
+                  else if (has_width)
 #  else
-                 else
+                  else
 #  endif
-                   {
-                     /* Use the entire string, and count the number of
-                        bytes.  */
-#  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                    {
+                      /* Use the entire string, and count the number of
+                         bytes.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
-#  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end++;
-                         characters += count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end++;
+                          characters += count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + local_wcslen (arg);
-                     /* The number of bytes doesn't matter.  */
-                     characters = 0;
-                   }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + local_wcslen (arg);
+                      /* The number of bytes doesn't matter.  */
+                      characters = 0;
+                    }
 #  endif
 
 #  if !DCHAR_IS_TCHAR
-                 /* Convert the string into a piece of temporary memory.  */
-                 tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
-                 if (tmpsrc == NULL)
-                   goto out_of_memory;
-                 {
-                   TCHAR_T *tmpptr = tmpsrc;
-                   size_t remaining;
-#   if HAVE_WCRTOMB
-                   mbstate_t state;
-                   memset (&state, '\0', sizeof (mbstate_t));
+                  /* Convert the string into a piece of temporary memory.  */
+                  tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
+                  if (tmpsrc == NULL)
+                    goto out_of_memory;
+                  {
+                    TCHAR_T *tmpptr = tmpsrc;
+                    size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                    mbstate_t state;
+                    memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                   for (remaining = characters; remaining > 0; )
-                     {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                       int count;
-
-                       if (*arg == 0)
-                         abort ();
-#   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                    for (remaining = characters; remaining > 0; )
+                      {
+                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                        int count;
+
+                        if (*arg == 0)
+                          abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                        count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                        count = wctomb (cbuf, *arg);
 #   endif
-                       if (count <= 0)
-                         /* Inconsistency.  */
-                         abort ();
-                       memcpy (tmpptr, buf, count);
-                       tmpptr += count;
-                       arg++;
-                       remaining -= count;
-                     }
-                   if (!(arg == arg_end))
-                     abort ();
-                 }
-
-                 /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                 tmpdst =
-                   DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                             iconveh_question_mark,
-                                             tmpsrc, characters,
-                                             NULL,
-                                             NULL, &tmpdst_len);
-                 if (tmpdst == NULL)
-                   {
-                     int saved_errno = errno;
-                     free (tmpsrc);
-                     if (!(result == resultbuf || result == NULL))
-                       free (result);
-                     if (buf_malloced != NULL)
-                       free (buf_malloced);
-                     CLEANUP ();
-                     errno = saved_errno;
-                     return NULL;
-                   }
-                 free (tmpsrc);
+                        if (count <= 0)
+                          /* Inconsistency.  */
+                          abort ();
+                        memcpy (tmpptr, cbuf, count);
+                        tmpptr += count;
+                        arg++;
+                        remaining -= count;
+                      }
+                    if (!(arg == arg_end))
+                      abort ();
+                  }
+
+                  /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                  tmpdst =
+                    DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                              iconveh_question_mark,
+                                              tmpsrc, characters,
+                                              NULL,
+                                              NULL, &tmpdst_len);
+                  if (tmpdst == NULL)
+                    {
+                      int saved_errno = errno;
+                      free (tmpsrc);
+                      if (!(result == resultbuf || result == NULL))
+                        free (result);
+                      if (buf_malloced != NULL)
+                        free (buf_malloced);
+                      CLEANUP ();
+                      errno = saved_errno;
+                      return NULL;
+                    }
+                  free (tmpsrc);
 #  endif
 
-                 if (has_width)
-                   {
+                  if (has_width)
+                    {
 #  if ENABLE_UNISTDIO
-                     /* Outside POSIX, it's preferrable to compare the width
-                        against the number of _characters_ of the converted
-                        value.  */
-                     w = DCHAR_MBSNLEN (result + length, characters);
+                      /* Outside POSIX, it's preferrable to compare the width
+                         against the number of _characters_ of the converted
+                         value.  */
+                      w = DCHAR_MBSNLEN (result + length, characters);
 #  else
-                     /* The width is compared against the number of _bytes_
-                        of the converted value, says POSIX.  */
-                     w = characters;
+                      /* The width is compared against the number of _bytes_
+                         of the converted value, says POSIX.  */
+                      w = characters;
 #  endif
-                   }
-                 else
-                   /* w doesn't matter.  */
-                   w = 0;
-
-                 if (has_width && width > w
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
+                    }
+                  else
+                    /* w doesn't matter.  */
+                    w = 0;
+
+                  if (has_width && width > w
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
 
 #  if DCHAR_IS_TCHAR
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of bytes in advance.  */
-                     size_t remaining;
-#   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; )
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg == 0)
-                           abort ();
-#   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; )
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                         remaining -= count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
-#   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                          remaining -= count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     while (arg < arg_end)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg == 0)
-                           abort ();
-#   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                      while (arg < arg_end)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                       }
-                   }
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, count));
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                        }
+                    }
 #  else
-                 ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                 free (tmpdst);
-                 length += tmpdst_len;
+                  ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                  DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                  free (tmpdst);
+                  length += tmpdst_len;
 #  endif
 
-                 if (has_width && width > w
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
-             }
+                  if (has_width && width > w
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+              }
 # endif
 #endif
 #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
-           else if ((dp->conversion == 'a' || dp->conversion == 'A')
+            else if ((dp->conversion == 'a' || dp->conversion == 'A')
 # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
-                    && (0
+                     && (0
 #  if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 #  endif
 #  if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 #  endif
-                       )
+                        )
 # endif
-                   )
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* Allocate a temporary buffer of sufficient size.  */
-               if (type == TYPE_LONGDOUBLE)
-                 tmp_length =
-                   (unsigned int) ((LDBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               else
-                 tmp_length =
-                   (unsigned int) ((DBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               if (tmp_length < precision)
-                 tmp_length = precision;
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
-
-               if (tmp_length < width)
-                 tmp_length = width;
-
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
-
-               pad_ptr = NULL;
-               p = tmp;
-               if (type == TYPE_LONGDOUBLE)
-                 {
+                    )
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* Allocate a temporary buffer of sufficient size.  */
+                if (type == TYPE_LONGDOUBLE)
+                  tmp_length =
+                    (unsigned int) ((LDBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                else
+                  tmp_length =
+                    (unsigned int) ((DBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                if (tmp_length < precision)
+                  tmp_length = precision;
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                pad_ptr = NULL;
+                p = tmp;
+                if (type == TYPE_LONGDOUBLE)
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           long double mantissa;
-
-                           if (arg > 0.0L)
-                             mantissa = printf_frexpl (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0L;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               long double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0L;
-                                 }
-                               if (tail != 0.0L)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625L;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0L || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0L)
-                                   {
-                                     mantissa *= 16.0L;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            long double mantissa;
+
+                            if (arg > 0.0L)
+                              mantissa = printf_frexpl (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0L;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                long double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0L;
+                                  }
+                                if (tail != 0.0L)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625L;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0L || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0L)
+                                    {
+                                      mantissa *= 16.0L;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               else
-                 {
+                  }
+                else
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           double mantissa;
-
-                           if (arg > 0.0)
-                             mantissa = printf_frexp (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5 : tail > 0.5)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0;
-                                 }
-                               if (tail != 0.0)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0 || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0)
-                                   {
-                                     mantissa *= 16.0;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            double mantissa;
+
+                            if (arg > 0.0)
+                              mantissa = printf_frexp (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5 : tail > 0.5)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0;
+                                  }
+                                if (tail != 0.0)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0 || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0)
+                                    {
+                                      mantissa *= 16.0;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
-                     }
+                          }
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                  }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
 #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
-           else if ((dp->conversion == 'f' || dp->conversion == 'F'
-                     || dp->conversion == 'e' || dp->conversion == 'E'
-                     || dp->conversion == 'g' || dp->conversion == 'G'
-                     || dp->conversion == 'a' || dp->conversion == 'A')
-                    && (0
+            else if ((dp->conversion == 'f' || dp->conversion == 'F'
+                      || dp->conversion == 'e' || dp->conversion == 'E'
+                      || dp->conversion == 'g' || dp->conversion == 'G'
+                      || dp->conversion == 'a' || dp->conversion == 'A')
+                     && (0
 # if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 # elif NEED_PRINTF_INFINITE_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
-                            /* The systems (mingw) which produce wrong output
-                               for Inf, -Inf, and NaN also do so for -0.0.
-                               Therefore we treat this case here as well.  */
-                            && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
+                         || (a.arg[dp->arg_index].type == TYPE_DOUBLE
+                             /* The systems (mingw) which produce wrong output
+                                for Inf, -Inf, and NaN also do so for -0.0.
+                                Therefore we treat this case here as well.  */
+                             && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
 # endif
 # if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 # elif NEED_PRINTF_INFINITE_LONG_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
-                            /* Some systems produce wrong output for Inf,
-                               -Inf, and NaN.  Some systems in this category
-                               (IRIX 5.3) also do so for -0.0.  Therefore we
-                               treat this case here as well.  */
-                            && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
+                         || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                             /* Some systems produce wrong output for Inf,
+                                -Inf, and NaN.  Some systems in this category
+                                (IRIX 5.3) also do so for -0.0.  Therefore we
+                                treat this case here as well.  */
+                             && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
 # endif
-                       ))
-             {
+                        ))
+              {
 # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
-               arg_type type = a.arg[dp->arg_index].type;
+                arg_type type = a.arg[dp->arg_index].type;
 # endif
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* POSIX specifies the default precision to be 6 for %f, %F,
-                  %e, %E, but not for %g, %G.  Implementations appear to use
-                  the same default precision also for %g, %G.  But for %a, %A,
-                  the default precision is 0.  */
-               if (!has_precision)
-                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
-                   precision = 6;
-
-               /* Allocate a temporary buffer of sufficient size.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* POSIX specifies the default precision to be 6 for %f, %F,
+                   %e, %E, but not for %g, %G.  Implementations appear to use
+                   the same default precision also for %g, %G.  But for %a, %A,
+                   the default precision is 0.  */
+                if (!has_precision)
+                  if (!(dp->conversion == 'a' || dp->conversion == 'A'))
+                    precision = 6;
+
+                /* Allocate a temporary buffer of sufficient size.  */
 # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
 # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
 # elif NEED_PRINTF_LONG_DOUBLE
-               tmp_length = LDBL_DIG + 1;
+                tmp_length = LDBL_DIG + 1;
 # elif NEED_PRINTF_DOUBLE
-               tmp_length = DBL_DIG + 1;
+                tmp_length = DBL_DIG + 1;
 # else
-               tmp_length = 0;
+                tmp_length = 0;
 # endif
-               if (tmp_length < precision)
-                 tmp_length = precision;
+                if (tmp_length < precision)
+                  tmp_length = precision;
 # if NEED_PRINTF_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                     if (!(isnanl (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                      if (!(isnanl (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10l (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
 # if NEED_PRINTF_DOUBLE
 #  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-               if (type == TYPE_DOUBLE)
+                if (type == TYPE_DOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     double arg = a.arg[dp->arg_index].a.a_double;
-                     if (!(isnand (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      double arg = a.arg[dp->arg_index].a.a_double;
+                      if (!(isnand (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10 (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
 
-               if (tmp_length < width)
-                 tmp_length = width;
+                if (tmp_length < width)
+                  tmp_length = width;
 
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
 
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
 
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 
-               pad_ptr = NULL;
-               p = tmp;
+                pad_ptr = NULL;
+                p = tmp;
 
 # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 {
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_LONG_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_long_double (arg, precision);
-                               if (digits == NULL)
-                                 {
-                                   END_LONG_DOUBLE_ROUNDING ();
-                                   goto out_of_memory;
-                                 }
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0L)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)precision - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_long_double (arg, precision);
+                                if (digits == NULL)
+                                  {
+                                    END_LONG_DOUBLE_ROUNDING ();
+                                    goto out_of_memory;
+                                  }
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0L)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   { '%', '+', '.', '2', 'd', '\0' };
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    { '%', '+', '.', '2', 'd', '\0' };
+                                  SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               if (sizeof (DCHAR_T) == 1)
-                                 {
-                                   sprintf ((char *) p, "%+.2d", exponent);
-                                   while (*p != '\0')
-                                     p++;
-                                 }
-                               else
-                                 {
-                                   char expbuf[6 + 1];
-                                   const char *ep;
-                                   sprintf (expbuf, "%+.2d", exponent);
-                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                     p++;
-                                 }
+                                if (sizeof (DCHAR_T) == 1)
+                                  {
+                                    sprintf ((char *) p, "%+.2d", exponent);
+                                    while (*p != '\0')
+                                      p++;
+                                  }
+                                else
+                                  {
+                                    char expbuf[6 + 1];
+                                    const char *ep;
+                                    sprintf (expbuf, "%+.2d", exponent);
+                                    for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                      p++;
+                                  }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0L)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0L)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] =
-                                           { '%', '+', '.', '2', 'd', '\0' };
-                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            { '%', '+', '.', '2', 'd', '\0' };
+                                          SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       if (sizeof (DCHAR_T) == 1)
-                                         {
-                                           sprintf ((char *) p, "%+.2d", exponent);
-                                           while (*p != '\0')
-                                             p++;
-                                         }
-                                       else
-                                         {
-                                           char expbuf[6 + 1];
-                                           const char *ep;
-                                           sprintf (expbuf, "%+.2d", exponent);
-                                           for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                             p++;
-                                         }
+                                        if (sizeof (DCHAR_T) == 1)
+                                          {
+                                            sprintf ((char *) p, "%+.2d", exponent);
+                                            while (*p != '\0')
+                                              p++;
+                                          }
+                                        else
+                                          {
+                                            char expbuf[6 + 1];
+                                            const char *ep;
+                                            sprintf (expbuf, "%+.2d", exponent);
+                                            for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                              p++;
+                                          }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0L))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'a' || dp->conversion == 'A')
-                             {
-                               *p++ = '0';
-                               *p++ = dp->conversion - 'A' + 'X';
-                               pad_ptr = p;
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion - 'A' + 'P';
-                               *p++ = '+';
-                               *p++ = '0';
-                             }
-                           else
-                             abort ();
+                            /* arg is finite.  */
+                            if (!(arg == 0.0L))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'a' || dp->conversion == 'A')
+                              {
+                                *p++ = '0';
+                                *p++ = dp->conversion - 'A' + 'X';
+                                pad_ptr = p;
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion - 'A' + 'P';
+                                *p++ = '+';
+                                *p++ = '0';
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
-                 }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
+                  }
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               else
+                else
 #  endif
 # endif
 # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-                 {
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_double (arg, precision);
-                               if (digits == NULL)
-                                 goto out_of_memory;
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)precision - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_double (arg, precision);
+                                if (digits == NULL)
+                                  goto out_of_memory;
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)precision - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   /* Produce the same number of exponent digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    /* Produce the same number of exponent digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   { '%', '+', '.', '3', 'd', '\0' };
+                                    { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                   { '%', '+', '.', '2', 'd', '\0' };
+                                    { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                  SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               {
-                                 static const char decimal_format[] =
-                                   /* Produce the same number of exponent digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const char decimal_format[] =
+                                    /* Produce the same number of exponent digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   "%+.3d";
+                                    "%+.3d";
 #    else
-                                   "%+.2d";
+                                    "%+.2d";
 #    endif
-                                 if (sizeof (DCHAR_T) == 1)
-                                   {
-                                     sprintf ((char *) p, decimal_format, exponent);
-                                     while (*p != '\0')
-                                       p++;
-                                   }
-                                 else
-                                   {
-                                     char expbuf[6 + 1];
-                                     const char *ep;
-                                     sprintf (expbuf, decimal_format, exponent);
-                                     for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                       p++;
-                                   }
-                               }
+                                  if (sizeof (DCHAR_T) == 1)
+                                    {
+                                      sprintf ((char *) p, decimal_format, exponent);
+                                      while (*p != '\0')
+                                        p++;
+                                    }
+                                  else
+                                    {
+                                      char expbuf[6 + 1];
+                                      const char *ep;
+                                      sprintf (expbuf, decimal_format, exponent);
+                                      for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                        p++;
+                                    }
+                                }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] =
-                                           /* Produce the same number of exponent digits
-                                              as the native printf implementation.  */
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            /* Produce the same number of exponent digits
+                                               as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           { '%', '+', '.', '3', 'd', '\0' };
+                                            { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                           { '%', '+', '.', '2', 'd', '\0' };
+                                            { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                          SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       {
-                                         static const char decimal_format[] =
-                                           /* Produce the same number of exponent digits
-                                              as the native printf implementation.  */
+                                        {
+                                          static const char decimal_format[] =
+                                            /* Produce the same number of exponent digits
+                                               as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           "%+.3d";
+                                            "%+.3d";
 #    else
-                                           "%+.2d";
+                                            "%+.2d";
 #    endif
-                                         if (sizeof (DCHAR_T) == 1)
-                                           {
-                                             sprintf ((char *) p, decimal_format, exponent);
-                                             while (*p != '\0')
-                                               p++;
-                                           }
-                                         else
-                                           {
-                                             char expbuf[6 + 1];
-                                             const char *ep;
-                                             sprintf (expbuf, decimal_format, exponent);
-                                             for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                               p++;
-                                           }
-                                       }
+                                          if (sizeof (DCHAR_T) == 1)
+                                            {
+                                              sprintf ((char *) p, decimal_format, exponent);
+                                              while (*p != '\0')
+                                                p++;
+                                            }
+                                          else
+                                            {
+                                              char expbuf[6 + 1];
+                                              const char *ep;
+                                              sprintf (expbuf, decimal_format, exponent);
+                                              for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                                p++;
+                                            }
+                                        }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               /* Produce the same number of exponent digits as
-                                  the native printf implementation.  */
+                            /* arg is finite.  */
+                            if (!(arg == 0.0))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                /* Produce the same number of exponent digits as
+                                   the native printf implementation.  */
 #   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                               *p++ = '0';
+                                *p++ = '0';
 #   endif
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else
-                             abort ();
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
-                     }
-                 }
+                          }
+                      }
+                  }
 # endif
 
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
-           else
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
+            else
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_width;
-               size_t width;
+                int has_width;
+                size_t width;
 #endif
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_precision;
-               size_t precision;
+                int has_precision;
+                size_t precision;
 #endif
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               int prec_ourselves;
+                int prec_ourselves;
 #else
-#              define prec_ourselves 0
+#               define prec_ourselves 0
 #endif
 #if NEED_PRINTF_FLAG_LEFTADJUST
-#              define pad_ourselves 1
+#               define pad_ourselves 1
 #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               int pad_ourselves;
+                int pad_ourselves;
 #else
-#              define pad_ourselves 0
+#               define pad_ourselves 0
 #endif
-               TCHAR_T *fbp;
-               unsigned int prefix_count;
-               int prefixes[2] IF_LINT (= { 0 });
+                TCHAR_T *fbp;
+                unsigned int prefix_count;
+                int prefixes[2] IF_LINT (= { 0 });
 #if !USE_SNPRINTF
-               size_t tmp_length;
-               TCHAR_T tmpbuf[700];
-               TCHAR_T *tmp;
+                size_t tmp_length;
+                TCHAR_T tmpbuf[700];
+                TCHAR_T *tmp;
 #endif
 
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
 #endif
 
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
 #endif
 
-               /* Decide whether to handle the precision ourselves.  */
+                /* Decide whether to handle the precision ourselves.  */
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               switch (dp->conversion)
-                 {
-                 case 'd': case 'i': case 'u':
-                 case 'o':
-                 case 'x': case 'X': case 'p':
-                   prec_ourselves = has_precision && (precision > 0);
-                   break;
-                 default:
-                   prec_ourselves = 0;
-                   break;
-                 }
+                switch (dp->conversion)
+                  {
+                  case 'd': case 'i': case 'u':
+                  case 'o':
+                  case 'x': case 'X': case 'p':
+                    prec_ourselves = has_precision && (precision > 0);
+                    break;
+                  default:
+                    prec_ourselves = 0;
+                    break;
+                  }
 #endif
 
-               /* Decide whether to perform the padding ourselves.  */
+                /* Decide whether to perform the padding ourselves.  */
 #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
-               switch (dp->conversion)
-                 {
+                switch (dp->conversion)
+                  {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
-                    to perform the padding after this conversion.  Functions
-                    with unistdio extensions perform the padding based on
-                    character count rather than element count.  */
-                 case 'c': case 's':
+                  /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
+                     to perform the padding after this conversion.  Functions
+                     with unistdio extensions perform the padding based on
+                     character count rather than element count.  */
+                  case 'c': case 's':
 # endif
 # if NEED_PRINTF_FLAG_ZERO
-                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-                 case 'a': case 'A':
+                  case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                  case 'a': case 'A':
 # endif
-                   pad_ourselves = 1;
-                   break;
-                 default:
-                   pad_ourselves = prec_ourselves;
-                   break;
-                 }
+                    pad_ourselves = 1;
+                    break;
+                  default:
+                    pad_ourselves = prec_ourselves;
+                    break;
+                  }
 #endif
 
 #if !USE_SNPRINTF
-               /* Allocate a temporary buffer of sufficient size for calling
-                  sprintf.  */
-               {
-                 switch (dp->conversion)
-                   {
+                /* Allocate a temporary buffer of sufficient size for calling
+                   sprintf.  */
+                {
+                  switch (dp->conversion)
+                    {
 
-                   case 'd': case 'i': case 'u':
+                    case 'd': case 'i': case 'u':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
-                     tmp_length = xsum (tmp_length, tmp_length);
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'o':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+                      tmp_length = xsum (tmp_length, tmp_length);
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'o':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'x': case 'X':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'x': case 'X':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 2, to account for a leading sign or alternate form.  */
-                     tmp_length = xsum (tmp_length, 2);
-                     break;
-
-                   case 'f': case 'F':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'e': case 'E': case 'g': case 'G':
-                     tmp_length =
-                       12; /* sign, decimal point, exponent etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'a': case 'A':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Account for sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, 12);
-                     break;
-
-                   case 'c':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 2, to account for a leading sign or alternate form.  */
+                      tmp_length = xsum (tmp_length, 2);
+                      break;
+
+                    case 'f': case 'F':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'e': case 'E': case 'g': case 'G':
+                      tmp_length =
+                        12; /* sign, decimal point, exponent etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'a': case 'A':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Account for sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, 12);
+                      break;
+
+                    case 'c':
 # if HAVE_WINT_T && !WIDE_CHAR_VERSION
-                     if (type == TYPE_WIDE_CHAR)
-                       tmp_length = MB_CUR_MAX;
-                     else
+                      if (type == TYPE_WIDE_CHAR)
+                        tmp_length = MB_CUR_MAX;
+                      else
 # endif
-                       tmp_length = 1;
-                     break;
+                        tmp_length = 1;
+                      break;
 
-                   case 's':
+                    case 's':
 # if HAVE_WCHAR_T
-                     if (type == TYPE_WIDE_STRING)
-                       {
+                      if (type == TYPE_WIDE_STRING)
+                        {
 #  if WIDE_CHAR_VERSION
-                         /* ISO C says about %ls in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the array, the array shall
-                               contain a null wide character."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         const wchar_t *arg =
-                           a.arg[dp->arg_index].a.a_wide_string;
-
-                         if (has_precision)
-                           tmp_length = local_wcsnlen (arg, precision);
-                         else
-                           tmp_length = local_wcslen (arg);
+                          /* ISO C says about %ls in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the array, the array shall
+                                contain a null wide character."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          const wchar_t *arg =
+                            a.arg[dp->arg_index].a.a_wide_string;
+
+                          if (has_precision)
+                            tmp_length = local_wcsnlen (arg, precision);
+                          else
+                            tmp_length = local_wcslen (arg);
 #  else
-                         /* ISO C says about %ls in fprintf:
-                              "If a precision is specified, no more than that
-                               many bytes are written (including shift
-                               sequences, if any), and the array shall contain
-                               a null wide character if, to equal the
-                               multibyte character sequence length given by
-                               the precision, the function would need to
-                               access a wide character one past the end of the
-                               array."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %ls in fprintf:
+                               "If a precision is specified, no more than that
+                                many bytes are written (including shift
+                                sequences, if any), and the array shall contain
+                                a null wide character if, to equal the
+                                multibyte character sequence length given by
+                                the precision, the function would need to
+                                access a wide character one past the end of the
+                                array."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 #  endif
-                       }
-                     else
+                        }
+                      else
 # endif
-                       {
+                        {
 # if WIDE_CHAR_VERSION
-                         /* ISO C says about %s in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the converted array, the
-                               converted array shall contain a null wide
-                               character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %s in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the converted array, the
+                                converted array shall contain a null wide
+                                character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 # else
-                         /* ISO C says about %s in fprintf:
-                              "If the precision is not specified or greater
-                               than the size of the array, the array shall
-                               contain a null character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-
-                         if (has_precision)
-                           tmp_length = local_strnlen (arg, precision);
-                         else
-                           tmp_length = strlen (arg);
+                          /* ISO C says about %s in fprintf:
+                               "If the precision is not specified or greater
+                                than the size of the array, the array shall
+                                contain a null character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+
+                          if (has_precision)
+                            tmp_length = local_strnlen (arg, precision);
+                          else
+                            tmp_length = strlen (arg);
 # endif
-                       }
-                     break;
-
-                   case 'p':
-                     tmp_length =
-                       (unsigned int) (sizeof (void *) * CHAR_BIT
-                                       * 0.25 /* binary -> hexadecimal */
-                                      )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading 0x */
-                     break;
-
-                   default:
-                     abort ();
-                   }
-
-                 if (!pad_ourselves)
-                   {
+                        }
+                      break;
+
+                    case 'p':
+                      tmp_length =
+                        (unsigned int) (sizeof (void *) * CHAR_BIT
+                                        * 0.25 /* binary -> hexadecimal */
+                                       )
+                          + 1 /* turn floor into ceil */
+                          + 2; /* account for leading 0x */
+                      break;
+
+                    default:
+                      abort ();
+                    }
+
+                  if (!pad_ourselves)
+                    {
 # if ENABLE_UNISTDIO
-                     /* Padding considers the number of characters, therefore
-                        the number of elements after padding may be
-                          > max (tmp_length, width)
-                        but is certainly
-                          <= tmp_length + width.  */
-                     tmp_length = xsum (tmp_length, width);
+                      /* Padding considers the number of characters, therefore
+                         the number of elements after padding may be
+                           > max (tmp_length, width)
+                         but is certainly
+                           <= tmp_length + width.  */
+                      tmp_length = xsum (tmp_length, width);
 # else
-                     /* Padding considers the number of elements,
-                        says POSIX.  */
-                     if (tmp_length < width)
-                       tmp_length = width;
+                      /* Padding considers the number of elements,
+                         says POSIX.  */
+                      if (tmp_length < width)
+                        tmp_length = width;
 # endif
-                   }
-
-                 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-               }
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (TCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    }
+
+                  tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+                }
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (TCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 #endif
 
-               /* Construct the format string for calling snprintf or
-                  sprintf.  */
-               fbp = buf;
-               *fbp++ = '%';
+                /* Construct the format string for calling snprintf or
+                   sprintf.  */
+                fbp = buf;
+                *fbp++ = '%';
 #if NEED_PRINTF_FLAG_GROUPING
-               /* The underlying implementation doesn't support the ' flag.
-                  Produce no grouping characters in this case; this is
-                  acceptable because the grouping is locale dependent.  */
+                /* The underlying implementation doesn't support the ' flag.
+                   Produce no grouping characters in this case; this is
+                   acceptable because the grouping is locale dependent.  */
 #else
-               if (flags & FLAG_GROUP)
-                 *fbp++ = '\'';
+                if (flags & FLAG_GROUP)
+                  *fbp++ = '\'';
 #endif
-               if (flags & FLAG_LEFT)
-                 *fbp++ = '-';
-               if (flags & FLAG_SHOWSIGN)
-                 *fbp++ = '+';
-               if (flags & FLAG_SPACE)
-                 *fbp++ = ' ';
-               if (flags & FLAG_ALT)
-                 *fbp++ = '#';
-               if (!pad_ourselves)
-                 {
-                   if (flags & FLAG_ZERO)
-                     *fbp++ = '0';
-                   if (dp->width_start != dp->width_end)
-                     {
-                       size_t n = dp->width_end - dp->width_start;
-                       /* The width specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->width_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-               if (!prec_ourselves)
-                 {
-                   if (dp->precision_start != dp->precision_end)
-                     {
-                       size_t n = dp->precision_end - dp->precision_start;
-                       /* The precision specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->precision_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-
-               switch (type)
-                 {
+                if (flags & FLAG_LEFT)
+                  *fbp++ = '-';
+                if (flags & FLAG_SHOWSIGN)
+                  *fbp++ = '+';
+                if (flags & FLAG_SPACE)
+                  *fbp++ = ' ';
+                if (flags & FLAG_ALT)
+                  *fbp++ = '#';
+                if (!pad_ourselves)
+                  {
+                    if (flags & FLAG_ZERO)
+                      *fbp++ = '0';
+                    if (dp->width_start != dp->width_end)
+                      {
+                        size_t n = dp->width_end - dp->width_start;
+                        /* The width specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->width_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+                if (!prec_ourselves)
+                  {
+                    if (dp->precision_start != dp->precision_end)
+                      {
+                        size_t n = dp->precision_end - dp->precision_start;
+                        /* The precision specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->precision_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+
+                switch (type)
+                  {
 #if HAVE_LONG_LONG_INT
-                 case TYPE_LONGLONGINT:
-                 case TYPE_ULONGLONGINT:
+                  case TYPE_LONGLONGINT:
+                  case TYPE_ULONGLONGINT:
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                   *fbp++ = 'I';
-                   *fbp++ = '6';
-                   *fbp++ = '4';
-                   break;
+                    *fbp++ = 'I';
+                    *fbp++ = '6';
+                    *fbp++ = '4';
+                    break;
 # else
-                   *fbp++ = 'l';
-                   /*FALLTHROUGH*/
+                    *fbp++ = 'l';
+                    /*FALLTHROUGH*/
 # endif
 #endif
-                 case TYPE_LONGINT:
-                 case TYPE_ULONGINT:
+                  case TYPE_LONGINT:
+                  case TYPE_ULONGINT:
 #if HAVE_WINT_T
-                 case TYPE_WIDE_CHAR:
+                  case TYPE_WIDE_CHAR:
 #endif
 #if HAVE_WCHAR_T
-                 case TYPE_WIDE_STRING:
+                  case TYPE_WIDE_STRING:
 #endif
-                   *fbp++ = 'l';
-                   break;
-                 case TYPE_LONGDOUBLE:
-                   *fbp++ = 'L';
-                   break;
-                 default:
-                   break;
-                 }
+                    *fbp++ = 'l';
+                    break;
+                  case TYPE_LONGDOUBLE:
+                    *fbp++ = 'L';
+                    break;
+                  default:
+                    break;
+                  }
 #if NEED_PRINTF_DIRECTIVE_F
-               if (dp->conversion == 'F')
-                 *fbp = 'f';
-               else
+                if (dp->conversion == 'F')
+                  *fbp = 'f';
+                else
 #endif
-                 *fbp = dp->conversion;
+                  *fbp = dp->conversion;
 #if USE_SNPRINTF
 # if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-               fbp[1] = '%';
-               fbp[2] = 'n';
-               fbp[3] = '\0';
+                fbp[1] = '%';
+                fbp[2] = 'n';
+                fbp[3] = '\0';
 # else
-               /* On glibc2 systems from glibc >= 2.3 - probably also older
-                  ones - we know that snprintf's returns value conforms to
-                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
-                  Therefore we can avoid using %n in this situation.
-                  On glibc2 systems from 2004-10-18 or newer, the use of %n
-                  in format strings in writable memory may crash the program
-                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
-                  in this situation.  */
-               /* On native Win32 systems (such as mingw), we can avoid using
-                  %n because:
-                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
-                      snprintf does not write more than the specified number
-                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
-                      '4', '5', '6' into buf, not '4', '5', '\0'.)
-                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
-                      allows us to recognize the case of an insufficient
-                      buffer size: it returns -1 in this case.
-                  On native Win32 systems (such as mingw) where the OS is
-                  Windows Vista, the use of %n in format strings by default
-                  crashes the program. See
-                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
-                    <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
-                  So we should avoid %n in this situation.  */
-               fbp[1] = '\0';
+                /* On glibc2 systems from glibc >= 2.3 - probably also older
+                   ones - we know that snprintf's returns value conforms to
+                   ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
+                   Therefore we can avoid using %n in this situation.
+                   On glibc2 systems from 2004-10-18 or newer, the use of %n
+                   in format strings in writable memory may crash the program
+                   (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+                   in this situation.  */
+                /* On native Win32 systems (such as mingw), we can avoid using
+                   %n because:
+                     - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+                       snprintf does not write more than the specified number
+                       of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+                       '4', '5', '6' into buf, not '4', '5', '\0'.)
+                     - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+                       allows us to recognize the case of an insufficient
+                       buffer size: it returns -1 in this case.
+                   On native Win32 systems (such as mingw) where the OS is
+                   Windows Vista, the use of %n in format strings by default
+                   crashes the program. See
+                     <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+                     <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
+                   So we should avoid %n in this situation.  */
+                fbp[1] = '\0';
 # endif
 #else
-               fbp[1] = '\0';
+                fbp[1] = '\0';
 #endif
 
-               /* Construct the arguments for calling snprintf or sprintf.  */
-               prefix_count = 0;
-               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
-                 }
-               if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
-                 }
+                /* Construct the arguments for calling snprintf or sprintf.  */
+                prefix_count = 0;
+                if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
+                  }
+                if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
+                  }
 
 #if USE_SNPRINTF
-               /* The SNPRINTF result is appended after result[0..length].
-                  The latter is an array of DCHAR_T; SNPRINTF appends an
-                  array of TCHAR_T to it.  This is possible because
-                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
-                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
+                /* The SNPRINTF result is appended after result[0..length].
+                   The latter is an array of DCHAR_T; SNPRINTF appends an
+                   array of TCHAR_T to it.  This is possible because
+                   sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
+                   alignof (TCHAR_T) <= alignof (DCHAR_T).  */
 # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
-               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
-                  where an snprintf() with maxlen==1 acts like sprintf().  */
-               ENSURE_ALLOCATION (xsum (length,
-                                        (2 + TCHARS_PER_DCHAR - 1)
-                                        / TCHARS_PER_DCHAR));
-               /* Prepare checking whether snprintf returns the count
-                  via %n.  */
-               *(TCHAR_T *) (result + length) = '\0';
+                /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
+                   where an snprintf() with maxlen==1 acts like sprintf().  */
+                ENSURE_ALLOCATION (xsum (length,
+                                         (2 + TCHARS_PER_DCHAR - 1)
+                                         / TCHARS_PER_DCHAR));
+                /* Prepare checking whether snprintf returns the count
+                   via %n.  */
+                *(TCHAR_T *) (result + length) = '\0';
 #endif
 
-               for (;;)
-                 {
-                   int count = -1;
+                for (;;)
+                  {
+                    int count = -1;
 
 #if USE_SNPRINTF
-                   int retcount = 0;
-                   size_t maxlen = allocated - length;
-                   /* SNPRINTF can fail if its second argument is
-                      > INT_MAX.  */
-                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
-                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
-                   maxlen = maxlen * TCHARS_PER_DCHAR;
+                    int retcount = 0;
+                    size_t maxlen = allocated - length;
+                    /* SNPRINTF can fail if its second argument is
+                       > INT_MAX.  */
+                    if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
+                      maxlen = INT_MAX / TCHARS_PER_DCHAR;
+                    maxlen = maxlen * TCHARS_PER_DCHAR;
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            arg, &count);                  \
-                       break;                                              \
-                     case 1:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], arg, &count);     \
-                       break;                                              \
-                     case 2:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], prefixes[1], arg, \
-                                            &count);                       \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             arg, &count);                  \
+                        break;                                              \
+                      case 1:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], arg, &count);     \
+                        break;                                              \
+                      case 2:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], prefixes[1], arg, \
+                                             &count);                       \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #else
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       count = sprintf (tmp, buf, arg);                    \
-                       break;                                              \
-                     case 1:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], arg);       \
-                       break;                                              \
-                     case 2:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
-                                        arg);                              \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        count = sprintf (tmp, buf, arg);                    \
+                        break;                                              \
+                      case 1:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], arg);       \
+                        break;                                              \
+                      case 2:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
+                                         arg);                              \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #endif
 
-                   switch (type)
-                     {
-                     case TYPE_SCHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_schar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UCHAR:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_SHORT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_short;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_USHORT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_INT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_int;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UINT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGINT:
-                       {
-                         long int arg = a.arg[dp->arg_index].a.a_longint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGINT:
-                       {
-                         unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                    switch (type)
+                      {
+                      case TYPE_SCHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_schar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UCHAR:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_SHORT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_short;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_USHORT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_int;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGINT:
+                        {
+                          long int arg = a.arg[dp->arg_index].a.a_longint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGINT:
+                        {
+                          unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_LONG_LONG_INT
-                     case TYPE_LONGLONGINT:
-                       {
-                         long long int arg = a.arg[dp->arg_index].a.a_longlongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGLONGINT:
-                       {
-                         unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_LONGLONGINT:
+                        {
+                          long long int arg = a.arg[dp->arg_index].a.a_longlongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGLONGINT:
+                        {
+                          unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_DOUBLE:
-                       {
-                         double arg = a.arg[dp->arg_index].a.a_double;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGDOUBLE:
-                       {
-                         long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_CHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_DOUBLE:
+                        {
+                          double arg = a.arg[dp->arg_index].a.a_double;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGDOUBLE:
+                        {
+                          long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_CHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WINT_T
-                     case TYPE_WIDE_CHAR:
-                       {
-                         wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_CHAR:
+                        {
+                          wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_STRING:
-                       {
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_STRING:
+                        {
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WCHAR_T
-                     case TYPE_WIDE_STRING:
-                       {
-                         const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_STRING:
+                        {
+                          const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_POINTER:
-                       {
-                         void *arg = a.arg[dp->arg_index].a.a_pointer;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     default:
-                       abort ();
-                     }
+                      case TYPE_POINTER:
+                        {
+                          void *arg = a.arg[dp->arg_index].a.a_pointer;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      default:
+                        abort ();
+                      }
 
 #if USE_SNPRINTF
-                   /* Portability: Not all implementations of snprintf()
-                      are ISO C 99 compliant.  Determine the number of
-                      bytes that snprintf() has produced or would have
-                      produced.  */
-                   if (count >= 0)
-                     {
-                       /* Verify that snprintf() has NUL-terminated its
-                          result.  */
-                       if (count < maxlen
-                           && ((TCHAR_T *) (result + length)) [count] != '\0')
-                         abort ();
-                       /* Portability hack.  */
-                       if (retcount > count)
-                         count = retcount;
-                     }
-                   else
-                     {
-                       /* snprintf() doesn't understand the '%n'
-                          directive.  */
-                       if (fbp[1] != '\0')
-                         {
-                           /* Don't use the '%n' directive; instead, look
-                              at the snprintf() return value.  */
-                           fbp[1] = '\0';
-                           continue;
-                         }
-                       else
-                         {
-                           /* Look at the snprintf() return value.  */
-                           if (retcount < 0)
-                             {
-                               /* HP-UX 10.20 snprintf() is doubly deficient:
-                                  It doesn't understand the '%n' directive,
-                                  *and* it returns -1 (rather than the length
-                                  that would have been required) when the
-                                  buffer is too small.  */
-                               size_t bigger_need =
-                                 xsum (xtimes (allocated, 2), 12);
-                               ENSURE_ALLOCATION (bigger_need);
-                               continue;
-                             }
-                           else
-                             count = retcount;
-                         }
-                     }
+                    /* Portability: Not all implementations of snprintf()
+                       are ISO C 99 compliant.  Determine the number of
+                       bytes that snprintf() has produced or would have
+                       produced.  */
+                    if (count >= 0)
+                      {
+                        /* Verify that snprintf() has NUL-terminated its
+                           result.  */
+                        if (count < maxlen
+                            && ((TCHAR_T *) (result + length)) [count] != '\0')
+                          abort ();
+                        /* Portability hack.  */
+                        if (retcount > count)
+                          count = retcount;
+                      }
+                    else
+                      {
+                        /* snprintf() doesn't understand the '%n'
+                           directive.  */
+                        if (fbp[1] != '\0')
+                          {
+                            /* Don't use the '%n' directive; instead, look
+                               at the snprintf() return value.  */
+                            fbp[1] = '\0';
+                            continue;
+                          }
+                        else
+                          {
+                            /* Look at the snprintf() return value.  */
+                            if (retcount < 0)
+                              {
+                                /* HP-UX 10.20 snprintf() is doubly deficient:
+                                   It doesn't understand the '%n' directive,
+                                   *and* it returns -1 (rather than the length
+                                   that would have been required) when the
+                                   buffer is too small.  */
+                                size_t bigger_need =
+                                  xsum (xtimes (allocated, 2), 12);
+                                ENSURE_ALLOCATION (bigger_need);
+                                continue;
+                              }
+                            else
+                              count = retcount;
+                          }
+                      }
 #endif
 
-                   /* Attempt to handle failure.  */
-                   if (count < 0)
-                     {
-                       if (!(result == resultbuf || result == NULL))
-                         free (result);
-                       if (buf_malloced != NULL)
-                         free (buf_malloced);
-                       CLEANUP ();
-                       errno = EINVAL;
-                       return NULL;
-                     }
+                    /* Attempt to handle failure.  */
+                    if (count < 0)
+                      {
+                        if (!(result == resultbuf || result == NULL))
+                          free (result);
+                        if (buf_malloced != NULL)
+                          free (buf_malloced);
+                        CLEANUP ();
+                        errno = EINVAL;
+                        return NULL;
+                      }
 
 #if USE_SNPRINTF
-                   /* Handle overflow of the allocated buffer.
-                      If such an overflow occurs, a C99 compliant snprintf()
-                      returns a count >= maxlen.  However, a non-compliant
-                      snprintf() function returns only count = maxlen - 1.  To
-                      cover both cases, test whether count >= maxlen - 1.  */
-                   if ((unsigned int) count + 1 >= maxlen)
-                     {
-                       /* If maxlen already has attained its allowed maximum,
-                          allocating more memory will not increase maxlen.
-                          Instead of looping, bail out.  */
-                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
-                         goto overflow;
-                       else
-                         {
-                           /* Need at least (count + 1) * sizeof (TCHAR_T)
-                              bytes.  (The +1 is for the trailing NUL.)
-                              But ask for (count + 2) * sizeof (TCHAR_T)
-                              bytes, so that in the next round, we likely get
-                                maxlen > (unsigned int) count + 1
-                              and so we don't get here again.
-                              And allocate proportionally, to avoid looping
-                              eternally if snprintf() reports a too small
-                              count.  */
-                           size_t n =
-                             xmax (xsum (length,
-                                         ((unsigned int) count + 2
-                                          + TCHARS_PER_DCHAR - 1)
-                                         / TCHARS_PER_DCHAR),
-                                   xtimes (allocated, 2));
-
-                           ENSURE_ALLOCATION (n);
-                           continue;
-                         }
-                     }
+                    /* Handle overflow of the allocated buffer.
+                       If such an overflow occurs, a C99 compliant snprintf()
+                       returns a count >= maxlen.  However, a non-compliant
+                       snprintf() function returns only count = maxlen - 1.  To
+                       cover both cases, test whether count >= maxlen - 1.  */
+                    if ((unsigned int) count + 1 >= maxlen)
+                      {
+                        /* If maxlen already has attained its allowed maximum,
+                           allocating more memory will not increase maxlen.
+                           Instead of looping, bail out.  */
+                        if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
+                          goto overflow;
+                        else
+                          {
+                            /* Need at least (count + 1) * sizeof (TCHAR_T)
+                               bytes.  (The +1 is for the trailing NUL.)
+                               But ask for (count + 2) * sizeof (TCHAR_T)
+                               bytes, so that in the next round, we likely get
+                                 maxlen > (unsigned int) count + 1
+                               and so we don't get here again.
+                               And allocate proportionally, to avoid looping
+                               eternally if snprintf() reports a too small
+                               count.  */
+                            size_t n =
+                              xmax (xsum (length,
+                                          ((unsigned int) count + 2
+                                           + TCHARS_PER_DCHAR - 1)
+                                          / TCHARS_PER_DCHAR),
+                                    xtimes (allocated, 2));
+
+                            ENSURE_ALLOCATION (n);
+                            continue;
+                          }
+                      }
 #endif
 
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (prec_ourselves)
-                     {
-                       /* Handle the precision.  */
-                       TCHAR_T *prec_ptr =
+                    if (prec_ourselves)
+                      {
+                        /* Handle the precision.  */
+                        TCHAR_T *prec_ptr =
 # if USE_SNPRINTF
-                         (TCHAR_T *) (result + length);
+                          (TCHAR_T *) (result + length);
 # else
-                         tmp;
+                          tmp;
 # endif
-                       size_t prefix_count;
-                       size_t move;
-
-                       prefix_count = 0;
-                       /* Put the additional zeroes after the sign.  */
-                       if (count >= 1
-                           && (*prec_ptr == '-' || *prec_ptr == '+'
-                               || *prec_ptr == ' '))
-                         prefix_count = 1;
-                       /* Put the additional zeroes after the 0x prefix if
-                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
-                       else if (count >= 2
-                                && prec_ptr[0] == '0'
-                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
-                         prefix_count = 2;
-
-                       move = count - prefix_count;
-                       if (precision > move)
-                         {
-                           /* Insert zeroes.  */
-                           size_t insert = precision - move;
-                           TCHAR_T *prec_end;
+                        size_t prefix_count;
+                        size_t move;
+
+                        prefix_count = 0;
+                        /* Put the additional zeroes after the sign.  */
+                        if (count >= 1
+                            && (*prec_ptr == '-' || *prec_ptr == '+'
+                                || *prec_ptr == ' '))
+                          prefix_count = 1;
+                        /* Put the additional zeroes after the 0x prefix if
+                           (flags & FLAG_ALT) || (dp->conversion == 'p').  */
+                        else if (count >= 2
+                                 && prec_ptr[0] == '0'
+                                 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
+                          prefix_count = 2;
+
+                        move = count - prefix_count;
+                        if (precision > move)
+                          {
+                            /* Insert zeroes.  */
+                            size_t insert = precision - move;
+                            TCHAR_T *prec_end;
 
 # if USE_SNPRINTF
-                           size_t n =
-                             xsum (length,
-                                   (count + insert + TCHARS_PER_DCHAR - 1)
-                                   / TCHARS_PER_DCHAR);
-                           length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
-                           ENSURE_ALLOCATION (n);
-                           length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
-                           prec_ptr = (TCHAR_T *) (result + length);
+                            size_t n =
+                              xsum (length,
+                                    (count + insert + TCHARS_PER_DCHAR - 1)
+                                    / TCHARS_PER_DCHAR);
+                            length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                            ENSURE_ALLOCATION (n);
+                            length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                            prec_ptr = (TCHAR_T *) (result + length);
 # endif
 
-                           prec_end = prec_ptr + count;
-                           prec_ptr += prefix_count;
+                            prec_end = prec_ptr + count;
+                            prec_ptr += prefix_count;
 
-                           while (prec_end > prec_ptr)
-                             {
-                               prec_end--;
-                               prec_end[insert] = prec_end[0];
-                             }
+                            while (prec_end > prec_ptr)
+                              {
+                                prec_end--;
+                                prec_end[insert] = prec_end[0];
+                              }
 
-                           prec_end += insert;
-                           do
-                             *--prec_end = '0';
-                           while (prec_end > prec_ptr);
+                            prec_end += insert;
+                            do
+                              *--prec_end = '0';
+                            while (prec_end > prec_ptr);
 
-                           count += insert;
-                         }
-                     }
+                            count += insert;
+                          }
+                      }
 #endif
 
 #if !USE_SNPRINTF
-                   if (count >= tmp_length)
-                     /* tmp_length was incorrectly calculated - fix the
-                        code above!  */
-                     abort ();
+                    if (count >= tmp_length)
+                      /* tmp_length was incorrectly calculated - fix the
+                         code above!  */
+                      abort ();
 #endif
 
 #if !DCHAR_IS_TCHAR
-                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                   if (dp->conversion == 'c' || dp->conversion == 's')
-                     {
-                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
-                          TYPE_WIDE_STRING.
-                          The result string is not certainly ASCII.  */
-                       const TCHAR_T *tmpsrc;
-                       DCHAR_T *tmpdst;
-                       size_t tmpdst_len;
-                       /* This code assumes that TCHAR_T is 'char'.  */
-                       typedef int TCHAR_T_verify
-                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
+                    /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                    if (dp->conversion == 'c' || dp->conversion == 's')
+                      {
+                        /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
+                           TYPE_WIDE_STRING.
+                           The result string is not certainly ASCII.  */
+                        const TCHAR_T *tmpsrc;
+                        DCHAR_T *tmpdst;
+                        size_t tmpdst_len;
+                        /* This code assumes that TCHAR_T is 'char'.  */
+                        typedef int TCHAR_T_verify
+                                    [2 * (sizeof (TCHAR_T) == 1) - 1];
 # if USE_SNPRINTF
-                       tmpsrc = (TCHAR_T *) (result + length);
+                        tmpsrc = (TCHAR_T *) (result + length);
 # else
-                       tmpsrc = tmp;
+                        tmpsrc = tmp;
 # endif
-                       tmpdst =
-                         DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                                   iconveh_question_mark,
-                                                   tmpsrc, count,
-                                                   NULL,
-                                                   NULL, &tmpdst_len);
-                       if (tmpdst == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                       free (tmpdst);
-                       count = tmpdst_len;
-                     }
-                   else
-                     {
-                       /* The result string is ASCII.
-                          Simple 1:1 conversion.  */
+                        tmpdst =
+                          DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                                    iconveh_question_mark,
+                                                    tmpsrc, count,
+                                                    NULL,
+                                                    NULL, &tmpdst_len);
+                        if (tmpdst == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                        DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                        free (tmpdst);
+                        count = tmpdst_len;
+                      }
+                    else
+                      {
+                        /* The result string is ASCII.
+                           Simple 1:1 conversion.  */
 # if USE_SNPRINTF
-                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
-                          no-op conversion, in-place on the array starting
-                          at (result + length).  */
-                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
+                        /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
+                           no-op conversion, in-place on the array starting
+                           at (result + length).  */
+                        if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
 # endif
-                         {
-                           const TCHAR_T *tmpsrc;
-                           DCHAR_T *tmpdst;
-                           size_t n;
+                          {
+                            const TCHAR_T *tmpsrc;
+                            DCHAR_T *tmpdst;
+                            size_t n;
 
 # if USE_SNPRINTF
-                           if (result == resultbuf)
-                             {
-                               tmpsrc = (TCHAR_T *) (result + length);
-                               /* ENSURE_ALLOCATION will not move tmpsrc
-                                  (because it's part of resultbuf).  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                             }
-                           else
-                             {
-                               /* ENSURE_ALLOCATION will move the array
-                                  (because it uses realloc().  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                               tmpsrc = (TCHAR_T *) (result + length);
-                             }
+                            if (result == resultbuf)
+                              {
+                                tmpsrc = (TCHAR_T *) (result + length);
+                                /* ENSURE_ALLOCATION will not move tmpsrc
+                                   (because it's part of resultbuf).  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                              }
+                            else
+                              {
+                                /* ENSURE_ALLOCATION will move the array
+                                   (because it uses realloc().  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                                tmpsrc = (TCHAR_T *) (result + length);
+                              }
 # else
-                           tmpsrc = tmp;
-                           ENSURE_ALLOCATION (xsum (length, count));
+                            tmpsrc = tmp;
+                            ENSURE_ALLOCATION (xsum (length, count));
 # endif
-                           tmpdst = result + length;
-                           /* Copy backwards, because of overlapping.  */
-                           tmpsrc += count;
-                           tmpdst += count;
-                           for (n = count; n > 0; n--)
-                             *--tmpdst = (unsigned char) *--tmpsrc;
-                         }
-                     }
+                            tmpdst = result + length;
+                            /* Copy backwards, because of overlapping.  */
+                            tmpsrc += count;
+                            tmpdst += count;
+                            for (n = count; n > 0; n--)
+                              *--tmpdst = (unsigned char) *--tmpsrc;
+                          }
+                      }
 #endif
 
 #if DCHAR_IS_TCHAR && !USE_SNPRINTF
-                   /* Make room for the result.  */
-                   if (count > allocated - length)
-                     {
-                       /* Need at least count elements.  But allocate
-                          proportionally.  */
-                       size_t n =
-                         xmax (xsum (length, count), xtimes (allocated, 2));
-
-                       ENSURE_ALLOCATION (n);
-                     }
+                    /* Make room for the result.  */
+                    if (count > allocated - length)
+                      {
+                        /* Need at least count elements.  But allocate
+                           proportionally.  */
+                        size_t n =
+                          xmax (xsum (length, count), xtimes (allocated, 2));
+
+                        ENSURE_ALLOCATION (n);
+                      }
 #endif
 
-                   /* Here count <= allocated - length.  */
+                    /* Here count <= allocated - length.  */
 
-                   /* Perform padding.  */
+                    /* Perform padding.  */
 #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (pad_ourselves && has_width)
-                     {
-                       size_t w;
+                    if (pad_ourselves && has_width)
+                      {
+                        size_t w;
 # if ENABLE_UNISTDIO
-                       /* Outside POSIX, it's preferrable to compare the width
-                          against the number of _characters_ of the converted
-                          value.  */
-                       w = DCHAR_MBSNLEN (result + length, count);
+                        /* Outside POSIX, it's preferrable to compare the width
+                           against the number of _characters_ of the converted
+                           value.  */
+                        w = DCHAR_MBSNLEN (result + length, count);
 # else
-                       /* The width is compared against the number of _bytes_
-                          of the converted value, says POSIX.  */
-                       w = count;
+                        /* The width is compared against the number of _bytes_
+                           of the converted value, says POSIX.  */
+                        w = count;
 # endif
-                       if (w < width)
-                         {
-                           size_t pad = width - w;
-
-                           /* Make room for the result.  */
-                           if (xsum (count, pad) > allocated - length)
-                             {
-                               /* Need at least count + pad elements.  But
-                                  allocate proportionally.  */
-                               size_t n =
-                                 xmax (xsum3 (length, count, pad),
-                                       xtimes (allocated, 2));
+                        if (w < width)
+                          {
+                            size_t pad = width - w;
+
+                            /* Make room for the result.  */
+                            if (xsum (count, pad) > allocated - length)
+                              {
+                                /* Need at least count + pad elements.  But
+                                   allocate proportionally.  */
+                                size_t n =
+                                  xmax (xsum3 (length, count, pad),
+                                        xtimes (allocated, 2));
 
 # if USE_SNPRINTF
-                               length += count;
-                               ENSURE_ALLOCATION (n);
-                               length -= count;
+                                length += count;
+                                ENSURE_ALLOCATION (n);
+                                length -= count;
 # else
-                               ENSURE_ALLOCATION (n);
+                                ENSURE_ALLOCATION (n);
 # endif
-                             }
-                           /* Here count + pad <= allocated - length.  */
+                              }
+                            /* Here count + pad <= allocated - length.  */
 
-                           {
+                            {
 # if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                             DCHAR_T * const rp = result + length;
+                              DCHAR_T * const rp = result + length;
 # else
-                             DCHAR_T * const rp = tmp;
+                              DCHAR_T * const rp = tmp;
 # endif
-                             DCHAR_T *p = rp + count;
-                             DCHAR_T *end = p + pad;
-                             DCHAR_T *pad_ptr;
+                              DCHAR_T *p = rp + count;
+                              DCHAR_T *end = p + pad;
+                              DCHAR_T *pad_ptr;
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                             if (dp->conversion == 'c'
-                                 || dp->conversion == 's')
-                               /* No zero-padding for string directives.  */
-                               pad_ptr = NULL;
-                             else
+                              if (dp->conversion == 'c'
+                                  || dp->conversion == 's')
+                                /* No zero-padding for string directives.  */
+                                pad_ptr = NULL;
+                              else
 # endif
-                               {
-                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
-                                 /* No zero-padding of "inf" and "nan".  */
-                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
-                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
-                                   pad_ptr = NULL;
-                               }
-                             /* The generated string now extends from rp to p,
-                                with the zero padding insertion point being at
-                                pad_ptr.  */
-
-                             count = count + pad; /* = end - rp */
-
-                             if (flags & FLAG_LEFT)
-                               {
-                                 /* Pad with spaces on the right.  */
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                               {
-                                 /* Pad with zeroes.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > pad_ptr)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = '0';
-                               }
-                             else
-                               {
-                                 /* Pad with spaces on the left.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > rp)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                           }
-                         }
-                     }
+                                {
+                                  pad_ptr = (*rp == '-' ? rp + 1 : rp);
+                                  /* No zero-padding of "inf" and "nan".  */
+                                  if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
+                                      || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
+                                    pad_ptr = NULL;
+                                }
+                              /* The generated string now extends from rp to p,
+                                 with the zero padding insertion point being at
+                                 pad_ptr.  */
+
+                              count = count + pad; /* = end - rp */
+
+                              if (flags & FLAG_LEFT)
+                                {
+                                  /* Pad with spaces on the right.  */
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                              else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                                {
+                                  /* Pad with zeroes.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > pad_ptr)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = '0';
+                                }
+                              else
+                                {
+                                  /* Pad with spaces on the left.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > rp)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                            }
+                          }
+                      }
 #endif
 
-                   /* Here still count <= allocated - length.  */
+                    /* Here still count <= allocated - length.  */
 
 #if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                   /* The snprintf() result did fit.  */
+                    /* The snprintf() result did fit.  */
 #else
-                   /* Append the sprintf() result.  */
-                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                    /* Append the sprintf() result.  */
+                    memcpy (result + length, tmp, count * sizeof (DCHAR_T));
 #endif
 #if !USE_SNPRINTF
-                   if (tmp != tmpbuf)
-                     free (tmp);
+                    if (tmp != tmpbuf)
+                      free (tmp);
 #endif
 
 #if NEED_PRINTF_DIRECTIVE_F
-                   if (dp->conversion == 'F')
-                     {
-                       /* Convert the %f result to upper case for %F.  */
-                       DCHAR_T *rp = result + length;
-                       size_t rc;
-                       for (rc = count; rc > 0; rc--, rp++)
-                         if (*rp >= 'a' && *rp <= 'z')
-                           *rp = *rp - 'a' + 'A';
-                     }
+                    if (dp->conversion == 'F')
+                      {
+                        /* Convert the %f result to upper case for %F.  */
+                        DCHAR_T *rp = result + length;
+                        size_t rc;
+                        for (rc = count; rc > 0; rc--, rp++)
+                          if (*rp >= 'a' && *rp <= 'z')
+                            *rp = *rp - 'a' + 'A';
+                      }
 #endif
 
-                   length += count;
-                   break;
-                 }
-             }
-         }
+                    length += count;
+                    break;
+                  }
+              }
+          }
       }
 
     /* Add the final NUL.  */
@@ -5432,12 +5432,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
     if (result != resultbuf && length + 1 < allocated)
       {
-       /* Shrink the allocated memory if possible.  */
-       DCHAR_T *memory;
+        /* Shrink the allocated memory if possible.  */
+        DCHAR_T *memory;
 
-       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
-       if (memory != NULL)
-         result = memory;
+        memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
+        if (memory != NULL)
+          result = memory;
       }
 
     if (buf_malloced != NULL)
index b9a3d6edcdc819f27626764da978d5849955ea4b..a689bad25af61a0cb3e33334fd6f5df831a98440 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2010 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
 #include <stddef.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index 4c0d174d63e2bdfb66be42f7514799f1aeef6c5f..fc837a895dad773ad630e981830a2163f1744892 100644 (file)
@@ -1,5 +1,5 @@
 /* Variable with FSF copyright information, for version-etc.
-   Copyright (C) 1999-2006 Free Software Foundation, Inc.
+   Copyright (C) 1999-2006, 2009-2010 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
index bf67c37b03d5e674496b75998dd0b6a5c92a0aac..19c873d01605f2d0b651059c69d04830dd34436d 100644 (file)
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-2010 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
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-enum { COPYRIGHT_YEAR = 2009 };
+/* If you use AM_INIT_AUTOMAKE's no-define option,
+   PACKAGE is not defined.  Use PACKAGE_TARNAME instead.  */
+#if ! defined PACKAGE && defined PACKAGE_TARNAME
+# define PACKAGE PACKAGE_TARNAME
+#endif
+
+enum { COPYRIGHT_YEAR = 2010 };
 
 /* The three functions below display the --version information the
    standard way.
@@ -54,9 +60,9 @@ enum { COPYRIGHT_YEAR = 2009 };
    number of elements in the array. */
 void
 version_etc_arn (FILE *stream,
-                const char *command_name, const char *package,
-                const char *version,
-                const char * const * authors, size_t n_authors)
+                 const char *command_name, const char *package,
+                 const char *version,
+                 const char * const * authors, size_t n_authors)
 {
   if (command_name)
     fprintf (stream, "%s (%s) %s\n", command_name, package, version);
@@ -66,7 +72,7 @@ version_etc_arn (FILE *stream,
 #ifdef PACKAGE_PACKAGER
 # ifdef PACKAGE_PACKAGER_VERSION
   fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
-          PACKAGE_PACKAGER_VERSION);
+           PACKAGE_PACKAGER_VERSION);
 # else
   fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
 # endif
@@ -84,7 +90,7 @@ This is free software: you are free to change and redistribute it.\n\
 There is NO WARRANTY, to the extent permitted by law.\n\
 \n\
 "),
-        stream);
+         stream);
 
   switch (n_authors)
     {
@@ -102,66 +108,66 @@ There is NO WARRANTY, to the extent permitted by law.\n\
     case 3:
       /* TRANSLATORS: Each %s denotes an author name.  */
       fprintf (stream, _("Written by %s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2]);
+               authors[0], authors[1], authors[2]);
       break;
     case 4:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
-              authors[0], authors[1], authors[2], authors[3]);
+               authors[0], authors[1], authors[2], authors[3]);
       break;
     case 5:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4]);
+               authors[0], authors[1], authors[2], authors[3], authors[4]);
       break;
     case 6:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5]);
       break;
     case 7:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5], authors[6]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6]);
       break;
     case 8:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
-               authors[0], authors[1], authors[2], authors[3], authors[4],
-               authors[5], authors[6], authors[7]);
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7]);
       break;
     case 9:
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
-              authors[0], authors[1], authors[2], authors[3], authors[4],
-              authors[5], authors[6], authors[7], authors[8]);
+               authors[0], authors[1], authors[2], authors[3], authors[4],
+               authors[5], authors[6], authors[7], authors[8]);
       break;
     default:
       /* 10 or more authors.  Use an abbreviation, since the human reader
-        will probably not want to read the entire list anyway.  */
+         will probably not want to read the entire list anyway.  */
       /* TRANSLATORS: Each %s denotes an author name.
-        You can use line breaks, estimating that each author name occupies
-        ca. 16 screen columns and that a screen line has ca. 80 columns.  */
+         You can use line breaks, estimating that each author name occupies
+         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
       fprintf (stream, _("\
 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
-               authors[0], authors[1], authors[2], authors[3], authors[4],
-               authors[5], authors[6], authors[7], authors[8]);
+                authors[0], authors[1], authors[2], authors[3], authors[4],
+                authors[5], authors[6], authors[7], authors[8]);
       break;
     }
 }
@@ -172,8 +178,8 @@ Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
    Author names are given in the NULL-terminated array AUTHORS. */
 void
 version_etc_ar (FILE *stream,
-               const char *command_name, const char *package,
-               const char *version, const char * const * authors)
+                const char *command_name, const char *package,
+                const char *version, const char * const * authors)
 {
   size_t n_authors;
 
@@ -188,19 +194,19 @@ version_etc_ar (FILE *stream,
    Author names are given in the NULL-terminated va_list AUTHORS. */
 void
 version_etc_va (FILE *stream,
-               const char *command_name, const char *package,
-               const char *version, va_list authors)
+                const char *command_name, const char *package,
+                const char *version, va_list authors)
 {
   size_t n_authors;
   const char *authtab[10];
 
   for (n_authors = 0;
        n_authors < 10
-        && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
+         && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
        n_authors++)
     ;
   version_etc_arn (stream, command_name, package, version,
-                  authtab, n_authors);
+                   authtab, n_authors);
 }
 
 
@@ -219,8 +225,8 @@ version_etc_va (FILE *stream,
    NULL argument at the end.  */
 void
 version_etc (FILE *stream,
-            const char *command_name, const char *package,
-            const char *version, /* const char *author1, ...*/ ...)
+             const char *command_name, const char *package,
+             const char *version, /* const char *author1, ...*/ ...)
 {
   va_list authors;
 
@@ -239,14 +245,14 @@ emit_bug_reporting_address (void)
   printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
   printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
-         PACKAGE_PACKAGER_BUG_REPORTS);
+          PACKAGE_PACKAGER_BUG_REPORTS);
 #endif
 #ifdef PACKAGE_URL
   printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
 #else
   printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
-         PACKAGE_NAME, PACKAGE);
+          PACKAGE_NAME, PACKAGE);
 #endif
   fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
-        stdout);
+         stdout);
 }
index 8ce02fecb89fe1fa6f1db0e3deadd43986084252..629fe83013216af0600b732b7d4d9c2c996d6c00 100644 (file)
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999, 2003, 2005, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2005, 2009-2010 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
@@ -50,26 +50,26 @@ extern const char version_etc_copyright[];
 
 /* N_AUTHORS names are supplied in array AUTHORS.  */
 extern void version_etc_arn (FILE *stream,
-                            const char *command_name, const char *package,
-                            const char *version,
-                            const char * const * authors, size_t n_authors);
+                             const char *command_name, const char *package,
+                             const char *version,
+                             const char * const * authors, size_t n_authors);
 
 /* Names are passed in the NULL-terminated array AUTHORS.  */
 extern void version_etc_ar (FILE *stream,
-                           const char *command_name, const char *package,
-                           const char *version, const char * const * authors);
+                            const char *command_name, const char *package,
+                            const char *version, const char * const * authors);
 
 /* Names are passed in the NULL-terminated va_list.  */
 extern void version_etc_va (FILE *stream,
-                           const char *command_name, const char *package,
-                           const char *version, va_list authors);
+                            const char *command_name, const char *package,
+                            const char *version, va_list authors);
 
 /* Names are passed as separate arguments, with an additional
    NULL argument at the end.  */
 extern void version_etc (FILE *stream,
-                        const char *command_name, const char *package,
-                        const char *version,
-                        /* const char *author1, ..., NULL */ ...)
+                         const char *command_name, const char *package,
+                         const char *version,
+                         /* const char *author1, ..., NULL */ ...)
   ATTRIBUTE_SENTINEL;
 
 /* Display the usual `Report bugs to' stanza */
index 0622985b8197a31c1687b29f7231d306ca710ec1..b472bd0501c725c1c3a13ef9505b57b4cb66e669 100644 (file)
@@ -1,6 +1,6 @@
 /* w32sock.h --- internal auxilliary functions for Windows socket functions
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -32,7 +32,6 @@ static inline void
 set_winsock_errno (void)
 {
   int err = WSAGetLastError ();
-  WSASetLastError (0);
 
   /* Map some WSAE* errors to the runtime library's error codes.  */
   switch (err)
index cc5baad3c07c8e624bf3d5b05a590ebd571a63c6..6342b4e19a31553ca37b7b14b1585ca58f8ace5c 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -30,9 +30,9 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
 /* Special invocation convention:
-   - Inside uClibc header files.
+   - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
+   included before <wchar.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
 
 /* Include the original <wchar.h> if it exists.
    Some builds of uClibc lack it.  */
@@ -72,7 +75,9 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -110,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -129,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -147,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -165,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -183,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -197,14 +202,15 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 #  define mbsrtowcs rpl_mbsrtowcs
 # endif
 # if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -215,14 +221,15 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t
 #  define mbsnrtowcs rpl_mbsnrtowcs
 # endif
 # if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -237,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -251,14 +258,15 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 #  define wcsrtombs rpl_wcsrtombs
 # endif
 # if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -269,14 +277,15 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t
 #  define wcsnrtombs rpl_wcsnrtombs
 # endif
 # if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -294,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
index 284cf7f6e18740534dce9cf458ec0f849485954c..fbd63290d6c84cb687654e444ae1539e88f14f96 100644 (file)
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008, 2009, 2010 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
index 85c2f209beb72edebf886ca1de25f29f02c09aec..17298f2348bf0c5ce90917bf19abfb75a92ae179 100755 (executable)
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2008 Free Software Foundation, Inc.
+#   Copyright 1996-2010 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
diff --git a/lib/build-aux/link-warning.h b/lib/build-aux/link-warning.h
deleted file mode 100644 (file)
index fda0194..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]            \
-          __attribute__ ((__unused__,                          \
-                          __section__ (".gnu.warning"),                \
-                          __aligned__ (1)))                    \
-          = message "\n";                                      \
-        (void)0;                                               \
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
index 090f7247748f2eff33be2702b1271147642bad05..8bb9f26f7918051e8dfea2658b5442b075dd1754 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -64,6 +64,30 @@ EXTRA_DIST += alloca.in.h
 
 ## end   gnulib module alloca-opt
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module byteswap
 
 BUILT_SOURCES += $(BYTESWAP_H)
@@ -182,14 +206,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
 
 ## end   gnulib module havelib
 
-## begin gnulib module link-warning
-
-LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module lseek
 
 
@@ -229,7 +245,7 @@ BUILT_SOURCES += $(NETDB_H)
 
 # We need the following in order to create <netdb.h> when the system
 # doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -242,6 +258,7 @@ netdb.h: netdb.in.h
              -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
              -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
              -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/netdb.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -381,7 +398,7 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h
+stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -427,7 +444,8 @@ stdio.h: stdio.in.h
              -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|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             < $(srcdir)/stdio.in.h | \
+         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
@@ -465,8 +483,8 @@ stdio.h: stdio.in.h
              -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
              -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdio.in.h; \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
@@ -483,7 +501,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h
+stdlib.h: stdlib.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -536,9 +554,11 @@ stdlib.h: stdlib.in.h
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
+             -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -563,7 +583,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -602,6 +622,8 @@ string.h: string.in.h
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -629,7 +651,8 @@ string.h: string.in.h
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -645,7 +668,7 @@ BUILT_SOURCES += strings.h
 
 # We need the following in order to create <strings.h> when the system
 # doesn't have one that works with the given compiler.
-strings.h: strings.in.h
+strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -653,7 +676,8 @@ strings.h: strings.in.h
              -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
              -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
              -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/strings.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -674,11 +698,11 @@ EXTRA_liblgnu_la_SOURCES += strverscmp.c
 
 ## begin gnulib module sys_socket
 
-BUILT_SOURCES += $(SYS_SOCKET_H)
+BUILT_SOURCES += sys/socket.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h
+sys/socket.h: sys_socket.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -707,7 +731,8 @@ sys/socket.h: sys_socket.in.h
              -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
              -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
              -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_socket.in.h; \
        } > $@-t && \
        mv -f $@-t $@
@@ -724,7 +749,7 @@ BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h
+sys/stat.h: sys_stat.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -763,7 +788,8 @@ sys/stat.h: sys_stat.in.h
              -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
              -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
              -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_stat.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -780,7 +806,7 @@ BUILT_SOURCES += time.h
 
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
-time.h: time.in.h
+time.h: time.in.h $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -793,6 +819,7 @@ time.h: time.in.h
              -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
              -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/time.in.h; \
        } > $@-t && \
        mv $@-t $@
@@ -817,7 +844,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h
+unistd.h: unistd.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -840,6 +867,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|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_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
@@ -848,6 +876,7 @@ unistd.h: unistd.in.h
              -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
+             -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
              -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
@@ -858,8 +887,10 @@ unistd.h: unistd.in.h
              -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|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
+             < $(srcdir)/unistd.in.h | \
+         sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -871,18 +902,21 @@ unistd.h: unistd.in.h
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
              -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
+             -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
              -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
              -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
+             -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
+             -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
@@ -900,16 +934,19 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
              -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+             -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
              -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
              -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
+             -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
              -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
              -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
              -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
+             -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/unistd.in.h; \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > $@-t && \
        mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
@@ -945,13 +982,32 @@ EXTRA_liblgnu_la_SOURCES += vsnprintf.c
 
 ## end   gnulib module vsnprintf
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar
 
-BUILT_SOURCES += $(WCHAR_H)
+BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -993,7 +1049,8 @@ wchar.h: wchar.in.h
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > $@-t && \
        mv $@-t $@
index e492dbc035b12f62605d08237bf3b3bd21d71e56..d65dd648b2792041fc251b71e83012563131f922 100644 (file)
@@ -1,5 +1,5 @@
 /* Determine alignment of types.
-   Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2004, 2006, 2009-2010 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
index 38b20c3973dc6050198ed106048ff04e86e1292e..cdb7366cdf07121b969ea3934903028c965e7f11 100644 (file)
@@ -1,7 +1,7 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2010 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
index bf989a89a28e7838828b8916b47db7a4be402228..75f519bc34d312d3db2341174a777ded36e2c49e 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009, 2010 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
index 2df1d4b0ecfafd891b52a84e59b4d7048a2bd06e..5e74dd0daa06e7bd84204bc4a3edf53ebdbb32bb 100644 (file)
@@ -1,5 +1,6 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2007, 2009-2010 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
index fd63ce1756ec7e7709e9bd1a1b2c1e8dc60187f5..f245fbdc490a9a7cc527fd6026b9f51b08e65ddd 100644 (file)
@@ -1,5 +1,5 @@
 /* byteswap.h - Byte swapping
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009, 2010 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
 /* Given an unsigned 16-bit argument X, return the value corresponding to
    X with reversed byte order.  */
 #define bswap_16(x) ((((x) & 0x00FF) << 8) | \
-                    (((x) & 0xFF00) >> 8))
+                     (((x) & 0xFF00) >> 8))
 
 /* Given an unsigned 32-bit argument X, return the value corresponding to
    X with reversed byte order.  */
 #define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
-                    (((x) & 0x0000FF00) << 8) | \
-                    (((x) & 0x00FF0000) >> 8) | \
-                    (((x) & 0xFF000000) >> 24))
+                     (((x) & 0x0000FF00) << 8) | \
+                     (((x) & 0x00FF0000) >> 8) | \
+                     (((x) & 0xFF000000) >> 24))
 
 /* Given an unsigned 64-bit argument X, return the value corresponding to
    X with reversed byte order.  */
 #define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
-                    (((x) & 0x000000000000FF00ULL) << 40) | \
-                    (((x) & 0x0000000000FF0000ULL) << 24) | \
-                    (((x) & 0x00000000FF000000ULL) << 8) | \
-                    (((x) & 0x000000FF00000000ULL) >> 8) | \
-                    (((x) & 0x0000FF0000000000ULL) >> 24) | \
-                    (((x) & 0x00FF000000000000ULL) >> 40) | \
-                    (((x) & 0xFF00000000000000ULL) >> 56))
+                     (((x) & 0x000000000000FF00ULL) << 40) | \
+                     (((x) & 0x0000000000FF0000ULL) << 24) | \
+                     (((x) & 0x00000000FF000000ULL) << 8) | \
+                     (((x) & 0x000000FF00000000ULL) >> 8) | \
+                     (((x) & 0x0000FF0000000000ULL) >> 24) | \
+                     (((x) & 0x00FF000000000000ULL) >> 40) | \
+                     (((x) & 0xFF00000000000000ULL) >> 56))
 
 #endif /* _GL_BYTESWAP_H */
index 1c685c549d99665807a8b835ca1748aa595d8c72..9da8e581313ddf719ba0c84da367d6757fbdcf90 100644 (file)
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright 2000-2003, 2006 Free Software Foundation, Inc.
+   Copyright 2000-2003, 2006, 2009-2010 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
index 2bce9d105c56ffde7333dd0426dd3b94e3a1f3c0..5ac5dd25e775b4d1a14fa2ace5f2c9c5fa549ada 100644 (file)
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2010 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
index 045dcf7210a8b54984e680d9f8d4c4f34652c5b9..34ef8763dbe81d4a049febd1437264ee2a4416d5 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making the close() function extensible.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -66,7 +66,7 @@ register_close_hook (close_hook_fn hook, struct close_hook *link)
     {
       /* The link is already in use.  */
       if (link->private_fn != hook)
-       abort ();
+        abort ();
     }
 }
 
index 483d69c8da1d9e2081295c8a1815827c5daf9a08..cda7742ee0dee58b243b1ac34190b08100cb3782 100644 (file)
@@ -1,5 +1,5 @@
 /* Hook for making the close() function extensible.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index f87c55d293f9f7a515cc1eeb036b81f115d8eaae..579348cc3b7b81332b1bc3f12c0080198cbe187f 100644 (file)
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
index f0c0c18966e7b644bfcf0cccc7e8d72c5336980b..3167ebf1219132911419e167858d5b36d3ffffe1 100644 (file)
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2007.
 
    This program is free software; you can redistribute it and/or modify
index 1600d05afcc7d030b1d879262845c433c890a20d..dc1f6ce6db9cd2810da4234c4cc14ffbffd12bfa 100644 (file)
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index f9550a16957c3b66cca0440f0b0cac7926ddde2c..cca32a56d9fdd02e41f91c88685f0b51b6628002 100644 (file)
@@ -1,5 +1,5 @@
 /* An fseeko() function that, together with fflush(), is POSIX compliant.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -50,10 +50,10 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if ((fp->_flags & __SL64) == 0)
     {
       /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
-        mode; but has an fseeko that requires 64-bit mode.  */
+         mode; but has an fseeko that requires 64-bit mode.  */
       FILE *tmp = fopen ("/dev/null", "r");
       if (!tmp)
-       return -1;
+        return -1;
       fp->_flags |= __SL64;
       fp->_seek64 = tmp->_seek64;
       fclose (tmp);
@@ -62,8 +62,8 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (fp_->_p == fp_->_bf._base
       && fp_->_r == 0
       && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
-                    ? fp_->_bf._size
-                    : 0)
+                     ? fp_->_bf._size
+                     : 0)
       && fp_ub._base == NULL)
 #elif defined __EMX__               /* emx+gcc */
   if (fp->_ptr == fp->_buffer
@@ -77,7 +77,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
   if (((fp->__modeflags & __FLAG_WRITING) == 0
        || fp->__bufpos == fp->__bufstart)
       && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
-         || fp->__bufpos == fp->__bufread))
+          || fp->__bufpos == fp->__bufread))
 #elif defined __QNX__               /* QNX */
   if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
       && fp->_Rback == fp->_Back + sizeof (fp->_Back)
@@ -92,25 +92,42 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
 #endif
     {
       /* We get here when an fflush() call immediately preceded this one.  We
-        know there are no buffers.
-        POSIX requires us to modify the file descriptor's position.
-        But we cannot position beyond end of file here.  */
+         know there are no buffers.
+         POSIX requires us to modify the file descriptor's position.
+         But we cannot position beyond end of file here.  */
       off_t pos =
-       lseek (fileno (fp),
-              whence == SEEK_END && offset > 0 ? 0 : offset,
-              whence);
+        lseek (fileno (fp),
+               whence == SEEK_END && offset > 0 ? 0 : offset,
+               whence);
       if (pos == -1)
-       {
+        {
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
-         fp_->_flags &= ~__SOFF;
+          fp_->_flags &= ~__SOFF;
 #endif
-         return -1;
-       }
+          return -1;
+        }
 
 #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
       fp->_flags &= ~_IO_EOF_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __CYGWIN__
+      /* fp_->_offset is typed as an integer.  */
       fp_->_offset = pos;
+# else
+      /* fp_->_offset is an fpos_t.  */
+      {
+        /* Use a union, since on NetBSD, the compilation flags
+           determine whether fpos_t is typedef'd to off_t or a struct
+           containing a single off_t member.  */
+        union
+          {
+            fpos_t f;
+            off_t o;
+          } u;
+        u.o = pos;
+        fp_->_offset = u.f;
+      }
+# endif
       fp_->_flags |= __SOFF;
       fp_->_flags &= ~__SEOF;
 #elif defined __EMX__               /* emx+gcc */
@@ -122,9 +139,9 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
       fp->__eof = 0;
 #endif
       /* If we were not requested to position beyond end of file, we're
-        done.  */
+         done.  */
       if (!(whence == SEEK_END && offset > 0))
-       return 0;
+        return 0;
     }
   return fseeko (fp, offset, whence);
 }
index 56d4a213028e6c39be7e227fd0409417341eaba4..7dfb7233f2fdc864361ca34efa20bdb729cac6db 100644 (file)
@@ -1,5 +1,6 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 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
@@ -140,8 +141,8 @@ inline
 #endif
 static const char *
 pgettext_aux (const char *domain,
-             const char *msg_ctxt_id, const char *msgid,
-             int category)
+              const char *msg_ctxt_id, const char *msgid,
+              int category)
 {
   const char *translation = dcgettext (domain, msg_ctxt_id, category);
   if (translation == msg_ctxt_id)
@@ -159,9 +160,9 @@ inline
 #endif
 static const char *
 npgettext_aux (const char *domain,
-              const char *msg_ctxt_id, const char *msgid,
-              const char *msgid_plural, unsigned long int n,
-              int category)
+               const char *msg_ctxt_id, const char *msgid,
+               const char *msgid_plural, unsigned long int n,
+               int category)
 {
   const char *translation =
     dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
index feec8310bd6ae6a7992c8af73b17e748659822b5..601efa357fd396777a4eec4590ca072c038adaeb 100644 (file)
@@ -1,5 +1,5 @@
 /* An lseek() function that detects pipes.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index d4d04d1530a27c0921a542c6978da037107b9ee0..301469b31cef0ba55efc7c41e701ae5fa715834d 100644 (file)
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2010 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.
index 4b978e137cbe7c2d9f76baa6546764f6e2f7a0a6..f3ee34380cda13d5463e465bdb2c6d691169d449 100644 (file)
@@ -1,5 +1,6 @@
 # alloca.m4 serial 9
-dnl Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
index ad13f228676331c3dfa3b1b2cf909245eed1d950..2afd6a2a4e184124838704bbcc0efa23083e7334 100644 (file)
@@ -1,5 +1,5 @@
 # byteswap.m4 serial 3
-dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009, 2010 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.
index 413217bd4a5f9ebb295528989c6e4e906c9438eb..a53c04260c0f5c1c347210fb7eb7e4ff63b41cb1 100644 (file)
@@ -1,5 +1,5 @@
 # codeset.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 2000-2002, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2006, 2008-2010 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.
index 4ce1ccbd9f4b1e6a9d4c06ce4d59d3fed48646eb..d02a039363dda9dbd4eaf43d40e9cdbccb699446 100644 (file)
@@ -1,5 +1,5 @@
 # errno_h.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 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.
index ba6d5e190f9f2df6ae1b080fc8f2d16490b5e3b2..7d9458a8d65a0b085d93b695beaaa6685b824c18 100644 (file)
@@ -1,7 +1,7 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([[
-#        define __EXTENSIONS__ 1
-         ]AC_INCLUDES_DEFAULT])],
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
index d36e3a46caef916dfd5d0c4dd26182d70850b3ae..a74a0d957f2ea89a010102dba7da48add2fccbfe 100644 (file)
@@ -1,5 +1,5 @@
 # float_h.m4 serial 3
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index a370648e9f3411b3c72700c1d2bd8ea1029b4677..5f7f97729c067cdbaec9527fefd3cabe4020e9cc 100644 (file)
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 6
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# fseeko.m4 serial 7
+dnl Copyright (C) 2007-2010 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.
@@ -17,12 +17,10 @@ AC_DEFUN([gl_FUNC_FSEEKO],
     [
       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
 ]], [fseeko (stdin, 0, 0);])],
-       [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
+        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
     ])
-  if test $gl_cv_func_fseeko = no; then
-    HAVE_FSEEKO=0
-    gl_REPLACE_FSEEKO
-  elif test $gl_cv_var_stdin_large_offset = no; then
+  if test $gl_cv_func_fseeko = no \
+      || test $gl_cv_var_stdin_large_offset = no; then
     gl_REPLACE_FSEEKO
   fi
 ])
index d02bce8a8b4819e3bb94dc4ba38b13d8933f02a8..698c5281da754fe75dc24c78915fc8d85483fe2f 100644 (file)
@@ -1,5 +1,5 @@
 # func.m4 serial 2
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index d90c85008aabf427d0cd2847fffbfe10eb866926..d6dc3fe25c0e948d09c186563655aff3c359ec8c 100644 (file)
@@ -1,5 +1,5 @@
 # gettext.m4 serial 62 (gettext-0.18)
-dnl Copyright (C) 1995-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2010 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.
index fe58a0f326579afd27259d504ba4c75417a89294..f148c12c4533ecedc470bf21ea01b540da2ff219 100644 (file)
@@ -1,5 +1,5 @@
 # glibc2.m4 serial 2
-dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2004, 2008-2010 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.
@@ -12,16 +12,16 @@ AC_DEFUN([gt_GLIBC2],
     AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer],
       [ac_cv_gnu_library_2],
       [AC_EGREP_CPP([Lucky GNU user],
-       [
+        [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
  #if (__GLIBC__ >= 2)
   Lucky GNU user
  #endif
 #endif
-       ],
-       [ac_cv_gnu_library_2=yes],
-       [ac_cv_gnu_library_2=no])
+        ],
+        [ac_cv_gnu_library_2=yes],
+        [ac_cv_gnu_library_2=no])
       ]
     )
     AC_SUBST([GLIBC2])
index 93fbf4745922719a47db7f0300eb1f202310eaf6..68ada9d4d5b844e3ff5be076ec1156c542f6630e 100644 (file)
@@ -1,5 +1,5 @@
 # glibc21.m4 serial 4
-dnl Copyright (C) 2000-2002, 2004, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2004, 2008-2010 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.
@@ -12,16 +12,16 @@ AC_DEFUN([gl_GLIBC21],
     AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer],
       [ac_cv_gnu_library_2_1],
       [AC_EGREP_CPP([Lucky GNU user],
-       [
+        [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
   Lucky GNU user
  #endif
 #endif
-       ],
-       [ac_cv_gnu_library_2_1=yes],
-       [ac_cv_gnu_library_2_1=no])
+        ],
+        [ac_cv_gnu_library_2_1=yes],
+        [ac_cv_gnu_library_2_1=no])
       ]
     )
     AC_SUBST([GLIBC21])
index de6f4c74a424913ae9fdd4cc8a29ba555ae2b57a..5129198896f444b883b605d2d7dbc75c4e94b3cd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
index c8fda2033045d38975415f240bd9a72a14a2c949..b7812a896217a250e8298125c6a087a588994340 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 11
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 12
+dnl Copyright (C) 2007-2010 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.
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -49,6 +52,14 @@ m4_ifndef([m4_foreach_w],
   [m4_define([m4_foreach_w],
     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
+# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
+# ----------------------------------------------------
+# Backport of autoconf-2.63b's macro.
+# Remove this macro when we can assume autoconf >= 2.64.
+m4_ifndef([AS_VAR_IF],
+[m4_define([AS_VAR_IF],
+[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
@@ -70,13 +81,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
index e6389f0df3c63f7efe014ab7d0947bad385cb8cb..4186f4cb79c57201049509f07c6649af11b01f5d 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -121,7 +121,7 @@ AC_DEFUN([lgl_INIT],
     if test -n "$lgl_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $lgl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $lgl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         lgl_libobjs="$lgl_libobjs $i.$ac_objext"
         lgl_ltlibobjs="$lgl_ltlibobjs $i.lo"
       done
@@ -164,7 +164,7 @@ AC_DEFUN([lgl_INIT],
     if test -n "$lgltests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $lgltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $lgltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         lgltests_libobjs="$lgltests_libobjs $i.$ac_objext"
         lgltests_ltlibobjs="$lgltests_ltlibobjs $i.lo"
       done
@@ -233,8 +233,9 @@ AC_DEFUN([lgltests_LIBSOURCES], [
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([lgl_FILE_LIST], [
+  build-aux/arg-nonnull.h
   build-aux/config.rpath
-  build-aux/link-warning.h
+  build-aux/warn-on-use.h
   lib/alignof.h
   lib/alloca.in.h
   lib/asnprintf.c
@@ -364,10 +365,13 @@ AC_DEFUN([lgl_FILE_LIST], [
   m4/vasprintf.m4
   m4/visibility.m4
   m4/vsnprintf.m4
+  m4/warn-on-use.m4
   m4/wchar.m4
   m4/wchar_t.m4
   m4/wint_t.m4
   m4/xsize.m4
+  tests/macros.h
+  tests/signature.h
   tests/test-alloca-opt.c
   tests/test-byteswap.c
   tests/test-c-ctype.c
index 4438d488698b2e25a911a6741d8903cb9fd35ebf..69e7733b990a0aac8afb62c14813b417bb371891 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2010 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.
index ce21b0b878629fa1d9477d2acf7809db408c32bf..f46ff1421541e2a8b0bef692bc3299a902f5226d 100644 (file)
@@ -1,5 +1,5 @@
-# iconv.m4 serial AM8 (gettext-0.18)
-dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc.
+# iconv.m4 serial 9 (gettext-0.18)
+dnl Copyright (C) 2000-2002, 2007-2010 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.
@@ -58,7 +58,7 @@ AC_DEFUN([AM_ICONV_LINK],
   ])
   if test "$am_cv_func_iconv" = yes; then
     AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
-      dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
+      dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
       am_save_LIBS="$LIBS"
       if test $am_cv_lib_iconv = yes; then
         LIBS="$LIBS $LIBICONV"
@@ -87,6 +87,25 @@ int main ()
           return 1;
       }
   }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          return 1;
+      }
+  }
 #if 0 /* This bug could be worked around by the caller.  */
   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
   {
index 5e22ded936ccb558203f81709e7b8f2417fd532f..c7e0672f60c01b02fa96a2a4427907c69f483879 100644 (file)
@@ -1,5 +1,5 @@
 # include_next.m4 serial 14
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2010 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.
@@ -109,11 +109,11 @@ EOF
 # be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
-#      #@INCLUDE_NEXT@ @NEXT_FOO_H@
+#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
 # or
-#      #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
+#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
-#      #include_next <foo.h>
+#       #include_next <foo.h>
 # even if the compiler does not support include_next.
 # The three "///" are to pacify Sun C 5.8, which otherwise would say
 # "warning: #include of /usr/include/... may be non-portable".
@@ -129,46 +129,46 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
-                   [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
+                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
      if test $gl_cv_have_include_next = yes; then
        AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
      else
        AC_CACHE_CHECK(
-        [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
-        m4_defn([gl_next_header]),
-        [AS_VAR_PUSHDEF([gl_header_exists],
-                        [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
-         if test AS_VAR_GET(gl_header_exists) = yes; then
-           AC_LANG_CONFTEST(
-             [AC_LANG_SOURCE(
-                [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
-              )])
-           dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
-           dnl that contain only a #include of other header files and no
-           dnl non-comment tokens of their own. This leads to a failure to
-           dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
-           dnl and others. The workaround is to force preservation of comments
-           dnl through option -C. This ensures all necessary #line directives
-           dnl are present. GCC supports option -C as well.
-           case "$host_os" in
-             aix*) gl_absname_cpp="$ac_cpp -C" ;;
-             *)    gl_absname_cpp="$ac_cpp" ;;
-           esac
-           dnl eval is necessary to expand gl_absname_cpp.
-           dnl Ultrix and Pyramid sh refuse to redirect output of eval,
-           dnl so use subshell.
-           AS_VAR_SET([gl_next_header],
-             ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
-              sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
-                s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
-                s#^/[^/]#//&#
-                p
-                q
-              }'`'"'])
-         else
-           AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
-         fi
-         AS_VAR_POPDEF([gl_header_exists])])
+         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
+         m4_defn([gl_next_header]),
+         [AS_VAR_PUSHDEF([gl_header_exists],
+                         [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
+          if test AS_VAR_GET(gl_header_exists) = yes; then
+            AC_LANG_CONFTEST(
+              [AC_LANG_SOURCE(
+                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
+               )])
+            dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
+            dnl that contain only a #include of other header files and no
+            dnl non-comment tokens of their own. This leads to a failure to
+            dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
+            dnl and others. The workaround is to force preservation of comments
+            dnl through option -C. This ensures all necessary #line directives
+            dnl are present. GCC supports option -C as well.
+            case "$host_os" in
+              aix*) gl_absname_cpp="$ac_cpp -C" ;;
+              *)    gl_absname_cpp="$ac_cpp" ;;
+            esac
+            dnl eval is necessary to expand gl_absname_cpp.
+            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
+            dnl so use subshell.
+            AS_VAR_SET([gl_next_header],
+              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+               sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
+                 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
+                 s#^/[^/]#//&#
+                 p
+                 q
+               }'`'"'])
+          else
+            AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
+          fi
+          AS_VAR_POPDEF([gl_header_exists])])
      fi
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
index 29e6e0aa16e4dc8f76c5f2405a81a494869ee152..289c4df5eda53b3afa4dd96d11149c42f69178d6 100644 (file)
@@ -1,5 +1,5 @@
 # intdiv0.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2010 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.
index 934408bb90aa7217ef43a09254cf927461f665ef..5e17fea9f10e606606328cfb33b654899e6354d1 100644 (file)
@@ -1,5 +1,5 @@
 # intl.m4 serial 8 (gettext-0.17)
-dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2007, 2009-2010 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.
index 0980e6f28615ddeb446a9959b67e933adbe51b71..744c0bc7131cc199258649f66da5b47561776ada 100644 (file)
@@ -1,5 +1,5 @@
 # intldir.m4 serial 2 (gettext-0.18)
-dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009, 2010 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.
index c24837c4290ad25aa30bc9c9b91cf8dff973a63b..dd91025962741fb1e5fd697ffbb88c9df66b202f 100644 (file)
@@ -1,5 +1,5 @@
 # intlmacosx.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2004-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2010 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.
index a3785e9989cb17c8505767cad1bbee75c7830a6d..74aaaf5ed66314043e447a5675327a9dda4b0d0a 100644 (file)
@@ -1,5 +1,5 @@
 # intmax.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 2002-2005, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2005, 2008-2010 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.
index 264cb57184dc384c67591764196eecb59f859f4c..975caac50670d193a88577508de756a7aa17c560 100644 (file)
@@ -1,5 +1,6 @@
 # intmax_t.m4 serial 7
-dnl Copyright (C) 1997-2004, 2006-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
index 98fec7bcf69d2f56fc0a000bb37aae5631c696af..718a4f4e19f4e0ae45cd9be70a1aef0df4df307e 100644 (file)
@@ -1,5 +1,5 @@
 # inttypes-pri.m4 serial 6 (gettext-0.18)
-dnl Copyright (C) 1997-2002, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2002, 2006, 2008-2010 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.
index f4ca16021cf78da48bb7541c86d43ded2b4352c3..782d77ed8b1e0629d7b5ac2938db0ef6010e61d6 100644 (file)
@@ -1,5 +1,5 @@
 # inttypes_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
index fa8e4167ac31e1f3005ec667323851ce42692f13..1a705431a9952729f40403e6b727be738c07f479 100644 (file)
@@ -1,5 +1,6 @@
 # lcmessage.m4 serial 6 (gettext-0.18)
-dnl Copyright (C) 1995-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation,
+dnl 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.
index 1aa6a6fbbf43cd47d261ca26894add37f5ee4180..2dc6bf52057463d2ec9a368029290a63bcded385 100644 (file)
@@ -1,5 +1,5 @@
 # ld-output-def.m4 serial 2
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index a97888f2493a363c4e597eb7f1fe78575b7d4e60..43c1ef12f94aa001057ee293c3bf3cdff2efcbc7 100644 (file)
@@ -1,5 +1,5 @@
 # ld-version-script.m4 serial 1
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
@@ -27,7 +27,7 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT],
     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
     cat > conftest.map <<EOF
 VERS_1 {
-       global: sym;
+        global: sym;
 };
 
 VERS_2 {
index e4863f2c9b76a6cc8a3979bb41244a615d194c84..ebb30528bd5abfdfcc2126175cbe1de99d902457 100644 (file)
@@ -1,5 +1,5 @@
 # lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2010 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.
@@ -59,7 +59,7 @@ if test "$GCC" = yes; then
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD],
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-       test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
index 2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0..90e1ac9170d3418035f0c6a299d16ae8aadcebee 100644 (file)
@@ -1,5 +1,5 @@
 # lib-link.m4 serial 20 (gettext-0.18)
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
index 4b7ee3358debcbd4991f12831aba90601bb4d361..1601ceaefd3c2b447b569f991813be12b0e06e2d 100644 (file)
@@ -1,5 +1,5 @@
 # lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2010 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.
index b416e31a35e02e1bc284200ff92c16fda3d09dd0..9da8465ebfb47c04d1385753df55e56f61c92871 100644 (file)
@@ -1,5 +1,5 @@
 # lock.m4 serial 10 (gettext-0.18)
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2010 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.
index eedc8d56826218e41849ce337e63964a968b7a1a..cca3c1a90fa9d399493c7a7b9a885b4ca5270971 100644 (file)
@@ -1,5 +1,5 @@
 # longlong.m4 serial 14
-dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2007, 2009-2010 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.
@@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
     [AC_LINK_IFELSE(
        [_AC_TYPE_LONG_LONG_SNIPPET],
        [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
-       dnl If cross compiling, assume the bug isn't important, since
-       dnl nobody cross compiles for this platform as far as we know.
-       AC_RUN_IFELSE(
-         [AC_LANG_PROGRAM(
-            [[@%:@include <limits.h>
-              @%:@ifndef LLONG_MAX
-              @%:@ define HALF \
-                       (1LL << (sizeof (long long int) * CHAR_BIT - 2))
-              @%:@ define LLONG_MAX (HALF - 1 + HALF)
-              @%:@endif]],
-            [[long long int n = 1;
-              int i;
-              for (i = 0; ; i++)
-                {
-                  long long int m = n << i;
-                  if (m >> i != n)
-                    return 1;
-                  if (LLONG_MAX / 2 < m)
-                    break;
-                }
-              return 0;]])],
-         [ac_cv_type_long_long_int=yes],
-         [ac_cv_type_long_long_int=no],
-         [ac_cv_type_long_long_int=yes])],
+        dnl If cross compiling, assume the bug isn't important, since
+        dnl nobody cross compiles for this platform as far as we know.
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[@%:@include <limits.h>
+               @%:@ifndef LLONG_MAX
+               @%:@ define HALF \
+                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+               @%:@ define LLONG_MAX (HALF - 1 + HALF)
+               @%:@endif]],
+             [[long long int n = 1;
+               int i;
+               for (i = 0; ; i++)
+                 {
+                   long long int m = n << i;
+                   if (m >> i != n)
+                     return 1;
+                   if (LLONG_MAX / 2 < m)
+                     break;
+                 }
+               return 0;]])],
+          [ac_cv_type_long_long_int=yes],
+          [ac_cv_type_long_long_int=no],
+          [ac_cv_type_long_long_int=yes])],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
 [
   AC_LANG_PROGRAM(
     [[/* For now, do not test the preprocessor; as of 2007 there are too many
-        implementations with broken preprocessors.  Perhaps this can
-        be revisited in 2012.  In the meantime, code should not expect
-        #if to work with literals wider than 32 bits.  */
+         implementations with broken preprocessors.  Perhaps this can
+         be revisited in 2012.  In the meantime, code should not expect
+         #if to work with literals wider than 32 bits.  */
       /* Test literals.  */
       long long int ll = 9223372036854775807ll;
       long long int nll = -9223372036854775807LL;
       unsigned long long int ull = 18446744073709551615ULL;
       /* Test constant expressions.   */
       typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
-                    ? 1 : -1)];
+                     ? 1 : -1)];
       int i = 63;]],
     [[/* Test availability of runtime routines for shift and division.  */
       long long int llmax = 9223372036854775807ll;
       unsigned long long int ullmax = 18446744073709551615ull;
       return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-             | (llmax / ll) | (llmax % ll)
-             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
-             | (ullmax / ull) | (ullmax % ull));]])
+              | (llmax / ll) | (llmax % ll)
+              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+              | (ullmax / ull) | (ullmax % ull));]])
 ])
index f336990709c2636072aacfd763a764da1d12db4a..f3084957c186bbac4bc6f4f398a15f5200add6a3 100644 (file)
@@ -1,5 +1,5 @@
 # lseek.m4 serial 4
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
@@ -19,21 +19,21 @@ int main ()
   /* Exit with success only if stdin is seekable.  */
   return lseek (0, (off_t)0, SEEK_CUR) < 0;
 }],
-        [if test -s conftest$ac_exeext \
-            && ./conftest$ac_exeext < conftest.$ac_ext \
-            && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
-           gl_cv_func_lseek_pipe=yes
-         else
-           gl_cv_func_lseek_pipe=no
-         fi],
-        [gl_cv_func_lseek_pipe=no])
+         [if test -s conftest$ac_exeext \
+             && ./conftest$ac_exeext < conftest.$ac_ext \
+             && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+            gl_cv_func_lseek_pipe=yes
+          else
+            gl_cv_func_lseek_pipe=no
+          fi],
+         [gl_cv_func_lseek_pipe=no])
      else
        AC_COMPILE_IFELSE([
 #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
 /* mingw and BeOS mistakenly return 0 when trying to seek on pipes.  */
   Choke me.
 #endif],
-        [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
+         [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
      fi])
   if test $gl_cv_func_lseek_pipe = no; then
     gl_REPLACE_LSEEK
@@ -46,5 +46,5 @@ AC_DEFUN([gl_REPLACE_LSEEK],
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   REPLACE_LSEEK=1
   AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
-           [Define to 1 if lseek does not detect pipes.])
+            [Define to 1 if lseek does not detect pipes.])
 ])
index 807017166ba35812585f8e41667b8181f4f20afa..910ac92292c8c9b2840ad1e9c8cfcb8d9a867f4c 100644 (file)
@@ -1,5 +1,5 @@
 # malloc.m4 serial 9
-dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index 1194bac2e81dbadeb030ed946d00f2304bd000c0..94596ef959a860c5dbba620109bb0341f99528e0 100644 (file)
@@ -1,5 +1,5 @@
 # memchr.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2010 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.
@@ -53,11 +53,11 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
     {
       int pagesize = getpagesize ();
       char *two_pages =
-       (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
-                      flags, fd, 0);
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
       if (two_pages != (char *)(-1)
-         && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
-       fence = two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        fence = two_pages + pagesize;
     }
 #endif
   if (fence)
index 9e3d3d956d4eb9914d4f6b24130ad86aa4f3a1c8..c6506ee5c8138e81d47ec6a603973211250eb3be 100644 (file)
@@ -1,5 +1,6 @@
 # memmem.m4 serial 14
-dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software
+dnl 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.
@@ -42,19 +43,19 @@ AC_DEFUN([gl_FUNC_MEMMEM],
     /* Check for quadratic performance.  */
     if (haystack && needle)
       {
-       memset (haystack, 'A', 2 * m);
-       haystack[2 * m] = 'B';
-       memset (needle, 'A', m);
-       needle[m] = 'B';
-       result = memmem (haystack, 2 * m + 1, needle, m + 1);
+        memset (haystack, 'A', 2 * m);
+        haystack[2 * m] = 'B';
+        memset (needle, 'A', m);
+        needle[m] = 'B';
+        result = memmem (haystack, 2 * m + 1, needle, m + 1);
       }
     /* Check for empty needle behavior.  */
     return !result || !memmem ("a", 1, 0, 0);]])],
-       [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
-       [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
-        dnl memmem that works in linear time.
-        AC_EGREP_CPP([Lucky user],
-          [
+        [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
+        [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
+         dnl memmem that works in linear time.
+         AC_EGREP_CPP([Lucky user],
+           [
 #include <features.h>
 #ifdef __GNU_LIBRARY__
  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
@@ -67,10 +68,10 @@ AC_DEFUN([gl_FUNC_MEMMEM],
   Lucky user
  #endif
 #endif
-          ],
-          [gl_cv_func_memmem_works=yes],
-          [gl_cv_func_memmem_works="guessing no"])
-       ])
+           ],
+           [gl_cv_func_memmem_works=yes],
+           [gl_cv_func_memmem_works="guessing no"])
+        ])
       ])
     if test "$gl_cv_func_memmem_works" != yes; then
       REPLACE_MEMMEM=1
index d2993fbaf78a91d458eb77e0352c981a1d0d5158..d9e9cecfd743b96583a0b2ec4026a6b2f67ba1b6 100644 (file)
@@ -1,5 +1,5 @@
 # minmax.m4 serial 3
-dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009, 2010 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.
index 14b6270d28a150c5e99d968bdd9814f1eba2c6bf..a6b7b9ac3b4954a5603f27408b2f5b3c3e90b61b 100644 (file)
@@ -1,5 +1,5 @@
 # mmap-anon.m4 serial 8
-dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2010 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.
index ec377bac86691e897398063ede37d01f02d4994a..389bd2bbaa6e73bbccc10e73f88c2ab079a24e0b 100644 (file)
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 5
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 5a12251f9a1cdb1dcd9333fb4957654867af1bbc..84afce6e5e0ecdd9efb11914772f14edae59707c 100644 (file)
@@ -1,5 +1,5 @@
-# netdb_h.m4 serial 5
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# netdb_h.m4 serial 6
+dnl Copyright (C) 2008, 2009, 2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_HEADER_NETDB],
 [
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([netdb.h])
   gl_CHECK_NEXT_HEADERS([netdb.h])
   if test $ac_cv_header_netdb_h = yes; then
     AC_COMPILE_IFELSE(
index 0b364342158dbc5ae0589d7a82b1cb5c3f0d0bd9..003704c4b93b51bf11bd430c4344be47b63cb856 100644 (file)
@@ -1,5 +1,6 @@
 # nls.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 1995-2003, 2005-2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
+dnl 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.
index 2284fa5054f5b863c25365bb1bbe08d53a36d423..960efe15d4e121d74e5ca16810c6597ef7545581 100644 (file)
@@ -1,5 +1,5 @@
 # po.m4 serial 17 (gettext-0.18)
-dnl Copyright (C) 1995-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2010 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.
index 5922d27891a07d26f56d94ae173a9fdd87838e24..820ddf52563f4026d331f72fbbb59ec94bdb2c7a 100644 (file)
@@ -1,5 +1,5 @@
 # printf-posix.m4 serial 5 (gettext-0.18)
-dnl Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009, 2010 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.
index 87aa45c5e7e5eceed46e249708235f78285425b7..ebca5364c467d51f91324b50bb2b248b3cc725a0 100644 (file)
@@ -1,5 +1,5 @@
 # printf.m4 serial 33
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
index e1d445d26734ecfbf6c756776d006878470a3715..2d804ac99d7087a595be309ce76de5c98f89ce92 100644 (file)
@@ -1,5 +1,5 @@
 # progtest.m4 serial 6 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2005, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2005, 2008-2010 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.
index 8d1b8f3c5f1ad8d18e799a7522e046045ad74d7d..35a3a4817fddcd3c2b2d11ae41b7d80c75e513f5 100644 (file)
@@ -1,5 +1,6 @@
 # read-file.m4 serial 2
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software
+dnl 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.
index 5925796864e033cb4e0794c9e751378f513b97c5..dc30235c176cb5f7228dfbf091aaed3f96d8f9c6 100644 (file)
@@ -1,5 +1,5 @@
 # realloc.m4 serial 9
-dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009, 2010 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.
index 35bd3d6ae37ec6fe189a0122d73166943e3787cc..ce992db1f18336a0775f3bd98bdd12cdb7e4e70f 100644 (file)
@@ -1,5 +1,5 @@
 # size_max.m4 serial 9
-dnl Copyright (C) 2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2010 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.
index 6021786ee146ea02ca697a1a90360dc95c6043d4..522b107b12679079050a1459d80b74c067d04743 100644 (file)
@@ -1,5 +1,5 @@
 # snprintf.m4 serial 5
-dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2010 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.
index 3edc010610314e8a89c80747470ed0ce1b61e2d5..aefb936079648fb775b698b0666eec1012a9b4a7 100644 (file)
@@ -1,5 +1,5 @@
 # sockets.m4 serial 6
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index 80ed5135fd3e9dceab8dfea491bf88166736c6b6..2933d4b890635f957b8aa58f936e40a2b7d6450b 100644 (file)
@@ -1,5 +1,5 @@
 # socklen.m4 serial 7
-dnl Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 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.
@@ -20,30 +20,30 @@ AC_DEFUN([gl_TYPE_SOCKLEN_T],
    AC_CHECK_TYPE([socklen_t], ,
      [AC_MSG_CHECKING([for socklen_t equivalent])
       AC_CACHE_VAL([gl_cv_socklen_t_equiv],
-       [# Systems have either "struct sockaddr *" or
-        # "void *" as the second argument to getpeername
-        gl_cv_socklen_t_equiv=
-        for arg2 in "struct sockaddr" void; do
-          for t in int size_t "unsigned int" "long int" "unsigned long int"; do
-            AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+        [# Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         gl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
+             AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
                  [[#include <sys/types.h>
                    #include <sys/socket.h>
 
                    int getpeername (int, $arg2 *, $t *);]],
                  [[$t len;
                   getpeername (0, 0, &len);]])],
-              [gl_cv_socklen_t_equiv="$t"])
-            test "$gl_cv_socklen_t_equiv" != "" && break
-          done
-          test "$gl_cv_socklen_t_equiv" != "" && break
-        done
+               [gl_cv_socklen_t_equiv="$t"])
+             test "$gl_cv_socklen_t_equiv" != "" && break
+           done
+           test "$gl_cv_socklen_t_equiv" != "" && break
+         done
       ])
       if test "$gl_cv_socklen_t_equiv" = ""; then
-       AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+        AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
       fi
       AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
       AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
-       [type to use in place of socklen_t if not defined])],
+        [type to use in place of socklen_t if not defined])],
      [#include <sys/types.h>
       #if HAVE_SYS_SOCKET_H
       # include <sys/socket.h>
index bbdfabc919f88659c3376d0ce70cc2748ad7bfa4..8a0c23603857399f96dd83bbf4f6e6564a8c7b43 100644 (file)
@@ -1,5 +1,5 @@
 # sockpfaf.m4 serial 7
-dnl Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2009, 2010 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.
index 57c804a80ff7da006714ce54b11da37c58557faa..3d672d7476b217bdc8777d6759f1f3bc5c53343d 100644 (file)
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2010 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.
@@ -38,77 +38,77 @@ AC_DEFUN([AC_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
      [ac_cv_header_stdbool_h],
      [AC_TRY_COMPILE(
-       [
-         #include <stdbool.h>
-         #ifndef bool
-          "error: bool is not defined"
-         #endif
-         #ifndef false
-          "error: false is not defined"
-         #endif
-         #if false
-          "error: false is not 0"
-         #endif
-         #ifndef true
-          "error: true is not defined"
-         #endif
-         #if true != 1
-          "error: true is not 1"
-         #endif
-         #ifndef __bool_true_false_are_defined
-          "error: __bool_true_false_are_defined is not defined"
-         #endif
+        [
+          #include <stdbool.h>
+          #ifndef bool
+           "error: bool is not defined"
+          #endif
+          #ifndef false
+           "error: false is not defined"
+          #endif
+          #if false
+           "error: false is not 0"
+          #endif
+          #ifndef true
+           "error: true is not defined"
+          #endif
+          #if true != 1
+           "error: true is not 1"
+          #endif
+          #ifndef __bool_true_false_are_defined
+           "error: __bool_true_false_are_defined is not defined"
+          #endif
 
-         struct s { _Bool s: 1; _Bool t; } s;
+          struct s { _Bool s: 1; _Bool t; } s;
 
-         char a[true == 1 ? 1 : -1];
-         char b[false == 0 ? 1 : -1];
-         char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-         char d[(bool) 0.5 == true ? 1 : -1];
-         bool e = &s;
-         char f[(_Bool) 0.0 == false ? 1 : -1];
-         char g[true];
-         char h[sizeof (_Bool)];
-         char i[sizeof s.t];
-         enum { j = false, k = true, l = false * true, m = true * 256 };
-         _Bool n[m];
-         char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-         #if defined __xlc__ || defined __GNUC__
-          /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
-             reported by James Lemley on 2005-10-05; see
-             http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-             This test is not quite right, since xlc is allowed to
-             reject this program, as the initializer for xlcbug is
-             not one of the forms that C requires support for.
-             However, doing the test right would require a run-time
-             test, and that would make cross-compilation harder.
-             Let us hope that IBM fixes the xlc bug, and also adds
-             support for this kind of constant expression.  In the
-             meantime, this test will reject xlc, which is OK, since
-             our stdbool.h substitute should suffice.  We also test
-             this with GCC, where it should work, to detect more
-             quickly whether someone messes up the test in the
-             future.  */
-          char digs[] = "0123456789";
-          int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-         #endif
-         /* Catch a bug in an HP-UX C compiler.  See
-            http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-            http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          */
-         _Bool q = true;
-         _Bool *pq = &q;
-       ],
-       [
-         *pq |= q;
-         *pq |= ! q;
-         /* Refer to every declared value, to avoid compiler optimizations.  */
-         return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                 + !m + !n + !o + !p + !q + !pq);
-       ],
-       [ac_cv_header_stdbool_h=yes],
-       [ac_cv_header_stdbool_h=no])])
+          char a[true == 1 ? 1 : -1];
+          char b[false == 0 ? 1 : -1];
+          char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+          char d[(bool) 0.5 == true ? 1 : -1];
+          bool e = &s;
+          char f[(_Bool) 0.0 == false ? 1 : -1];
+          char g[true];
+          char h[sizeof (_Bool)];
+          char i[sizeof s.t];
+          enum { j = false, k = true, l = false * true, m = true * 256 };
+          _Bool n[m];
+          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+          char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+          #if defined __xlc__ || defined __GNUC__
+           /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+              reported by James Lemley on 2005-10-05; see
+              http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+              This test is not quite right, since xlc is allowed to
+              reject this program, as the initializer for xlcbug is
+              not one of the forms that C requires support for.
+              However, doing the test right would require a run-time
+              test, and that would make cross-compilation harder.
+              Let us hope that IBM fixes the xlc bug, and also adds
+              support for this kind of constant expression.  In the
+              meantime, this test will reject xlc, which is OK, since
+              our stdbool.h substitute should suffice.  We also test
+              this with GCC, where it should work, to detect more
+              quickly whether someone messes up the test in the
+              future.  */
+           char digs[] = "0123456789";
+           int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+          #endif
+          /* Catch a bug in an HP-UX C compiler.  See
+             http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+             http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+           */
+          _Bool q = true;
+          _Bool *pq = &q;
+        ],
+        [
+          *pq |= q;
+          *pq |= ! q;
+          /* Refer to every declared value, to avoid compiler optimizations.  */
+          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                  + !m + !n + !o + !p + !q + !pq);
+        ],
+        [ac_cv_header_stdbool_h=yes],
+        [ac_cv_header_stdbool_h=no])])
    AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
      AC_DEFINE([HAVE_STDBOOL_H], [1], [Define to 1 if stdbool.h conforms to C99.])
index 682e9c626e6b8b43a21192617c4fd538b2fd9e4d..c8572de947dcd3fe6492189ec54b7811c4c9f4d0 100644 (file)
@@ -1,6 +1,6 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
 # stddef_h.m4 serial 1
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009, 2010 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.
index a2e8bdd62814a97e7be2875fd8f3cbf3b4c4ba8f..1cc57e6e9608a820725378eb081e253c6e35806f 100644 (file)
@@ -1,5 +1,5 @@
 # stdint.m4 serial 34
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
@@ -396,12 +396,12 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
        for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
          case $glsuf in
            '')  gltype1='int';;
-           l)  gltype1='long int';;
-           ll) gltype1='long long int';;
-           i64)        gltype1='__int64';;
-           u)  gltype1='unsigned int';;
-           ul) gltype1='unsigned long int';;
-           ull)        gltype1='unsigned long long int';;
+           l)   gltype1='long int';;
+           ll)  gltype1='long long int';;
+           i64) gltype1='__int64';;
+           u)   gltype1='unsigned int';;
+           ul)  gltype1='unsigned long int';;
+           ull) gltype1='unsigned long long int';;
            ui64)gltype1='unsigned __int64';;
          esac
          AC_COMPILE_IFELSE(
index 82f0c244c8ee0c7a34de7b75fead88478e5bd08e..b8e3c6cc711f17ab409131b9411ea51fe23d8d01 100644 (file)
@@ -1,5 +1,5 @@
 # stdint_h.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2010 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.
index ed828eac8908dc842b4b0ddecd27f2a2cc5a37d2..20af579d148de3ee1ffb720aaad06883d7dd229f 100644 (file)
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 21
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# stdio_h.m4 serial 24
+dnl Copyright (C) 2007-2010 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.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_STDIO_H],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
   gl_CHECK_NEXT_HEADERS([stdio.h])
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
@@ -30,6 +31,13 @@ AC_DEFUN([gl_STDIO_H],
       AC_LIBOBJ([stdio-write])
     fi
   ])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
+    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
+    snprintf vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -89,8 +97,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
   HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
-  HAVE_FSEEKO=1;                 AC_SUBST([HAVE_FSEEKO])
-  HAVE_FTELLO=1;                 AC_SUBST([HAVE_FTELLO])
   HAVE_RENAMEAT=1;               AC_SUBST([HAVE_RENAMEAT])
   HAVE_VASPRINTF=1;              AC_SUBST([HAVE_VASPRINTF])
   HAVE_VDPRINTF=1;               AC_SUBST([HAVE_VDPRINTF])
@@ -140,6 +146,6 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
   choke me
 # endif
 #endif]])],
-       [gl_cv_var_stdin_large_offset=yes],
-       [gl_cv_var_stdin_large_offset=no])])
+        [gl_cv_var_stdin_large_offset=yes],
+        [gl_cv_var_stdin_large_offset=no])])
 ])
index 4556ac04c5a2bab487d29d240f378a43d9e19f08..0693d1a5ec10a65c32a499af9348fe7734a96c6d 100644 (file)
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 21
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 22
+dnl Copyright (C) 2007-2010 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.
@@ -22,6 +22,20 @@ AC_DEFUN([gl_STDLIB_H],
       # include <random.h>
       #endif
     ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp
+    mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -80,6 +94,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
+  REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
-  VOID_UNSETENV=0;           AC_SUBST([VOID_UNSETENV])
+  REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
 ])
index 0dfdb1a18148e7207f62d9be4593e3a8c3cc3e68..33de423a02e92cb6ee9ad029c46170fb8dc4908c 100644 (file)
@@ -1,5 +1,5 @@
 # strcase.m4 serial 10
-dnl Copyright (C) 2002, 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2010 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.
index edc5c6e825efaef904b7a43e80e43afeaea68690..73c6d833784a50d05d6256da26ac17dc86850e86 100644 (file)
@@ -1,11 +1,11 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2007-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
@@ -64,33 +71,34 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
-  GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
+  GNULIB_STRVERSCMP=0;  AC_SUBST([GNULIB_STRVERSCMP])
+  HAVE_MBSLEN=0;        AC_SUBST([HAVE_MBSLEN])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
-  HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
-  HAVE_DECL_MEMRCHR=1;         AC_SUBST([HAVE_DECL_MEMRCHR])
-  HAVE_RAWMEMCHR=1;            AC_SUBST([HAVE_RAWMEMCHR])
-  HAVE_STPCPY=1;               AC_SUBST([HAVE_STPCPY])
-  HAVE_STPNCPY=1;              AC_SUBST([HAVE_STPNCPY])
-  HAVE_STRCHRNUL=1;            AC_SUBST([HAVE_STRCHRNUL])
-  HAVE_DECL_STRDUP=1;          AC_SUBST([HAVE_DECL_STRDUP])
-  HAVE_DECL_STRNDUP=1;         AC_SUBST([HAVE_DECL_STRNDUP])
-  HAVE_DECL_STRNLEN=1;         AC_SUBST([HAVE_DECL_STRNLEN])
-  HAVE_STRPBRK=1;              AC_SUBST([HAVE_STRPBRK])
-  HAVE_STRSEP=1;               AC_SUBST([HAVE_STRSEP])
-  HAVE_STRCASESTR=1;           AC_SUBST([HAVE_STRCASESTR])
-  HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
-  HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
-  HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
-  HAVE_STRVERSCMP=1;           AC_SUBST([HAVE_STRVERSCMP])
-  REPLACE_MEMCHR=0;            AC_SUBST([REPLACE_MEMCHR])
-  REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
-  REPLACE_STRDUP=0;            AC_SUBST([REPLACE_STRDUP])
-  REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
-  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
-  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
-  REPLACE_STRNDUP=0;           AC_SUBST([REPLACE_STRNDUP])
-  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
-  REPLACE_STRTOK_R=0;          AC_SUBST([REPLACE_STRTOK_R])
-  UNDEFINE_STRTOK_R=0;         AC_SUBST([UNDEFINE_STRTOK_R])
+  HAVE_DECL_MEMMEM=1;           AC_SUBST([HAVE_DECL_MEMMEM])
+  HAVE_MEMPCPY=1;               AC_SUBST([HAVE_MEMPCPY])
+  HAVE_DECL_MEMRCHR=1;          AC_SUBST([HAVE_DECL_MEMRCHR])
+  HAVE_RAWMEMCHR=1;             AC_SUBST([HAVE_RAWMEMCHR])
+  HAVE_STPCPY=1;                AC_SUBST([HAVE_STPCPY])
+  HAVE_STPNCPY=1;               AC_SUBST([HAVE_STPNCPY])
+  HAVE_STRCHRNUL=1;             AC_SUBST([HAVE_STRCHRNUL])
+  HAVE_DECL_STRDUP=1;           AC_SUBST([HAVE_DECL_STRDUP])
+  HAVE_DECL_STRNDUP=1;          AC_SUBST([HAVE_DECL_STRNDUP])
+  HAVE_DECL_STRNLEN=1;          AC_SUBST([HAVE_DECL_STRNLEN])
+  HAVE_STRPBRK=1;               AC_SUBST([HAVE_STRPBRK])
+  HAVE_STRSEP=1;                AC_SUBST([HAVE_STRSEP])
+  HAVE_STRCASESTR=1;            AC_SUBST([HAVE_STRCASESTR])
+  HAVE_DECL_STRTOK_R=1;         AC_SUBST([HAVE_DECL_STRTOK_R])
+  HAVE_DECL_STRERROR=1;         AC_SUBST([HAVE_DECL_STRERROR])
+  HAVE_DECL_STRSIGNAL=1;        AC_SUBST([HAVE_DECL_STRSIGNAL])
+  HAVE_STRVERSCMP=1;            AC_SUBST([HAVE_STRVERSCMP])
+  REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
+  REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
+  REPLACE_STRSTR=0;             AC_SUBST([REPLACE_STRSTR])
+  REPLACE_STRCASESTR=0;         AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRNDUP=0;            AC_SUBST([REPLACE_STRNDUP])
+  REPLACE_STRSIGNAL=0;          AC_SUBST([REPLACE_STRSIGNAL])
+  REPLACE_STRTOK_R=0;           AC_SUBST([REPLACE_STRTOK_R])
+  UNDEFINE_STRTOK_R=0;          AC_SUBST([UNDEFINE_STRTOK_R])
 ])
index 03ac182f3315f173a9db52f291d6394799e0b953..26aa1f782ac1a1c775ca44277cbbfe6f03185491 100644 (file)
@@ -1,6 +1,7 @@
 # Configure a replacement for <string.h>.
+# serial 2
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +17,11 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
 [
   AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([strings.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <strings.h>
+    ]], [strcasecmp strncasecmp])
 ])
 
 AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
index becce2bb17d52ccb64c32282173bffc769472e79..59e0950f1849af7179c8586ab86b5d12d1abef11 100644 (file)
@@ -1,5 +1,5 @@
 # strverscmp.m4 serial 7
-dnl Copyright (C) 2002, 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2010 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.
index e864b2c7e214e5d04ab7eeb6c9b3a6801ab5debc..1d47656027f788ff95ee98650cd87cc07cb0fe7d 100644 (file)
@@ -1,5 +1,5 @@
-# sys_socket_h.m4 serial 13
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+# sys_socket_h.m4 serial 14
+dnl Copyright (C) 2005-2010 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.
@@ -66,6 +66,18 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
     gl_PREREQ_SYS_H_WINSOCK2
   fi
   AC_SUBST([SYS_SOCKET_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !defined __GLIBC__ && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
 ])
 
 AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
index 838cf484e9ccb08df84523c53c823f04072e9d0b..5a113d02ea80c8de1cbbfd8518c6b988b5f534ff 100644 (file)
@@ -1,5 +1,5 @@
-# sys_stat_h.m4 serial 21   -*- Autoconf -*-
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 22   -*- Autoconf -*-
+dnl Copyright (C) 2006-2010 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.
@@ -27,6 +27,11 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
     [#include <sys/types.h>
      #include <sys/stat.h>])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
+    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+    mknod mknodat stat utimensat])
 ]) # gl_HEADER_SYS_STAT_H
 
 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
index f67791e813cf0049b71c71d23a9fb9fe46317764..bba460e4bcbf1f675b43580b30fa064b7b485c80 100644 (file)
@@ -1,5 +1,5 @@
 # threadlib.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2010 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.
index 16fefa19749450385b5b3066bb9a49160721518e..c00bfae922c1fac4e9b9f0409a25c84c11068a5b 100644 (file)
@@ -1,6 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -45,9 +45,9 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     [gl_cv_sys_struct_timespec_in_time_h],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM(
-         [[#include <time.h>
-         ]],
-         [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+          [[#include <time.h>
+          ]],
+          [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
        [gl_cv_sys_struct_timespec_in_time_h=yes],
        [gl_cv_sys_struct_timespec_in_time_h=no])])
 
@@ -59,12 +59,12 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
     AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
       [gl_cv_sys_struct_timespec_in_sys_time_h],
       [AC_COMPILE_IFELSE(
-        [AC_LANG_PROGRAM(
-           [[#include <sys/time.h>
-           ]],
-           [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
-        [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+            ]],
+            [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+         [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
     if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
       SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
     fi
index de22db906cfe9222888378d7399471ce796f59c3..b5938e79638a846153d3ac660a33bb24abb063f5 100644 (file)
@@ -1,6 +1,7 @@
 dnl Reentrant time functions like localtime_r.
 
-dnl Copyright (C) 2003, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+dnl 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.
index 734b6933e2fd383bff4af6fe847e9fc2c45b5227..03b51bcfe370473bec800875ff726cc2a49feac3 100644 (file)
@@ -1,5 +1,5 @@
 # uintmax_t.m4 serial 12
-dnl Copyright (C) 1997-2004, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2007-2010 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.
index eb652356b539a9f45a9903728470834138bc4b54..68ccf8834943224633400ad75d747ef59d5824af 100644 (file)
@@ -1,5 +1,5 @@
 # ungetc.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009, 2010 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.
@@ -13,21 +13,21 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
     [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
       ]], [FILE *f;
-          if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
-          if (fputs ("abc", f) < 0) return 2;
-          rewind (f);
-          if (fgetc (f) != 'a') return 3;
-          if (fgetc (f) != 'b') return 4;
-          if (ungetc ('d', f) != 'd') return 5;
-          if (ftell (f) != 1) return 6;
-          if (fgetc (f) != 'd') return 7;
-          if (ftell (f) != 2) return 8;
-          if (fseek (f, 0, SEEK_CUR) != 0) return 9;
-          if (ftell (f) != 2) return 10;
-          if (fgetc (f) != 'c') return 11;
-          fclose (f); remove ("conftest.tmp");])],
-       [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
-       [gl_cv_func_ungetc_works='guessing no'])
+           if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
+           if (fputs ("abc", f) < 0) return 2;
+           rewind (f);
+           if (fgetc (f) != 'a') return 3;
+           if (fgetc (f) != 'b') return 4;
+           if (ungetc ('d', f) != 'd') return 5;
+           if (ftell (f) != 1) return 6;
+           if (fgetc (f) != 'd') return 7;
+           if (ftell (f) != 2) return 8;
+           if (fseek (f, 0, SEEK_CUR) != 0) return 9;
+           if (ftell (f) != 2) return 10;
+           if (fgetc (f) != 'c') return 11;
+           fclose (f); remove ("conftest.tmp");])],
+        [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
+        [gl_cv_func_ungetc_works='guessing no'])
     ])
   if test "$gl_cv_func_ungetc_works" != yes; then
     AC_DEFINE([FUNC_UNGETC_BROKEN], [1],
index 88e60a05383599868a1efc4b54b078db4925cfeb..31d31c1e93b607f89c34b0dc0f72b5fd13646c29 100644 (file)
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 34
-dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# unistd_h.m4 serial 39
+dnl Copyright (C) 2006-2010 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.
@@ -11,6 +11,7 @@ AC_DEFUN([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.
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_C_INLINE])
 
   gl_CHECK_NEXT_HEADERS([unistd.h])
 
@@ -21,6 +22,24 @@ AC_DEFUN([gl_UNISTD_H],
     HAVE_UNISTD_H=0
   fi
   AC_SUBST([HAVE_UNISTD_H])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
+/* Some systems declare various items in the wrong headers.  */
+#ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -48,6 +67,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
   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_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
   GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
@@ -56,6 +76,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
   GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
   GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
+  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
   GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
   GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
   GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
@@ -66,6 +87,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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 Assume proper GNU behavior unless another module says otherwise.
   HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
@@ -80,12 +102,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_GETDTABLESIZE=1;   AC_SUBST([HAVE_GETDTABLESIZE])
   HAVE_GETGROUPS=1;       AC_SUBST([HAVE_GETGROUPS])
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
+  HAVE_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_GETUSERSHELL=1;    AC_SUBST([HAVE_GETUSERSHELL])
   HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
   HAVE_PIPE2=1;           AC_SUBST([HAVE_PIPE2])
+  HAVE_PREAD=1;           AC_SUBST([HAVE_PREAD])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
@@ -96,6 +120,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
+  HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_CLOSE=0;        AC_SUBST([REPLACE_CLOSE])
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
@@ -109,11 +134,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
   REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
+  REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
   REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
   REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
+  REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
   REPLACE_SYMLINK=0;      AC_SUBST([REPLACE_SYMLINK])
   REPLACE_UNLINK=0;       AC_SUBST([REPLACE_UNLINK])
   REPLACE_UNLINKAT=0;     AC_SUBST([REPLACE_UNLINKAT])
+  REPLACE_USLEEP=0;       AC_SUBST([REPLACE_USLEEP])
   REPLACE_WRITE=0;        AC_SUBST([REPLACE_WRITE])
   UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
index 3a1d1e01006402ffd34994d1abe1642e243bc43f..50a20cca2346803576a53ad8e39d5950cc3fbc33 100644 (file)
@@ -1,5 +1,5 @@
 # vasnprintf.m4 serial 29
-dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2010 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.
index 074b03cf721c24f711877409377e45e46813c8aa..b142bc0ff1998489934b245439e41c9f5dbe8830 100644 (file)
@@ -1,5 +1,6 @@
 # vasprintf.m4 serial 6
-dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2006-2007, 2009-2010 Free Software Foundation,
+dnl 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.
index 70bca56437f32fa82b229a628e3d2c254fb7c056..35a6dc0e7d78b970eda0181cde4d4e5511554163 100644 (file)
@@ -1,5 +1,5 @@
 # visibility.m4 serial 2 (gettext-0.18)
-dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2008, 2009, 2010 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.
index 3b37d460b33eb069c3709b8ae6809eb816e3a53d..ed189c23882b9f4c88adac2073b2441c4d64d6d6 100644 (file)
@@ -1,5 +1,5 @@
 # vsnprintf.m4 serial 5
-dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2007-2010 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.
index ce53a45cf5c4a8481933f2307f3e44f7a90ba0d4..e81485d01ea6535bbe0d040d7092c30662dba472 100644 (file)
@@ -1,23 +1,30 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2010 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 Written by Eric Blake.
 
-# wchar.m4 serial 25
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  AC_CACHE_CHECK([whether <wchar.h> is standalone],
-    [gl_cv_header_wchar_h_standalone],
-    [AC_COMPILE_IFELSE([[#include <wchar.h>
-wchar_t w;]],
-      [gl_cv_header_wchar_h_standalone=yes],
-      [gl_cv_header_wchar_h_standalone=no])])
+  AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
+  dnl Prepare for creating substitute <wchar.h>.
+  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+  dnl character support).
+  dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
+  AC_CHECK_HEADERS_ONCE([wchar.h])
+  gl_CHECK_NEXT_HEADERS([wchar.h])
+  if test $ac_cv_header_wchar_h = yes; then
+    HAVE_WCHAR_H=1
+  else
+    HAVE_WCHAR_H=0
+  fi
+  AC_SUBST([HAVE_WCHAR_H])
 
   AC_REQUIRE([gt_TYPE_WINT_T])
   if test $gt_cv_c_wint_t = yes; then
@@ -27,32 +34,73 @@ wchar_t w;]],
   fi
   AC_SUBST([HAVE_WINT_T])
 
-  dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
-  AC_REQUIRE([gl_STDDEF_H])
-
-  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
-    WCHAR_H=wchar.h
-  fi
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
+])
 
-  dnl Prepare for creating substitute <wchar.h>.
-  dnl Do it always: WCHAR_H may be empty here but can be set later.
-  dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
-  dnl character support).
-  AC_CHECK_HEADERS_ONCE([wchar.h])
-  if test $ac_cv_header_wchar_h = yes; then
-    HAVE_WCHAR_H=1
-  else
-    HAVE_WCHAR_H=0
+dnl Check whether <wchar.h> is usable at all.
+AC_DEFUN([gl_WCHAR_H_INLINE_OK],
+[
+  dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
+  dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
+  dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
+  dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
+  dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
+  AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
+    [gl_cv_header_wchar_h_correct_inline],
+    [gl_cv_header_wchar_h_correct_inline=yes
+     AC_LANG_CONFTEST([
+       AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+extern int zero (void);
+int main () { return zero(); }
+]])])
+     if AC_TRY_EVAL([ac_compile]); then
+       mv conftest.$ac_objext conftest1.$ac_objext
+       AC_LANG_CONFTEST([
+         AC_LANG_SOURCE([[#define wcstod renamed_wcstod
+#include <wchar.h>
+int zero (void) { return 0; }
+]])])
+       if AC_TRY_EVAL([ac_compile]); then
+         mv conftest.$ac_objext conftest2.$ac_objext
+         if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
+           :
+         else
+           gl_cv_header_wchar_h_correct_inline=no
+         fi
+       fi
+     fi
+     rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
+    ])
+  if test $gl_cv_header_wchar_h_correct_inline = no; then
+    AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
+This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
+C99 mode. You have four options:
+  - Add the flag -fgnu89-inline to CC and reconfigure, or
+  - Fix your include files, using parts of
+    <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
+  - Use a gcc version older than 4.3, or
+  - Don't use the flags -std=c99 or -std=gnu99.
+Configuration aborted.])
   fi
-  AC_SUBST([HAVE_WCHAR_H])
-  gl_CHECK_NEXT_HEADERS([wchar.h])
 ])
 
 dnl Unconditionally enables the replacement of <wchar.h>.
 AC_DEFUN([gl_REPLACE_WCHAR_H],
 [
-  AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  WCHAR_H=wchar.h
+  dnl This is a no-op, because <wchar.h> is always overridden.
+  :
 ])
 
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
@@ -99,5 +147,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
   REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
   REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
index fb27a7f65f46e0f23b883d01e9e74f84e13595b5..ed804e664ba7933d42051ff3f240e82f9d787998 100644 (file)
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2002-2003, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2010 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.
index 47a4363d79041b6481ed781bcbe798dc1b171ec9..a6c7d15cb50a60c46df73caef95f0fd1a0034809 100644 (file)
@@ -1,5 +1,5 @@
 # wint_t.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2010 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.
index 631893cf59f8a73fe279f39908d421f5dbd8a2e5..b653693a3029cb835e98c0d02be9683926e26e00 100644 (file)
@@ -1,5 +1,5 @@
 # xsize.m4 serial 4
-dnl Copyright (C) 2003-2004, 2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2010 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.
index a57179d52f76d4679496e6732977a2bdc09ac606..b0af681baefe0eddeeceb177d782cdd04df14a9f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006, 2008
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
@@ -97,15 +97,15 @@ __memchr (void const *s, int c_in, size_t n)
       repeated_one |= repeated_one << 31 << 1;
       repeated_c |= repeated_c << 31 << 1;
       if (8 < sizeof (longword))
-       {
-         size_t i;
-
-         for (i = 64; i < sizeof (longword) * 8; i *= 2)
-           {
-             repeated_one |= repeated_one << i;
-             repeated_c |= repeated_c << i;
-           }
-       }
+        {
+          size_t i;
+
+          for (i = 64; i < sizeof (longword) * 8; i *= 2)
+            {
+              repeated_one |= repeated_one << i;
+              repeated_c |= repeated_c << i;
+            }
+        }
     }
 
   /* Instead of the traditional loop which tests each byte, we will test a
@@ -144,8 +144,8 @@ __memchr (void const *s, int c_in, size_t n)
       longword longword1 = *longword_ptr ^ repeated_c;
 
       if ((((longword1 - repeated_one) & ~longword1)
-          & (repeated_one << 7)) != 0)
-       break;
+           & (repeated_one << 7)) != 0)
+        break;
       longword_ptr++;
       n -= sizeof (longword);
     }
@@ -162,7 +162,7 @@ __memchr (void const *s, int c_in, size_t n)
   for (; n > 0; --n, ++char_ptr)
     {
       if (*char_ptr == c)
-       return (void *) char_ptr;
+        return (void *) char_ptr;
     }
 
   return NULL;
index e4816ed1a4b20c56271b933526b3b581de99b765..544ed45551b7c02ae466b7df5206d266e91f001f 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2007,2008 Free Software
-   Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2004, 2007,
+   2008, 2009, 2010 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
@@ -38,7 +38,7 @@
    HAYSTACK.  */
 void *
 memmem (const void *haystack_start, size_t haystack_len,
-       const void *needle_start, size_t needle_len)
+        const void *needle_start, size_t needle_len)
 {
   /* Abstract memory is considered to be an array of 'unsigned char' values,
      not an array of 'char' values.  See ISO C 99 section 6.2.6.1.  */
@@ -63,10 +63,10 @@ memmem (const void *haystack_start, size_t haystack_len,
     {
       haystack = memchr (haystack, *needle, haystack_len);
       if (!haystack || __builtin_expect (needle_len == 1, 0))
-       return (void *) haystack;
+        return (void *) haystack;
       haystack_len -= haystack - (const unsigned char *) haystack_start;
       if (haystack_len < needle_len)
-       return NULL;
+        return NULL;
       return two_way_short_needle (haystack, haystack_len, needle, needle_len);
     }
   else
index 431e7dd918b0788fd8154b52fa17bb7d4e4de56b..76a683daa599f56205244b5ae23dceb2e227dcbb 100644 (file)
@@ -1,5 +1,6 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009, 2010 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
index a81e2b437848df43555eb15bff34832de1086287..e16d587a494dfa0dfb3137f4e1bc6c03a31fef6f 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a netdb.h header file for systems lacking it (read: MinGW).
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -39,6 +39,8 @@
 /* Get netdb.h definitions such as struct hostent for MinGW.  */
 #include <sys/socket.h>
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* Declarations for a platform that lacks <netdb.h>, or where it is
    incomplete.  */
 
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
 {
-  int ai_flags;                        /* Input flags.  */
-  int ai_family;               /* Protocol family for socket.  */
-  int ai_socktype;             /* Socket type.  */
-  int ai_protocol;             /* Protocol for socket.  */
-  socklen_t ai_addrlen;                /* Length of socket address.  */
-  struct sockaddr *ai_addr;    /* Socket address for socket.  */
-  char *ai_canonname;          /* Canonical name for service location.  */
-  struct addrinfo *ai_next;    /* Pointer to next in list.  */
+  int ai_flags;                 /* Input flags.  */
+  int ai_family;                /* Protocol family for socket.  */
+  int ai_socktype;              /* Socket type.  */
+  int ai_protocol;              /* Protocol for socket.  */
+  socklen_t ai_addrlen;         /* Length of socket address.  */
+  struct sockaddr *ai_addr;     /* Socket address for socket.  */
+  char *ai_canonname;           /* Canonical name for service location.  */
+  struct addrinfo *ai_next;     /* Pointer to next in list.  */
 };
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
 # ifndef AI_PASSIVE
-#  define AI_PASSIVE   0x0001  /* Socket address is intended for `bind'.  */
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
 # endif
 # ifndef AI_CANONNAME
-#  define AI_CANONNAME 0x0002  /* Request for canonical name.  */
+#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
 # endif
 # ifndef AI_NUMERICSERV
-#  define AI_NUMERICSERV       0x0400  /* Don't use name resolution.  */
+#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
 # endif
 
 # if 0
@@ -78,24 +80,24 @@ struct addrinfo
    define them.
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
-#  define AI_NUMERICHOST       0x0004  /* Don't use name resolution.  */
-#  define AI_V4MAPPED  0x0008  /* IPv4 mapped addresses are acceptable.  */
-#  define AI_ALL               0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
-#  define AI_ADDRCONFIG        0x0020  /* Use configuration of this host to choose
-                                  returned address type..  */
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+#  define AI_V4MAPPED   0x0008  /* IPv4 mapped addresses are acceptable.  */
+#  define AI_ALL                0x0010  /* Return IPv4 mapped and IPv6 addresses.  */
+#  define AI_ADDRCONFIG 0x0020  /* Use configuration of this host to choose
+                                   returned address type..  */
 # endif /* 0 */
 
 /* Error values for `getaddrinfo' function.  */
 # ifndef EAI_BADFLAGS
-#  define EAI_BADFLAGS   -1    /* Invalid value for `ai_flags' field.  */
-#  define EAI_NONAME     -2    /* NAME or SERVICE is unknown.  */
-#  define EAI_AGAIN      -3    /* Temporary failure in name resolution.  */
-#  define EAI_FAIL       -4    /* Non-recoverable failure in name res.  */
-#  define EAI_NODATA     -5    /* No address associated with NAME.  */
-#  define EAI_FAMILY     -6    /* `ai_family' not supported.  */
-#  define EAI_SOCKTYPE   -7    /* `ai_socktype' not supported.  */
-#  define EAI_SERVICE    -8    /* SERVICE not supported for `ai_socktype'.  */
-#  define EAI_MEMORY     -10   /* Memory allocation failure.  */
+#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
+#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
+#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
+#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
+#  define EAI_NODATA      -5    /* No address associated with NAME.  */
+#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
+#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
 # endif
 
 /* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
@@ -107,15 +109,15 @@ struct addrinfo
 
 # ifndef EAI_OVERFLOW
 /* Not defined on mingw32 and Haiku. */
-#  define EAI_OVERFLOW   -12   /* Argument buffer overflow.  */
+#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
 # endif
 # ifndef EAI_ADDRFAMILY
 /* Not defined on mingw32. */
-#  define EAI_ADDRFAMILY  -9   /* Address family for NAME not supported.  */
+#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
 # endif
 # ifndef EAI_SYSTEM
 /* Not defined on mingw32. */
-#  define EAI_SYSTEM     -11   /* System error returned in `errno'.  */
+#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
 # endif
 
 # if 0
@@ -124,12 +126,12 @@ struct addrinfo
 
    If they are restored, be sure to protect the definitions with #ifndef.  */
 #  ifndef EAI_INPROGRESS
-#   define EAI_INPROGRESS      -100    /* Processing request in progress.  */
-#   define EAI_CANCELED                -101    /* Request canceled.  */
-#   define EAI_NOTCANCELED     -102    /* Request not canceled.  */
-#   define EAI_ALLDONE         -103    /* All requests done.  */
-#   define EAI_INTR            -104    /* Interrupted by a signal.  */
-#   define EAI_IDN_ENCODE      -105    /* IDN encoding failed.  */
+#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
+#   define EAI_CANCELED         -101    /* Request canceled.  */
+#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
+#   define EAI_ALLDONE          -103    /* All requests done.  */
+#   define EAI_INTR             -104    /* Interrupted by a signal.  */
+#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
 #  endif
 # endif
 
@@ -139,16 +141,17 @@ struct addrinfo
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 extern int getaddrinfo (const char *restrict nodename,
-                       const char *restrict servname,
-                       const struct addrinfo *restrict hints,
-                       struct addrinfo **restrict res);
+                        const char *restrict servname,
+                        const struct addrinfo *restrict hints,
+                        struct addrinfo **restrict res)
+     _GL_ARG_NONNULL ((4));
 # endif
 
 # if !@HAVE_DECL_FREEADDRINFO@
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern void freeaddrinfo (struct addrinfo *ai);
+extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
 # endif
 
 # if !@HAVE_DECL_GAI_STRERROR@
@@ -163,9 +166,10 @@ extern const char *gai_strerror (int ecode);
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
 extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-                      char *restrict node, socklen_t nodelen,
-                      char *restrict service, socklen_t servicelen,
-                      int flags);
+                       char *restrict node, socklen_t nodelen,
+                       char *restrict service, socklen_t servicelen,
+                       int flags)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 /* Possible flags for getnameinfo.  */
index ec8f03fe78d0a9bdaad0d95f0516b08c3d20791a..ae7f6a8107f9af37c5f77e5592773af0642c3e31 100644 (file)
@@ -1,6 +1,6 @@
---- lib/gl/gettext.h.orig      2008-11-17 17:11:58.000000000 +0100
-+++ lib/gl/gettext.h   2008-11-17 17:12:03.000000000 +0100
-@@ -162,109 +162,4 @@
+--- lib/gl/gettext.h.orig      2010-01-26 15:38:07.000000000 +0100
++++ lib/gl/gettext.h   2010-01-26 15:38:14.000000000 +0100
+@@ -172,109 +172,4 @@
      return translation;
  }
  
@@ -32,8 +32,8 @@
 -#endif
 -static const char *
 -dcpgettext_expr (const char *domain,
--               const char *msgctxt, const char *msgid,
--               int category)
+-                 const char *msgctxt, const char *msgid,
+-                 int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
 -      translation = dcgettext (domain, msg_ctxt_id, category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (translation != msg_ctxt_id)
--      return translation;
+-        return translation;
 -    }
 -  return msgid;
 -}
@@ -77,9 +77,9 @@
 -#endif
 -static const char *
 -dcnpgettext_expr (const char *domain,
--                const char *msgctxt, const char *msgid,
--                const char *msgid_plural, unsigned long int n,
--                int category)
+-                  const char *msgctxt, const char *msgid,
+-                  const char *msgid_plural, unsigned long int n,
+-                  int category)
 -{
 -  size_t msgctxt_len = strlen (msgctxt) + 1;
 -  size_t msgid_len = strlen (msgid) + 1;
 -      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
 -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 -      if (msg_ctxt_id != buf)
--      free (msg_ctxt_id);
+-        free (msg_ctxt_id);
 -#endif
 -      if (!(translation == msg_ctxt_id || translation == msgid_plural))
--      return translation;
+-        return translation;
 -    }
 -  return (n == 1 ? msgid : msgid_plural);
 -}
index bf2e60b7242bc23cb3cd21e9b72f7d71e02a98d8..b37cae2004addba95f45327da82a097bd1394374 100644 (file)
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 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
@@ -42,146 +43,146 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
     switch (ap->type)
       {
       case TYPE_SCHAR:
-       ap->a.a_schar = va_arg (args, /*signed char*/ int);
-       break;
+        ap->a.a_schar = va_arg (args, /*signed char*/ int);
+        break;
       case TYPE_UCHAR:
-       ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
-       break;
+        ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
+        break;
       case TYPE_SHORT:
-       ap->a.a_short = va_arg (args, /*short*/ int);
-       break;
+        ap->a.a_short = va_arg (args, /*short*/ int);
+        break;
       case TYPE_USHORT:
-       ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
-       break;
+        ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
+        break;
       case TYPE_INT:
-       ap->a.a_int = va_arg (args, int);
-       break;
+        ap->a.a_int = va_arg (args, int);
+        break;
       case TYPE_UINT:
-       ap->a.a_uint = va_arg (args, unsigned int);
-       break;
+        ap->a.a_uint = va_arg (args, unsigned int);
+        break;
       case TYPE_LONGINT:
-       ap->a.a_longint = va_arg (args, long int);
-       break;
+        ap->a.a_longint = va_arg (args, long int);
+        break;
       case TYPE_ULONGINT:
-       ap->a.a_ulongint = va_arg (args, unsigned long int);
-       break;
+        ap->a.a_ulongint = va_arg (args, unsigned long int);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_LONGLONGINT:
-       ap->a.a_longlongint = va_arg (args, long long int);
-       break;
+        ap->a.a_longlongint = va_arg (args, long long int);
+        break;
       case TYPE_ULONGLONGINT:
-       ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
-       break;
+        ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
+        break;
 #endif
       case TYPE_DOUBLE:
-       ap->a.a_double = va_arg (args, double);
-       break;
+        ap->a.a_double = va_arg (args, double);
+        break;
       case TYPE_LONGDOUBLE:
-       ap->a.a_longdouble = va_arg (args, long double);
-       break;
+        ap->a.a_longdouble = va_arg (args, long double);
+        break;
       case TYPE_CHAR:
-       ap->a.a_char = va_arg (args, int);
-       break;
+        ap->a.a_char = va_arg (args, int);
+        break;
 #if HAVE_WINT_T
       case TYPE_WIDE_CHAR:
-       /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
-          default argument promotions", this is not the case in mingw32,
-          where wint_t is 'unsigned short'.  */
-       ap->a.a_wide_char =
-         (sizeof (wint_t) < sizeof (int)
-          ? va_arg (args, int)
-          : va_arg (args, wint_t));
-       break;
+        /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
+           default argument promotions", this is not the case in mingw32,
+           where wint_t is 'unsigned short'.  */
+        ap->a.a_wide_char =
+          (sizeof (wint_t) < sizeof (int)
+           ? (wint_t) va_arg (args, int)
+           : va_arg (args, wint_t));
+        break;
 #endif
       case TYPE_STRING:
-       ap->a.a_string = va_arg (args, const char *);
-       /* A null pointer is an invalid argument for "%s", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_string == NULL)
-         ap->a.a_string = "(NULL)";
-       break;
+        ap->a.a_string = va_arg (args, const char *);
+        /* A null pointer is an invalid argument for "%s", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_string == NULL)
+          ap->a.a_string = "(NULL)";
+        break;
 #if HAVE_WCHAR_T
       case TYPE_WIDE_STRING:
-       ap->a.a_wide_string = va_arg (args, const wchar_t *);
-       /* A null pointer is an invalid argument for "%ls", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_wide_string == NULL)
-         {
-           static const wchar_t wide_null_string[] =
-             {
-               (wchar_t)'(',
-               (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
-               (wchar_t)')',
-               (wchar_t)0
-             };
-           ap->a.a_wide_string = wide_null_string;
-         }
-       break;
+        ap->a.a_wide_string = va_arg (args, const wchar_t *);
+        /* A null pointer is an invalid argument for "%ls", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_wide_string == NULL)
+          {
+            static const wchar_t wide_null_string[] =
+              {
+                (wchar_t)'(',
+                (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
+                (wchar_t)')',
+                (wchar_t)0
+              };
+            ap->a.a_wide_string = wide_null_string;
+          }
+        break;
 #endif
       case TYPE_POINTER:
-       ap->a.a_pointer = va_arg (args, void *);
-       break;
+        ap->a.a_pointer = va_arg (args, void *);
+        break;
       case TYPE_COUNT_SCHAR_POINTER:
-       ap->a.a_count_schar_pointer = va_arg (args, signed char *);
-       break;
+        ap->a.a_count_schar_pointer = va_arg (args, signed char *);
+        break;
       case TYPE_COUNT_SHORT_POINTER:
-       ap->a.a_count_short_pointer = va_arg (args, short *);
-       break;
+        ap->a.a_count_short_pointer = va_arg (args, short *);
+        break;
       case TYPE_COUNT_INT_POINTER:
-       ap->a.a_count_int_pointer = va_arg (args, int *);
-       break;
+        ap->a.a_count_int_pointer = va_arg (args, int *);
+        break;
       case TYPE_COUNT_LONGINT_POINTER:
-       ap->a.a_count_longint_pointer = va_arg (args, long int *);
-       break;
+        ap->a.a_count_longint_pointer = va_arg (args, long int *);
+        break;
 #if HAVE_LONG_LONG_INT
       case TYPE_COUNT_LONGLONGINT_POINTER:
-       ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
-       break;
+        ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
+        break;
 #endif
 #if ENABLE_UNISTDIO
       /* The unistdio extensions.  */
       case TYPE_U8_STRING:
-       ap->a.a_u8_string = va_arg (args, const uint8_t *);
-       /* A null pointer is an invalid argument for "%U", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u8_string == NULL)
-         {
-           static const uint8_t u8_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u8_string = u8_null_string;
-         }
-       break;
+        ap->a.a_u8_string = va_arg (args, const uint8_t *);
+        /* A null pointer is an invalid argument for "%U", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u8_string == NULL)
+          {
+            static const uint8_t u8_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u8_string = u8_null_string;
+          }
+        break;
       case TYPE_U16_STRING:
-       ap->a.a_u16_string = va_arg (args, const uint16_t *);
-       /* A null pointer is an invalid argument for "%lU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u16_string == NULL)
-         {
-           static const uint16_t u16_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u16_string = u16_null_string;
-         }
-       break;
+        ap->a.a_u16_string = va_arg (args, const uint16_t *);
+        /* A null pointer is an invalid argument for "%lU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u16_string == NULL)
+          {
+            static const uint16_t u16_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u16_string = u16_null_string;
+          }
+        break;
       case TYPE_U32_STRING:
-       ap->a.a_u32_string = va_arg (args, const uint32_t *);
-       /* A null pointer is an invalid argument for "%llU", but in practice
-          it occurs quite frequently in printf statements that produce
-          debug output.  Use a fallback in this case.  */
-       if (ap->a.a_u32_string == NULL)
-         {
-           static const uint32_t u32_null_string[] =
-             { '(', 'N', 'U', 'L', 'L', ')', 0 };
-           ap->a.a_u32_string = u32_null_string;
-         }
-       break;
+        ap->a.a_u32_string = va_arg (args, const uint32_t *);
+        /* A null pointer is an invalid argument for "%llU", but in practice
+           it occurs quite frequently in printf statements that produce
+           debug output.  Use a fallback in this case.  */
+        if (ap->a.a_u32_string == NULL)
+          {
+            static const uint32_t u32_null_string[] =
+              { '(', 'N', 'U', 'L', 'L', ')', 0 };
+            ap->a.a_u32_string = u32_null_string;
+          }
+        break;
 #endif
       default:
-       /* Unknown type.  */
-       return -1;
+        /* Unknown type.  */
+        return -1;
       }
   return 0;
 }
index b663a63b17ad27db96b4056f045e986d0d9d9710..fcdee85c0d5213e1c857e58064b1a3857ae37ce5 100644 (file)
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 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
@@ -93,42 +94,42 @@ typedef struct
   arg_type type;
   union
   {
-    signed char                        a_schar;
-    unsigned char              a_uchar;
-    short                      a_short;
-    unsigned short             a_ushort;
-    int                                a_int;
-    unsigned int               a_uint;
-    long int                   a_longint;
-    unsigned long int          a_ulongint;
+    signed char                 a_schar;
+    unsigned char               a_uchar;
+    short                       a_short;
+    unsigned short              a_ushort;
+    int                         a_int;
+    unsigned int                a_uint;
+    long int                    a_longint;
+    unsigned long int           a_ulongint;
 #if HAVE_LONG_LONG_INT
-    long long int              a_longlongint;
-    unsigned long long int     a_ulonglongint;
+    long long int               a_longlongint;
+    unsigned long long int      a_ulonglongint;
 #endif
-    float                      a_float;
-    double                     a_double;
-    long double                        a_longdouble;
-    int                                a_char;
+    float                       a_float;
+    double                      a_double;
+    long double                 a_longdouble;
+    int                         a_char;
 #if HAVE_WINT_T
-    wint_t                     a_wide_char;
+    wint_t                      a_wide_char;
 #endif
-    const char*                        a_string;
+    const char*                 a_string;
 #if HAVE_WCHAR_T
-    const wchar_t*             a_wide_string;
+    const wchar_t*              a_wide_string;
 #endif
-    void*                      a_pointer;
-    signed char *              a_count_schar_pointer;
-    short *                    a_count_short_pointer;
-    int *                      a_count_int_pointer;
-    long int *                 a_count_longint_pointer;
+    void*                       a_pointer;
+    signed char *               a_count_schar_pointer;
+    short *                     a_count_short_pointer;
+    int *                       a_count_int_pointer;
+    long int *                  a_count_longint_pointer;
 #if HAVE_LONG_LONG_INT
-    long long int *            a_count_longlongint_pointer;
+    long long int *             a_count_longlongint_pointer;
 #endif
 #if ENABLE_UNISTDIO
     /* The unistdio extensions.  */
-    const uint8_t *            a_u8_string;
-    const uint16_t *           a_u16_string;
-    const uint32_t *           a_u32_string;
+    const uint8_t *             a_u8_string;
+    const uint16_t *            a_u16_string;
+    const uint32_t *            a_u32_string;
 #endif
   }
   a;
index 66b45a73f271f689a20b085f30c2e13b6cfb3f50..85be6d16c4bc17e51b4af4e7798f82b07451429e 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2010 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
@@ -80,10 +80,10 @@ STATIC
 int
 PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
 {
-  const CHAR_T *cp = format;           /* pointer into format */
-  size_t arg_posn = 0;         /* number of regular arguments consumed */
-  size_t d_allocated;                  /* allocated elements of d->dir */
-  size_t a_allocated;                  /* allocated elements of a->arg */
+  const CHAR_T *cp = format;            /* pointer into format */
+  size_t arg_posn = 0;          /* number of regular arguments consumed */
+  size_t d_allocated;                   /* allocated elements of d->dir */
+  size_t a_allocated;                   /* allocated elements of a->arg */
   size_t max_width_length = 0;
   size_t max_precision_length = 0;
 
@@ -99,501 +99,501 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
   a->arg = NULL;
 
 #define REGISTER_ARG(_index_,_type_) \
-  {                                                                    \
-    size_t n = (_index_);                                              \
-    if (n >= a_allocated)                                              \
-      {                                                                        \
-       size_t memory_size;                                             \
-       argument *memory;                                               \
-                                                                       \
-       a_allocated = xtimes (a_allocated, 2);                          \
-       if (a_allocated <= n)                                           \
-         a_allocated = xsum (n, 1);                                    \
-       memory_size = xtimes (a_allocated, sizeof (argument));          \
-       if (size_overflow_p (memory_size))                              \
-         /* Overflow, would lead to out of memory.  */                 \
-         goto out_of_memory;                                           \
-       memory = (argument *) (a->arg                                   \
-                              ? realloc (a->arg, memory_size)          \
-                              : malloc (memory_size));                 \
-       if (memory == NULL)                                             \
-         /* Out of memory.  */                                         \
-         goto out_of_memory;                                           \
-       a->arg = memory;                                                \
-      }                                                                        \
-    while (a->count <= n)                                              \
-      a->arg[a->count++].type = TYPE_NONE;                             \
-    if (a->arg[n].type == TYPE_NONE)                                   \
-      a->arg[n].type = (_type_);                                       \
-    else if (a->arg[n].type != (_type_))                               \
-      /* Ambiguous type for positional argument.  */                   \
-      goto error;                                                      \
+  {                                                                     \
+    size_t n = (_index_);                                               \
+    if (n >= a_allocated)                                               \
+      {                                                                 \
+        size_t memory_size;                                             \
+        argument *memory;                                               \
+                                                                        \
+        a_allocated = xtimes (a_allocated, 2);                          \
+        if (a_allocated <= n)                                           \
+          a_allocated = xsum (n, 1);                                    \
+        memory_size = xtimes (a_allocated, sizeof (argument));          \
+        if (size_overflow_p (memory_size))                              \
+          /* Overflow, would lead to out of memory.  */                 \
+          goto out_of_memory;                                           \
+        memory = (argument *) (a->arg                                   \
+                               ? realloc (a->arg, memory_size)          \
+                               : malloc (memory_size));                 \
+        if (memory == NULL)                                             \
+          /* Out of memory.  */                                         \
+          goto out_of_memory;                                           \
+        a->arg = memory;                                                \
+      }                                                                 \
+    while (a->count <= n)                                               \
+      a->arg[a->count++].type = TYPE_NONE;                              \
+    if (a->arg[n].type == TYPE_NONE)                                    \
+      a->arg[n].type = (_type_);                                        \
+    else if (a->arg[n].type != (_type_))                                \
+      /* Ambiguous type for positional argument.  */                    \
+      goto error;                                                       \
   }
 
   while (*cp != '\0')
     {
       CHAR_T c = *cp++;
       if (c == '%')
-       {
-         size_t arg_index = ARG_NONE;
-         DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
-
-         /* Initialize the next directive.  */
-         dp->dir_start = cp - 1;
-         dp->flags = 0;
-         dp->width_start = NULL;
-         dp->width_end = NULL;
-         dp->width_arg_index = ARG_NONE;
-         dp->precision_start = NULL;
-         dp->precision_end = NULL;
-         dp->precision_arg_index = ARG_NONE;
-         dp->arg_index = ARG_NONE;
-
-         /* Test for positional argument.  */
-         if (*cp >= '0' && *cp <= '9')
-           {
-             const CHAR_T *np;
-
-             for (np = cp; *np >= '0' && *np <= '9'; np++)
-               ;
-             if (*np == '$')
-               {
-                 size_t n = 0;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   n = xsum (xtimes (n, 10), *np - '0');
-                 if (n == 0)
-                   /* Positional argument 0.  */
-                   goto error;
-                 if (size_overflow_p (n))
-                   /* n too large, would lead to out of memory later.  */
-                   goto error;
-                 arg_index = n - 1;
-                 cp = np + 1;
-               }
-           }
-
-         /* Read the flags.  */
-         for (;;)
-           {
-             if (*cp == '\'')
-               {
-                 dp->flags |= FLAG_GROUP;
-                 cp++;
-               }
-             else if (*cp == '-')
-               {
-                 dp->flags |= FLAG_LEFT;
-                 cp++;
-               }
-             else if (*cp == '+')
-               {
-                 dp->flags |= FLAG_SHOWSIGN;
-                 cp++;
-               }
-             else if (*cp == ' ')
-               {
-                 dp->flags |= FLAG_SPACE;
-                 cp++;
-               }
-             else if (*cp == '#')
-               {
-                 dp->flags |= FLAG_ALT;
-                 cp++;
-               }
-             else if (*cp == '0')
-               {
-                 dp->flags |= FLAG_ZERO;
-                 cp++;
-               }
-             else
-               break;
-           }
-
-         /* Parse the field width.  */
-         if (*cp == '*')
-           {
-             dp->width_start = cp;
-             cp++;
-             dp->width_end = cp;
-             if (max_width_length < 1)
-               max_width_length = 1;
-
-             /* Test for positional argument.  */
-             if (*cp >= '0' && *cp <= '9')
-               {
-                 const CHAR_T *np;
-
-                 for (np = cp; *np >= '0' && *np <= '9'; np++)
-                   ;
-                 if (*np == '$')
-                   {
-                     size_t n = 0;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       n = xsum (xtimes (n, 10), *np - '0');
-                     if (n == 0)
-                       /* Positional argument 0.  */
-                       goto error;
-                     if (size_overflow_p (n))
-                       /* n too large, would lead to out of memory later.  */
-                       goto error;
-                     dp->width_arg_index = n - 1;
-                     cp = np + 1;
-                   }
-               }
-             if (dp->width_arg_index == ARG_NONE)
-               {
-                 dp->width_arg_index = arg_posn++;
-                 if (dp->width_arg_index == ARG_NONE)
-                   /* arg_posn wrapped around.  */
-                   goto error;
-               }
-             REGISTER_ARG (dp->width_arg_index, TYPE_INT);
-           }
-         else if (*cp >= '0' && *cp <= '9')
-           {
-             size_t width_length;
-
-             dp->width_start = cp;
-             for (; *cp >= '0' && *cp <= '9'; cp++)
-               ;
-             dp->width_end = cp;
-             width_length = dp->width_end - dp->width_start;
-             if (max_width_length < width_length)
-               max_width_length = width_length;
-           }
-
-         /* Parse the precision.  */
-         if (*cp == '.')
-           {
-             cp++;
-             if (*cp == '*')
-               {
-                 dp->precision_start = cp - 1;
-                 cp++;
-                 dp->precision_end = cp;
-                 if (max_precision_length < 2)
-                   max_precision_length = 2;
-
-                 /* Test for positional argument.  */
-                 if (*cp >= '0' && *cp <= '9')
-                   {
-                     const CHAR_T *np;
-
-                     for (np = cp; *np >= '0' && *np <= '9'; np++)
-                       ;
-                     if (*np == '$')
-                       {
-                         size_t n = 0;
-
-                         for (np = cp; *np >= '0' && *np <= '9'; np++)
-                           n = xsum (xtimes (n, 10), *np - '0');
-                         if (n == 0)
-                           /* Positional argument 0.  */
-                           goto error;
-                         if (size_overflow_p (n))
-                           /* n too large, would lead to out of memory
-                              later.  */
-                           goto error;
-                         dp->precision_arg_index = n - 1;
-                         cp = np + 1;
-                       }
-                   }
-                 if (dp->precision_arg_index == ARG_NONE)
-                   {
-                     dp->precision_arg_index = arg_posn++;
-                     if (dp->precision_arg_index == ARG_NONE)
-                       /* arg_posn wrapped around.  */
-                       goto error;
-                   }
-                 REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
-               }
-             else
-               {
-                 size_t precision_length;
-
-                 dp->precision_start = cp - 1;
-                 for (; *cp >= '0' && *cp <= '9'; cp++)
-                   ;
-                 dp->precision_end = cp;
-                 precision_length = dp->precision_end - dp->precision_start;
-                 if (max_precision_length < precision_length)
-                   max_precision_length = precision_length;
-               }
-           }
-
-         {
-           arg_type type;
-
-           /* Parse argument type/size specifiers.  */
-           {
-             int flags = 0;
-
-             for (;;)
-               {
-                 if (*cp == 'h')
-                   {
-                     flags |= (1 << (flags & 1));
-                     cp++;
-                   }
-                 else if (*cp == 'L')
-                   {
-                     flags |= 4;
-                     cp++;
-                   }
-                 else if (*cp == 'l')
-                   {
-                     flags += 8;
-                     cp++;
-                   }
-                 else if (*cp == 'j')
-                   {
-                     if (sizeof (intmax_t) > sizeof (long))
-                       {
-                         /* intmax_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (intmax_t) > sizeof (int))
-                       {
-                         /* intmax_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 'z' || *cp == 'Z')
-                   {
-                     /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
-                        because the warning facility in gcc-2.95.2 understands
-                        only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
-                     if (sizeof (size_t) > sizeof (long))
-                       {
-                         /* size_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (size_t) > sizeof (int))
-                       {
-                         /* size_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
-                 else if (*cp == 't')
-                   {
-                     if (sizeof (ptrdiff_t) > sizeof (long))
-                       {
-                         /* ptrdiff_t = long long */
-                         flags += 16;
-                       }
-                     else if (sizeof (ptrdiff_t) > sizeof (int))
-                       {
-                         /* ptrdiff_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+        {
+          size_t arg_index = ARG_NONE;
+          DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */
+
+          /* Initialize the next directive.  */
+          dp->dir_start = cp - 1;
+          dp->flags = 0;
+          dp->width_start = NULL;
+          dp->width_end = NULL;
+          dp->width_arg_index = ARG_NONE;
+          dp->precision_start = NULL;
+          dp->precision_end = NULL;
+          dp->precision_arg_index = ARG_NONE;
+          dp->arg_index = ARG_NONE;
+
+          /* Test for positional argument.  */
+          if (*cp >= '0' && *cp <= '9')
+            {
+              const CHAR_T *np;
+
+              for (np = cp; *np >= '0' && *np <= '9'; np++)
+                ;
+              if (*np == '$')
+                {
+                  size_t n = 0;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    n = xsum (xtimes (n, 10), *np - '0');
+                  if (n == 0)
+                    /* Positional argument 0.  */
+                    goto error;
+                  if (size_overflow_p (n))
+                    /* n too large, would lead to out of memory later.  */
+                    goto error;
+                  arg_index = n - 1;
+                  cp = np + 1;
+                }
+            }
+
+          /* Read the flags.  */
+          for (;;)
+            {
+              if (*cp == '\'')
+                {
+                  dp->flags |= FLAG_GROUP;
+                  cp++;
+                }
+              else if (*cp == '-')
+                {
+                  dp->flags |= FLAG_LEFT;
+                  cp++;
+                }
+              else if (*cp == '+')
+                {
+                  dp->flags |= FLAG_SHOWSIGN;
+                  cp++;
+                }
+              else if (*cp == ' ')
+                {
+                  dp->flags |= FLAG_SPACE;
+                  cp++;
+                }
+              else if (*cp == '#')
+                {
+                  dp->flags |= FLAG_ALT;
+                  cp++;
+                }
+              else if (*cp == '0')
+                {
+                  dp->flags |= FLAG_ZERO;
+                  cp++;
+                }
+              else
+                break;
+            }
+
+          /* Parse the field width.  */
+          if (*cp == '*')
+            {
+              dp->width_start = cp;
+              cp++;
+              dp->width_end = cp;
+              if (max_width_length < 1)
+                max_width_length = 1;
+
+              /* Test for positional argument.  */
+              if (*cp >= '0' && *cp <= '9')
+                {
+                  const CHAR_T *np;
+
+                  for (np = cp; *np >= '0' && *np <= '9'; np++)
+                    ;
+                  if (*np == '$')
+                    {
+                      size_t n = 0;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        n = xsum (xtimes (n, 10), *np - '0');
+                      if (n == 0)
+                        /* Positional argument 0.  */
+                        goto error;
+                      if (size_overflow_p (n))
+                        /* n too large, would lead to out of memory later.  */
+                        goto error;
+                      dp->width_arg_index = n - 1;
+                      cp = np + 1;
+                    }
+                }
+              if (dp->width_arg_index == ARG_NONE)
+                {
+                  dp->width_arg_index = arg_posn++;
+                  if (dp->width_arg_index == ARG_NONE)
+                    /* arg_posn wrapped around.  */
+                    goto error;
+                }
+              REGISTER_ARG (dp->width_arg_index, TYPE_INT);
+            }
+          else if (*cp >= '0' && *cp <= '9')
+            {
+              size_t width_length;
+
+              dp->width_start = cp;
+              for (; *cp >= '0' && *cp <= '9'; cp++)
+                ;
+              dp->width_end = cp;
+              width_length = dp->width_end - dp->width_start;
+              if (max_width_length < width_length)
+                max_width_length = width_length;
+            }
+
+          /* Parse the precision.  */
+          if (*cp == '.')
+            {
+              cp++;
+              if (*cp == '*')
+                {
+                  dp->precision_start = cp - 1;
+                  cp++;
+                  dp->precision_end = cp;
+                  if (max_precision_length < 2)
+                    max_precision_length = 2;
+
+                  /* Test for positional argument.  */
+                  if (*cp >= '0' && *cp <= '9')
+                    {
+                      const CHAR_T *np;
+
+                      for (np = cp; *np >= '0' && *np <= '9'; np++)
+                        ;
+                      if (*np == '$')
+                        {
+                          size_t n = 0;
+
+                          for (np = cp; *np >= '0' && *np <= '9'; np++)
+                            n = xsum (xtimes (n, 10), *np - '0');
+                          if (n == 0)
+                            /* Positional argument 0.  */
+                            goto error;
+                          if (size_overflow_p (n))
+                            /* n too large, would lead to out of memory
+                               later.  */
+                            goto error;
+                          dp->precision_arg_index = n - 1;
+                          cp = np + 1;
+                        }
+                    }
+                  if (dp->precision_arg_index == ARG_NONE)
+                    {
+                      dp->precision_arg_index = arg_posn++;
+                      if (dp->precision_arg_index == ARG_NONE)
+                        /* arg_posn wrapped around.  */
+                        goto error;
+                    }
+                  REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
+                }
+              else
+                {
+                  size_t precision_length;
+
+                  dp->precision_start = cp - 1;
+                  for (; *cp >= '0' && *cp <= '9'; cp++)
+                    ;
+                  dp->precision_end = cp;
+                  precision_length = dp->precision_end - dp->precision_start;
+                  if (max_precision_length < precision_length)
+                    max_precision_length = precision_length;
+                }
+            }
+
+          {
+            arg_type type;
+
+            /* Parse argument type/size specifiers.  */
+            {
+              int flags = 0;
+
+              for (;;)
+                {
+                  if (*cp == 'h')
+                    {
+                      flags |= (1 << (flags & 1));
+                      cp++;
+                    }
+                  else if (*cp == 'L')
+                    {
+                      flags |= 4;
+                      cp++;
+                    }
+                  else if (*cp == 'l')
+                    {
+                      flags += 8;
+                      cp++;
+                    }
+                  else if (*cp == 'j')
+                    {
+                      if (sizeof (intmax_t) > sizeof (long))
+                        {
+                          /* intmax_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (intmax_t) > sizeof (int))
+                        {
+                          /* intmax_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 'z' || *cp == 'Z')
+                    {
+                      /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
+                         because the warning facility in gcc-2.95.2 understands
+                         only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).  */
+                      if (sizeof (size_t) > sizeof (long))
+                        {
+                          /* size_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (size_t) > sizeof (int))
+                        {
+                          /* size_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
+                  else if (*cp == 't')
+                    {
+                      if (sizeof (ptrdiff_t) > sizeof (long))
+                        {
+                          /* ptrdiff_t = long long */
+                          flags += 16;
+                        }
+                      else if (sizeof (ptrdiff_t) > sizeof (int))
+                        {
+                          /* ptrdiff_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #if defined __APPLE__ && defined __MACH__
-                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'q')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* int64_t = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* int64_t = long */
-                         flags += 8;
-                       }
-                     cp++;
-                   }
+                  /* On MacOS X 10.3, PRIdMAX is defined as "qd".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'q')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* int64_t = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* int64_t = long */
+                          flags += 8;
+                        }
+                      cp++;
+                    }
 #endif
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                 /* On native Win32, PRIdMAX is defined as "I64d".
-                    We cannot change it to "lld" because PRIdMAX must also
-                    be understood by the system's printf routines.  */
-                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
-                   {
-                     if (64 / 8 > sizeof (long))
-                       {
-                         /* __int64 = long long */
-                         flags += 16;
-                       }
-                     else
-                       {
-                         /* __int64 = long */
-                         flags += 8;
-                       }
-                     cp += 3;
-                   }
+                  /* On native Win32, PRIdMAX is defined as "I64d".
+                     We cannot change it to "lld" because PRIdMAX must also
+                     be understood by the system's printf routines.  */
+                  else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
+                    {
+                      if (64 / 8 > sizeof (long))
+                        {
+                          /* __int64 = long long */
+                          flags += 16;
+                        }
+                      else
+                        {
+                          /* __int64 = long */
+                          flags += 8;
+                        }
+                      cp += 3;
+                    }
 #endif
-                 else
-                   break;
-               }
-
-             /* Read the conversion character.  */
-             c = *cp++;
-             switch (c)
-               {
-               case 'd': case 'i':
+                  else
+                    break;
+                }
+
+              /* Read the conversion character.  */
+              c = *cp++;
+              switch (c)
+                {
+                case 'd': case 'i':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGLONGINT;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lld" into TYPE_LONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_LONGINT;
-                 else if (flags & 2)
-                   type = TYPE_SCHAR;
-                 else if (flags & 1)
-                   type = TYPE_SHORT;
-                 else
-                   type = TYPE_INT;
-                 break;
-               case 'o': case 'u': case 'x': case 'X':
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lld" into TYPE_LONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_LONGINT;
+                  else if (flags & 2)
+                    type = TYPE_SCHAR;
+                  else if (flags & 1)
+                    type = TYPE_SHORT;
+                  else
+                    type = TYPE_INT;
+                  break;
+                case 'o': case 'u': case 'x': case 'X':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_ULONGLONGINT;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_ULONGLONGINT;
+                  else
 #endif
-                 /* If 'unsigned long long' exists and is the same as
-                    'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
-                 if (flags >= 8)
-                   type = TYPE_ULONGINT;
-                 else if (flags & 2)
-                   type = TYPE_UCHAR;
-                 else if (flags & 1)
-                   type = TYPE_USHORT;
-                 else
-                   type = TYPE_UINT;
-                 break;
-               case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-               case 'a': case 'A':
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_LONGDOUBLE;
-                 else
-                   type = TYPE_DOUBLE;
-                 break;
-               case 'c':
-                 if (flags >= 8)
+                  /* If 'unsigned long long' exists and is the same as
+                     'unsigned long', we parse "llu" into TYPE_ULONGINT.  */
+                  if (flags >= 8)
+                    type = TYPE_ULONGINT;
+                  else if (flags & 2)
+                    type = TYPE_UCHAR;
+                  else if (flags & 1)
+                    type = TYPE_USHORT;
+                  else
+                    type = TYPE_UINT;
+                  break;
+                case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                case 'a': case 'A':
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_LONGDOUBLE;
+                  else
+                    type = TYPE_DOUBLE;
+                  break;
+                case 'c':
+                  if (flags >= 8)
 #if HAVE_WINT_T
-                   type = TYPE_WIDE_CHAR;
+                    type = TYPE_WIDE_CHAR;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_CHAR;
-                 break;
+                  else
+                    type = TYPE_CHAR;
+                  break;
 #if HAVE_WINT_T
-               case 'C':
-                 type = TYPE_WIDE_CHAR;
-                 c = 'c';
-                 break;
+                case 'C':
+                  type = TYPE_WIDE_CHAR;
+                  c = 'c';
+                  break;
 #endif
-               case 's':
-                 if (flags >= 8)
+                case 's':
+                  if (flags >= 8)
 #if HAVE_WCHAR_T
-                   type = TYPE_WIDE_STRING;
+                    type = TYPE_WIDE_STRING;
 #else
-                   goto error;
+                    goto error;
 #endif
-                 else
-                   type = TYPE_STRING;
-                 break;
+                  else
+                    type = TYPE_STRING;
+                  break;
 #if HAVE_WCHAR_T
-               case 'S':
-                 type = TYPE_WIDE_STRING;
-                 c = 's';
-                 break;
+                case 'S':
+                  type = TYPE_WIDE_STRING;
+                  c = 's';
+                  break;
 #endif
-               case 'p':
-                 type = TYPE_POINTER;
-                 break;
-               case 'n':
+                case 'p':
+                  type = TYPE_POINTER;
+                  break;
+                case 'n':
 #if HAVE_LONG_LONG_INT
-                 /* If 'long long' exists and is larger than 'long':  */
-                 if (flags >= 16 || (flags & 4))
-                   type = TYPE_COUNT_LONGLONGINT_POINTER;
-                 else
+                  /* If 'long long' exists and is larger than 'long':  */
+                  if (flags >= 16 || (flags & 4))
+                    type = TYPE_COUNT_LONGLONGINT_POINTER;
+                  else
 #endif
-                 /* If 'long long' exists and is the same as 'long', we parse
-                    "lln" into TYPE_COUNT_LONGINT_POINTER.  */
-                 if (flags >= 8)
-                   type = TYPE_COUNT_LONGINT_POINTER;
-                 else if (flags & 2)
-                   type = TYPE_COUNT_SCHAR_POINTER;
-                 else if (flags & 1)
-                   type = TYPE_COUNT_SHORT_POINTER;
-                 else
-                   type = TYPE_COUNT_INT_POINTER;
-                 break;
+                  /* If 'long long' exists and is the same as 'long', we parse
+                     "lln" into TYPE_COUNT_LONGINT_POINTER.  */
+                  if (flags >= 8)
+                    type = TYPE_COUNT_LONGINT_POINTER;
+                  else if (flags & 2)
+                    type = TYPE_COUNT_SCHAR_POINTER;
+                  else if (flags & 1)
+                    type = TYPE_COUNT_SHORT_POINTER;
+                  else
+                    type = TYPE_COUNT_INT_POINTER;
+                  break;
 #if ENABLE_UNISTDIO
-               /* The unistdio extensions.  */
-               case 'U':
-                 if (flags >= 16)
-                   type = TYPE_U32_STRING;
-                 else if (flags >= 8)
-                   type = TYPE_U16_STRING;
-                 else
-                   type = TYPE_U8_STRING;
-                 break;
+                /* The unistdio extensions.  */
+                case 'U':
+                  if (flags >= 16)
+                    type = TYPE_U32_STRING;
+                  else if (flags >= 8)
+                    type = TYPE_U16_STRING;
+                  else
+                    type = TYPE_U8_STRING;
+                  break;
 #endif
-               case '%':
-                 type = TYPE_NONE;
-                 break;
-               default:
-                 /* Unknown conversion character.  */
-                 goto error;
-               }
-           }
-
-           if (type != TYPE_NONE)
-             {
-               dp->arg_index = arg_index;
-               if (dp->arg_index == ARG_NONE)
-                 {
-                   dp->arg_index = arg_posn++;
-                   if (dp->arg_index == ARG_NONE)
-                     /* arg_posn wrapped around.  */
-                     goto error;
-                 }
-               REGISTER_ARG (dp->arg_index, type);
-             }
-           dp->conversion = c;
-           dp->dir_end = cp;
-         }
-
-         d->count++;
-         if (d->count >= d_allocated)
-           {
-             size_t memory_size;
-             DIRECTIVE *memory;
-
-             d_allocated = xtimes (d_allocated, 2);
-             memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
-             if (size_overflow_p (memory_size))
-               /* Overflow, would lead to out of memory.  */
-               goto out_of_memory;
-             memory = (DIRECTIVE *) realloc (d->dir, memory_size);
-             if (memory == NULL)
-               /* Out of memory.  */
-               goto out_of_memory;
-             d->dir = memory;
-           }
-       }
+                case '%':
+                  type = TYPE_NONE;
+                  break;
+                default:
+                  /* Unknown conversion character.  */
+                  goto error;
+                }
+            }
+
+            if (type != TYPE_NONE)
+              {
+                dp->arg_index = arg_index;
+                if (dp->arg_index == ARG_NONE)
+                  {
+                    dp->arg_index = arg_posn++;
+                    if (dp->arg_index == ARG_NONE)
+                      /* arg_posn wrapped around.  */
+                      goto error;
+                  }
+                REGISTER_ARG (dp->arg_index, type);
+              }
+            dp->conversion = c;
+            dp->dir_end = cp;
+          }
+
+          d->count++;
+          if (d->count >= d_allocated)
+            {
+              size_t memory_size;
+              DIRECTIVE *memory;
+
+              d_allocated = xtimes (d_allocated, 2);
+              memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
+              if (size_overflow_p (memory_size))
+                /* Overflow, would lead to out of memory.  */
+                goto out_of_memory;
+              memory = (DIRECTIVE *) realloc (d->dir, memory_size);
+              if (memory == NULL)
+                /* Out of memory.  */
+                goto out_of_memory;
+              d->dir = memory;
+            }
+        }
 #if CHAR_T_ONLY_ASCII
       else if (!c_isascii (c))
-       {
-         /* Non-ASCII character.  Not supported.  */
-         goto error;
-       }
+        {
+          /* Non-ASCII character.  Not supported.  */
+          goto error;
+        }
 #endif
     }
   d->dir[d->count].dir_start = cp;
index 196aa19692c2b4740ec8f5a28905185e47db0159..685f7f76f4a7826646a753dcbb77416b469d407e 100644 (file)
@@ -1,5 +1,6 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 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
 
 
 /* Flags */
-#define FLAG_GROUP      1      /* ' flag */
-#define FLAG_LEFT       2      /* - flag */
-#define FLAG_SHOWSIGN   4      /* + flag */
-#define FLAG_SPACE      8      /* space flag */
-#define FLAG_ALT       16      /* # flag */
-#define FLAG_ZERO      32
+#define FLAG_GROUP       1      /* ' flag */
+#define FLAG_LEFT        2      /* - flag */
+#define FLAG_SHOWSIGN    4      /* + flag */
+#define FLAG_SPACE       8      /* space flag */
+#define FLAG_ALT        16      /* # flag */
+#define FLAG_ZERO       32
 
 /* arg_index value indicating that no argument is consumed.  */
-#define ARG_NONE       (~(size_t)0)
+#define ARG_NONE        (~(size_t)0)
 
 /* xxx_directive: A parsed directive.
    xxx_directives: A parsed format string.  */
@@ -163,10 +164,10 @@ extern int
        u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
 extern int
        u16_printf_parse (const uint16_t *format, u16_directives *d,
-                        arguments *a);
+                         arguments *a);
 extern int
        u32_printf_parse (const uint32_t *format, u32_directives *d,
-                        arguments *a);
+                         arguments *a);
 #else
 # ifdef STATIC
 STATIC
index 5771488ab19cf40c589e23fadf84034939886733..3d27d7193c6cd23d3ab0fda02b1cfd58d5b86e44 100644 (file)
@@ -1,5 +1,5 @@
 /* read-file.c -- read file contents into a string
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Bruno Haible.
 
    This program is free software; you can redistribute it and/or modify
@@ -45,36 +45,36 @@ fread_file (FILE * stream, size_t * length)
       size_t requested;
 
       if (size + BUFSIZ + 1 > alloc)
-       {
-         char *new_buf;
+        {
+          char *new_buf;
 
-         alloc += alloc / 2;
-         if (alloc < size + BUFSIZ + 1)
-           alloc = size + BUFSIZ + 1;
+          alloc += alloc / 2;
+          if (alloc < size + BUFSIZ + 1)
+            alloc = size + BUFSIZ + 1;
 
-         new_buf = realloc (buf, alloc);
-         if (!new_buf)
-           {
-             save_errno = errno;
-             break;
-           }
+          new_buf = realloc (buf, alloc);
+          if (!new_buf)
+            {
+              save_errno = errno;
+              break;
+            }
 
-         buf = new_buf;
-       }
+          buf = new_buf;
+        }
 
       requested = alloc - size - 1;
       count = fread (buf + size, 1, requested, stream);
       size += count;
 
       if (count != requested)
-       {
-         save_errno = errno;
-         if (ferror (stream))
-           break;
-         buf[size] = '\0';
-         *length = size;
-         return buf;
-       }
+        {
+          save_errno = errno;
+          if (ferror (stream))
+            break;
+          buf[size] = '\0';
+          *length = size;
+          return buf;
+        }
     }
 
   free (buf);
@@ -99,10 +99,10 @@ internal_read_file (const char *filename, size_t * length, const char *mode)
   if (fclose (stream) != 0)
     {
       if (out)
-       {
-         save_errno = errno;
-         free (out);
-       }
+        {
+          save_errno = errno;
+          free (out);
+        }
       errno = save_errno;
       return NULL;
     }
index 798d841fc3c4045cf3da9fd7dd6ec182bae8cc4d..465c3d1f783997fa2188aed97c987149d535d392 100644 (file)
@@ -1,5 +1,5 @@
 /* read-file.h -- read file contents into a string
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index 64b7d78c57dc7897592125c8afe7ff56b3636c73..f67e79d36a6c94ffef2ce4e038c7096aa0245939 100644 (file)
@@ -1,6 +1,7 @@
 /* realloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2010 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
@@ -71,7 +72,7 @@ rpl_realloc (void *p, size_t n)
     {
 #if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
       if (n == 0)
-       n = 1;
+        n = 1;
 #endif
       result = malloc (n);
     }
index 68f3409202ffed142f6498817c1d4884866d7344..cc99ee3f3d08f5e3c801dde09899067bcf699e81 100644 (file)
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
index 65434a94c1679fd1c4b4dea1328c78fcc7a12a34..d9207a8e6eeed3b18b9da025e81bd862f7af4609 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
@@ -53,11 +53,11 @@ snprintf (char *str, size_t size, const char *format, ...)
   if (output != str)
     {
       if (size)
-       {
-         size_t pruned_len = (len < size ? len : size - 1);
-         memcpy (str, output, pruned_len);
-         str[pruned_len] = '\0';
-       }
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
 
       free (output);
     }
index a6bbf03c9ede176b839bb40e4ea1b1f8471c2f67..113dc17dcb4941c09fcc1ea6c40adcee849f074a 100644 (file)
@@ -1,6 +1,6 @@
 /* sockets.c --- wrappers for Windows socket functions
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
@@ -46,21 +46,21 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
     {
       /* fd refers to a socket.  */
       /* FIXME: other applications, like squid, use an undocumented
-        _free_osfhnd free function.  But this is not enough: The 'osfile'
-        flags for fd also needs to be cleared, but it is hard to access it.
-        Instead, here we just close twice the file descriptor.  */
+         _free_osfhnd free function.  But this is not enough: The 'osfile'
+         flags for fd also needs to be cleared, but it is hard to access it.
+         Instead, here we just close twice the file descriptor.  */
       if (closesocket (sock))
-       {
-         set_winsock_errno ();
-         return -1;
-       }
+        {
+          set_winsock_errno ();
+          return -1;
+        }
       else
-       {
-         /* This call frees the file descriptor and does a
-            CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
-         _close (fd);
-         return 0;
-       }
+        {
+          /* This call frees the file descriptor and does a
+             CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails.  */
+          _close (fd);
+          return 0;
+        }
     }
   else
     /* Some other type of file descriptor.  */
@@ -74,7 +74,7 @@ static int initialized_sockets_version /* = 0 */;
 #endif /* WINDOWS_SOCKETS */
 
 int
-gl_sockets_startup (int version _UNUSED_PARAMETER_)
+gl_sockets_startup (int version _GL_UNUSED)
 {
 #if WINDOWS_SOCKETS
   if (version > initialized_sockets_version)
@@ -84,13 +84,13 @@ gl_sockets_startup (int version _UNUSED_PARAMETER_)
 
       err = WSAStartup (version, &data);
       if (err != 0)
-       return 1;
+        return 1;
 
       if (data.wVersion < version)
-       return 2;
+        return 2;
 
       if (initialized_sockets_version == 0)
-       register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
 
       initialized_sockets_version = version;
     }
index 315d1b6422e8c16b0019625feaae0d5f846fa231..0bcbd9f70c4e5684fc7e9e19e7399924af93a98b 100644 (file)
@@ -1,6 +1,6 @@
 /* sockets.h - wrappers for Windows socket functions
 
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 45375b367ed96944c55560c4d3da1bdbdf04a5d1..7db57b230539cd7a8e8c4cf2334d6999fd1d0a06 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2010 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
index d47d0d962b1eca57fb9bfed49ebe4416bce10a3c..c8900d5fee9c06d88aa500b26115b17ae0313e9c 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index e7a3be57b099f4b9ec7d3c79a56da8d2df0c3de2..4251ef5255a85238cbd53cdfc3b5926dda910e31 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
    : /* The expression for the unsigned case.  The subtraction of (signed) \
-       is a nop in the unsigned case and avoids "signed integer overflow" \
-       warnings in the signed case.  */ \
+        is a nop in the unsigned case and avoids "signed integer overflow" \
+        warnings in the signed case.  */ \
      ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 /* 7.18.1.1. Exact-width integer types */
@@ -454,10 +454,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) -
 #undef SIG_ATOMIC_MAX
 #define SIG_ATOMIC_MIN  \
    _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 #define SIG_ATOMIC_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
+                0@SIG_ATOMIC_T_SUFFIX@)
 
 
 /* size_t limit */
index e52a7d8840d34dbbaf6c518ecd6bcd000fdf3d29..63687797f1417d3d8e64c2804de1dc74fc666c65 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation details of FILE streams.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 # if defined __DragonFly__          /* DragonFly */
   /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.  */
 #  define fp_ ((struct { struct __FILE_public pub; \
-                        struct { unsigned char *_base; int _size; } _bf; \
-                        void *cookie; \
-                        void *_close; \
-                        void *_read; \
-                        void *_seek; \
-                        void *_write; \
-                        struct { unsigned char *_base; int _size; } _ub; \
-                        int _ur; \
-                        unsigned char _ubuf[3]; \
-                        unsigned char _nbuf[1]; \
-                        struct { unsigned char *_base; int _size; } _lb; \
-                        int _blksize; \
-                        fpos_t _offset; \
-                        /* More fields, not relevant here.  */ \
-                      } *) fp)
+                         struct { unsigned char *_base; int _size; } _bf; \
+                         void *cookie; \
+                         void *_close; \
+                         void *_read; \
+                         void *_seek; \
+                         void *_write; \
+                         struct { unsigned char *_base; int _size; } _ub; \
+                         int _ur; \
+                         unsigned char _ubuf[3]; \
+                         unsigned char _nbuf[1]; \
+                         struct { unsigned char *_base; int _size; } _lb; \
+                         int _blksize; \
+                         fpos_t _offset; \
+                         /* More fields, not relevant here.  */ \
+                       } *) fp)
   /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.  */
 #  define _p pub._p
 #  define _flags pub._flags
 
 # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
 #  define fp_ ((struct { unsigned char *_ptr; \
-                        unsigned char *_base; \
-                        unsigned char *_end; \
-                        long _cnt; \
-                        int _file; \
-                        unsigned int _flag; \
-                      } *) fp)
+                         unsigned char *_base; \
+                         unsigned char *_end; \
+                         long _cnt; \
+                         int _file; \
+                         unsigned int _flag; \
+                       } *) fp)
 # else
 #  define fp_ fp
 # endif
index 01102d66cbbbec2134ea45061924a4ef47ef7409..866047c67d0df9eb4d6c92011bab2ce6c6f8a60a 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX compatible FILE stream write function.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2008.
 
    This program is free software: you can redistribute it and/or modify
 #  include <windows.h>
 
 #  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
-  if (ferror (stream))                                                       \
-    return (EXPRESSION);                                                     \
-  else                                                                       \
-    {                                                                        \
-      RETTYPE ret;                                                           \
-      SetLastError (0);                                                              \
-      ret = (EXPRESSION);                                                    \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      SetLastError (0);                                                       \
+      ret = (EXPRESSION);                                                     \
       if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
-       {                                                                     \
-         int fd = fileno (stream);                                           \
-         if (fd >= 0                                                         \
-             && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
-           {                                                                 \
-             /* Try to raise signal SIGPIPE.  */                             \
-             raise (SIGPIPE);                                                \
-             /* If it is currently blocked or ignored, change errno from     \
-                EINVAL to EPIPE.  */                                         \
-             errno = EPIPE;                                                  \
-           }                                                                 \
-       }                                                                     \
-      return ret;                                                            \
+        {                                                                     \
+          int fd = fileno (stream);                                           \
+          if (fd >= 0                                                         \
+              && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
+            {                                                                 \
+              /* Try to raise signal SIGPIPE.  */                             \
+              raise (SIGPIPE);                                                \
+              /* If it is currently blocked or ignored, change errno from     \
+                 EINVAL to EPIPE.  */                                         \
+              errno = EPIPE;                                                  \
+            }                                                                 \
+        }                                                                     \
+      return ret;                                                             \
     }
 
 #  if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */
index cd11a52a9193ceab58d3e2625947afab2d4f6671..156d28dcfc9ff4504a7c0b591c7f233fe5283bb7 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2010 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
 #ifndef _GL_STDIO_H
 #define _GL_STDIO_H
 
+/* Get va_list.  Needed on many systems, including glibc 2.8.  */
 #include <stdarg.h>
+
 #include <stddef.h>
 
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
-  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
-/* Get off_t and ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
+#include <sys/types.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -74,29 +72,27 @@ extern "C" {
 # endif
 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
 extern int dprintf (int fd, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf(d,f,a) \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf (d, f, a))
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_FCLOSE@
 # if @REPLACE_FCLOSE@
 #  define fclose rpl_fclose
   /* Close STREAM and its underlying file descriptor.  */
-extern int fclose (FILE *stream);
+extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
 #endif
 
 #if @GNULIB_FFLUSH@
@@ -112,44 +108,49 @@ extern int fclose (FILE *stream);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
 #endif
 
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning.  Assume it is
+   always declared, since it is required by C89.  */
+#undef gets
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
 #  undef fopen
 #  define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode);
+extern FILE * fopen (const char *filename, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
 #endif
 
 #if @GNULIB_FPRINTF_POSIX@
 # if @REPLACE_FPRINTF@
 #  define fprintf rpl_fprintf
 extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define fprintf rpl_fprintf
 extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_FPURGE@
@@ -163,134 +164,179 @@ extern int fprintf (FILE *fp, const char *format, ...)
      was before the write calls.  When discarding pending input, the file
      position is advanced to match the end of the previously read input.
      Return 0 if successful.  Upon error, return -1 and set errno.  */
-  extern int fpurge (FILE *gl_stream);
+  extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #endif
 
 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fputc
 # define fputc rpl_fputc
-extern int fputc (int c, FILE *stream);
+extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
 #endif
 
 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fputs
 # define fputs rpl_fputs
-extern int fputs (const char *string, FILE *stream);
+extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
 #  undef freopen
 #  define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
-#endif
-
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      rpl_fseek (f, o, w))
-# else
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module freopen for portability");
+#endif
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+
+   Most gnulib clients that perform stream operations should fall into
+   category three.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  undef fseek
 #  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef fseek
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseek (f, o, w))
+extern int fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FSEEKO@
+# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
+# endif
 # if @REPLACE_FSEEKO@
 /* Provide fseek, fseeko functions that are aware of a preceding
    fflush(), and which detect pipes.  */
+#  undef fseeko
 #  define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence);
+extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FSEEK@
 #   undef fseek
-#   define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseeko (f, o, w))
+#   define fseek rpl_fseek
+static inline int _GL_ARG_NONNULL ((1))
+rpl_fseek (FILE *fp, long offset, int whence)
+{
+  return fseeko (fp, offset, whence);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
 # undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
 #endif
 
-#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
+#endif
+
+/* See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
 # endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef ftell
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftell (f))
+# if @REPLACE_FTELL@
+#  undef ftell
+#  define ftell rpl_ftell
+extern long ftell (FILE *fp) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
 #if @GNULIB_FTELLO@
+# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
+# endif
 # if @REPLACE_FTELLO@
+#  undef ftello
 #  define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
+extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
 #  if !@GNULIB_FTELL@
 #   undef ftell
-#   define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftello (f))
+#   define ftell rpl_ftell
+static inline long _GL_ARG_NONNULL ((1))
+rpl_ftell (FILE *f)
+{
+  return ftello (f);
+}
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
 # undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
+#endif
+
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
 #endif
 
 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef fwrite
 # define fwrite rpl_fwrite
-extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
+extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
+     _GL_ARG_NONNULL ((1, 4));
 #endif
 
 #if @GNULIB_GETDELIM@
@@ -302,14 +348,15 @@ extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
-                        FILE *stream);
+                         FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                      \
-  (GL_LINK_WARNING ("getdelim is unportable - "                            \
-                   "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLINE@
@@ -324,14 +371,15 @@ extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
    bytes of space.  It is realloc'd as necessary.
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
-extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                              \
-  (GL_LINK_WARNING ("getline is unportable - "                         \
-                   "use gnulib module getline for portability"),       \
-   getline (l, s, f))
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
 #endif
 
 #if @GNULIB_OBSTACK_PRINTF@
@@ -347,10 +395,10 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
      memory allocation error, call obstack_alloc_failed_handler.  Upon
      other error, return -1.  */
   extern int obstack_printf (struct obstack *obs, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
   extern int obstack_vprintf (struct obstack *obs, const char *format,
-                             va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
+                              va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
 # endif
 #endif
 
@@ -364,24 +412,24 @@ extern void perror (const char *string);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
 #if @GNULIB_POPEN@
 # if @REPLACE_POPEN@
 #  undef popen
 #  define popen rpl_popen
-extern FILE *popen (const char *cmd, const char *mode);
+extern FILE *popen (const char *cmd, const char *mode)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef popen
-# define popen(c,m) \
-   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
-                     "use gnulib module popen or pipe for more portability"), \
-    popen (c, m))
+# 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
 
 #if @GNULIB_PRINTF_POSIX@
@@ -389,33 +437,25 @@ extern FILE *popen (const char *cmd, const char *mode);
 /* Don't break __attribute__((format(printf,M,N))).  */
 #  define printf __printf__
 extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 # endif
 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 /* Don't break __attribute__((format(printf,M,N))).  */
 # define printf __printf__
 extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
+       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef putc
 # define putc rpl_fputc
-extern int putc (int c, FILE *stream);
+extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
 #endif
 
 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
@@ -427,35 +467,34 @@ extern int putchar (int c);
 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # undef puts
 # define puts rpl_puts
-extern int puts (const char *string);
+extern int puts (const char *string) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
 #  undef remove
 #  define remove rpl_remove
-extern int remove (const char *name);
+extern int remove (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef remove
-# define remove(n)                                        \
-   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
-                     "use gnulib module remove for more portability"), \
-    remove (n))
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
+                 "use gnulib module remove for more portability");
 #endif
 
 #if @GNULIB_RENAME@
 # if @REPLACE_RENAME@
 #  undef rename
 #  define rename rpl_rename
-extern int rename (const char *old, const char *new);
+extern int rename (const char *old_filename, const char *new_filename)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rename
-# define rename(o,n)                                      \
-   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
-                     "use gnulib module rename for more portability"), \
-    rename (o, n))
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
 #if @GNULIB_RENAMEAT@
@@ -464,14 +503,15 @@ extern int rename (const char *old, const char *new);
 #  define renameat rpl_renameat
 # endif
 # if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
-extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
+extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
+     _GL_ARG_NONNULL ((2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef renameat
-# define renameat(d1,f1,d2,f2)            \
-    (GL_LINK_WARNING ("renameat is not portable - " \
-                      "use gnulib module renameat for portability"), \
-     renameat (d1, f1, d2, f2))
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
@@ -480,29 +520,39 @@ extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
 # endif
 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
 extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
+       __attribute__ ((__format__ (__printf__, 3, 4)))
+       _GL_ARG_NONNULL ((3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #endif
 
+/* Some people would argue that sprintf should be handled like gets
+   (for example, OpenBSD issues a link warning for both functions),
+   since both can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
+
 #if @GNULIB_SPRINTF_POSIX@
 # if @REPLACE_SPRINTF@
 #  define sprintf rpl_sprintf
 extern int sprintf (char *str, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
+       __attribute__ ((__format__ (__printf__, 2, 3)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VASPRINTF@
@@ -516,9 +566,9 @@ extern int sprintf (char *str, const char *format, ...)
      *RESULT and return the number of resulting bytes, excluding the trailing
      NUL.  Upon memory allocation error, or some other error, return -1.  */
   extern int asprintf (char **result, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
+    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
   extern int vasprintf (char **result, const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
+    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
 # endif
 #endif
 
@@ -528,52 +578,52 @@ extern int sprintf (char *str, const char *format, ...)
 # endif
 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
 extern int vdprintf (int fd, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VFPRINTF_POSIX@
 # if @REPLACE_VFPRINTF@
 #  define vfprintf rpl_vfprintf
 extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define vfprintf rpl_vfprintf
 extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 #elif defined GNULIB_POSIXCHECK
 # undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #if @GNULIB_VPRINTF_POSIX@
 # if @REPLACE_VPRINTF@
 #  define vprintf rpl_vprintf
 extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 # endif
 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 # define vprintf rpl_vprintf
 extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
+       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VSNPRINTF@
@@ -582,29 +632,30 @@ extern int vprintf (const char *format, va_list args)
 # endif
 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
+       __attribute__ ((__format__ (__printf__, 3, 0)))
+       _GL_ARG_NONNULL ((3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VSPRINTF_POSIX@
 # if @REPLACE_VSPRINTF@
 #  define vsprintf rpl_vsprintf
 extern int vsprintf (char *str, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
+       __attribute__ ((__format__ (__printf__, 2, 0)))
+       _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
 #ifdef __cplusplus
index 6ef85047fb5297eb33f6862ca1b53d908d3e64fb..a4ae16ebc08803446425d1ed3e58f9fb63b179de 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2010 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
@@ -39,7 +39,7 @@
 #include <stddef.h>
 
 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
-#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
 # include <sys/loadavg.h>
 #endif
 
 # include <random.h>
 #endif
 
-#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@
+#if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
+    || defined GNULIB_POSIXCHECK
 # include <stdint.h>
 #endif
 
 #if !@HAVE_STRUCT_RANDOM_DATA@
 struct random_data
 {
-  int32_t *fptr;               /* Front pointer.  */
-  int32_t *rptr;               /* Rear pointer.  */
-  int32_t *state;              /* Array of state values.  */
-  int rand_type;               /* Type of random number generator.  */
-  int rand_deg;                        /* Degree of random number generator.  */
-  int rand_sep;                        /* Distance between front and rear.  */
-  int32_t *end_ptr;            /* Pointer behind state table.  */
+  int32_t *fptr;                /* Front pointer.  */
+  int32_t *rptr;                /* Rear pointer.  */
+  int32_t *state;               /* Array of state values.  */
+  int rand_type;                /* Type of random number generator.  */
+  int rand_deg;                 /* Degree of random number generator.  */
+  int rand_sep;                 /* Distance between front and rear.  */
+  int32_t *end_ptr;             /* Pointer behind state table.  */
 };
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
@@ -91,14 +101,14 @@ extern "C" {
 # if !@HAVE_ATOLL@
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
-extern long long atoll (const char *string);
+extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
@@ -109,10 +119,9 @@ extern void * calloc (size_t nmemb, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -120,14 +129,14 @@ extern void * calloc (size_t nmemb, size_t size);
 #  define canonicalize_file_name rpl_canonicalize_file_name
 # endif
 # if !@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@
-extern char *canonicalize_file_name (const char *name);
+extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# 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
 
 #if @GNULIB_GETLOADAVG@
@@ -136,14 +145,14 @@ extern char *canonicalize_file_name (const char *name);
    The three numbers are the load average of the last 1 minute, the last 5
    minutes, and the last 15 minutes, respectively.
    LOADAVG is an array of NELEM numbers.  */
-extern int getloadavg (double loadavg[], int nelem);
+extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -159,14 +168,15 @@ extern int getloadavg (double loadavg[], int nelem);
    For more details see the POSIX:2001 specification.
    http://www.opengroup.org/susv3xsh/getsubopt.html */
 # if !@HAVE_GETSUBOPT@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
@@ -177,10 +187,9 @@ extern void * malloc (size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -190,14 +199,14 @@ extern void * malloc (size_t size);
    they are replaced with a string that makes the directory name unique.
    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
    The directory is created mode 700.  */
-extern char * mkdtemp (char * /*template*/);
+extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
@@ -214,14 +223,14 @@ extern char * mkdtemp (char * /*template*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemp (char * /*template*/, int /*flags*/);
+extern int mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
@@ -239,14 +248,15 @@ extern int mkostemp (char * /*template*/, int /*flags*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
+extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
@@ -261,17 +271,14 @@ extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/);
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
 #  define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/);
-# else
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-#  include <unistd.h>
+extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
@@ -286,21 +293,22 @@ extern int mkstemp (char * /*template*/);
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkstemps (char * /*template*/, int /*suffixlen*/);
+extern int mkstemps (char * /*template*/, int /*suffixlen*/)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
 #  undef putenv
 #  define putenv rpl_putenv
-extern int putenv (char *string);
+extern int putenv (char *string) _GL_ARG_NONNULL ((1));
 # endif
 #endif
 
@@ -311,33 +319,37 @@ extern int putenv (char *string);
 #   define RAND_MAX 2147483647
 #  endif
 
-int srandom_r (unsigned int seed, struct random_data *rand_state);
+int srandom_r (unsigned int seed, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2));
 int initstate_r (unsigned int seed, char *buf, size_t buf_size,
-                struct random_data *rand_state);
-int setstate_r (char *arg_state, struct random_data *rand_state);
-int random_r (struct random_data *buf, int32_t *result);
+                 struct random_data *rand_state)
+     _GL_ARG_NONNULL ((2, 4));
+int setstate_r (char *arg_state, struct random_data *rand_state)
+     _GL_ARG_NONNULL ((1, 2));
+int random_r (struct random_data *buf, int32_t *result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                           \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                      \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef srandom_r
-# define srandom_r(s,r)                                   \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef setstate_r
-# define setstate_r(a,r)                                   \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
 #if @GNULIB_REALLOC_POSIX@
@@ -348,10 +360,9 @@ extern void * realloc (void *ptr, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
@@ -359,35 +370,46 @@ extern void * realloc (void *ptr, size_t size);
 #  define realpath rpl_realpath
 # endif
 # if !@HAVE_REALPATH@ || @REPLACE_REALPATH@
-extern char *realpath (const char *name, char *resolved);
+extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
 # if !@HAVE_RPMATCH@
 /* Test a user response to a question.
    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
-extern int rpmatch (const char *response);
+extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
-# if !@HAVE_SETENV@
+# if @REPLACE_SETENV@
+#  undef setenv
+#  define setenv rpl_setenv
+# endif
+# if !@HAVE_SETENV@ || @REPLACE_SETENV@
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
-extern int setenv (const char *name, const char *value, int replace);
+extern int setenv (const char *name, const char *value, int replace)
+     _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef setenv
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
 # endif
 #endif
 
@@ -397,14 +419,14 @@ extern int setenv (const char *name, const char *value, int replace);
 # endif
 # if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
  /* Parse a double from STRING, updating ENDP if appropriate.  */
-extern double strtod (const char *str, char **endp);
+extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
@@ -417,14 +439,15 @@ extern double strtod (const char *str, char **endp);
    stored in *ENDPTR.
    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
    to ERANGE.  */
-extern long long strtoll (const char *string, char **endptr, int base);
+extern long long strtoll (const char *string, char **endptr, int base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
@@ -437,26 +460,31 @@ extern long long strtoll (const char *string, char **endptr, int base);
    stored in *ENDPTR.
    Upon overflow, the return value is ULLONG_MAX, and errno is set to
    ERANGE.  */
-extern unsigned long long strtoull (const char *string, char **endptr, int base);
+extern unsigned long long strtoull (const char *string, char **endptr, int base)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
-# if @HAVE_UNSETENV@
-#  if @VOID_UNSETENV@
-/* On some systems, unsetenv() returns void.
-   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
-#   define unsetenv(name) ((unsetenv)(name), 0)
-#  endif
-# else
+# if @REPLACE_UNSETENV@
+#  undef unsetenv
+#  define unsetenv rpl_unsetenv
+# endif
+# if !@HAVE_UNSETENV@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
-extern int unsetenv (const char *name);
+extern int unsetenv (const char *name) _GL_ARG_NONNULL ((1));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef unsetenv
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
 # endif
 #endif
 
index 69580736fa75b0bf76766c29d706c343b61eabf0..fa6eba04bc070c3e153dbabc9717f684427bda71 100644 (file)
@@ -1,5 +1,5 @@
 /* Byte-wise substring search, using the Two-Way algorithm.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Eric Blake <ebb9@byu.net>, 2008.
 
    <string.h>, and define:
      RESULT_TYPE             A macro that expands to the return type.
      AVAILABLE(h, h_l, j, n_l)
-                            A macro that returns nonzero if there are
-                            at least N_L bytes left starting at H[J].
-                            H is 'unsigned char *', H_L, J, and N_L
-                            are 'size_t'; H_L is an lvalue.  For
-                            NUL-terminated searches, H_L can be
-                            modified each iteration to avoid having
-                            to compute the end of H up front.
+                             A macro that returns nonzero if there are
+                             at least N_L bytes left starting at H[J].
+                             H is 'unsigned char *', H_L, J, and N_L
+                             are 'size_t'; H_L is an lvalue.  For
+                             NUL-terminated searches, H_L can be
+                             modified each iteration to avoid having
+                             to compute the end of H up front.
 
   For case-insensitivity, you may optionally define:
      CMP_FUNC(p1, p2, l)     A macro that returns 0 iff the first L
-                            characters of P1 and P2 are equal.
+                             characters of P1 and P2 are equal.
      CANON_ELEMENT(c)        A macro that canonicalizes an element right after
-                            it has been fetched from one of the two strings.
-                            The argument is an 'unsigned char'; the result
-                            must be an 'unsigned char' as well.
+                             it has been fetched from one of the two strings.
+                             The argument is an 'unsigned char'; the result
+                             must be an 'unsigned char' as well.
 
   This file undefines the macros documented above, and defines
   LONG_NEEDLE_THRESHOLD.
    periodicity.  */
 static size_t
 critical_factorization (const unsigned char *needle, size_t needle_len,
-                       size_t *period)
+                        size_t *period)
 {
   /* Index of last byte of left half, or SIZE_MAX.  */
   size_t max_suffix, max_suffix_rev;
@@ -130,29 +130,29 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
       a = CANON_ELEMENT (needle[j + k]);
       b = CANON_ELEMENT (needle[max_suffix + k]);
       if (a < b)
-       {
-         /* Suffix is smaller, period is entire prefix so far.  */
-         j += k;
-         k = 1;
-         p = j - max_suffix;
-       }
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix;
+        }
       else if (a == b)
-       {
-         /* Advance through repetition of the current period.  */
-         if (k != p)
-           ++k;
-         else
-           {
-             j += p;
-             k = 1;
-           }
-       }
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
       else /* b < a */
-       {
-         /* Suffix is larger, start over from current location.  */
-         max_suffix = j++;
-         k = p = 1;
-       }
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix = j++;
+          k = p = 1;
+        }
     }
   *period = p;
 
@@ -165,29 +165,29 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
       a = CANON_ELEMENT (needle[j + k]);
       b = CANON_ELEMENT (needle[max_suffix_rev + k]);
       if (b < a)
-       {
-         /* Suffix is smaller, period is entire prefix so far.  */
-         j += k;
-         k = 1;
-         p = j - max_suffix_rev;
-       }
+        {
+          /* Suffix is smaller, period is entire prefix so far.  */
+          j += k;
+          k = 1;
+          p = j - max_suffix_rev;
+        }
       else if (a == b)
-       {
-         /* Advance through repetition of the current period.  */
-         if (k != p)
-           ++k;
-         else
-           {
-             j += p;
-             k = 1;
-           }
-       }
+        {
+          /* Advance through repetition of the current period.  */
+          if (k != p)
+            ++k;
+          else
+            {
+              j += p;
+              k = 1;
+            }
+        }
       else /* a < b */
-       {
-         /* Suffix is larger, start over from current location.  */
-         max_suffix_rev = j++;
-         k = p = 1;
-       }
+        {
+          /* Suffix is larger, start over from current location.  */
+          max_suffix_rev = j++;
+          k = p = 1;
+        }
     }
 
   /* Choose the longer suffix.  Return the first byte of the right
@@ -210,7 +210,7 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
    HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.  */
 static RETURN_TYPE
 two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
-                     const unsigned char *needle, size_t needle_len)
+                      const unsigned char *needle, size_t needle_len)
 {
   size_t i; /* Index into current byte of NEEDLE.  */
   size_t j; /* Index into current window of HAYSTACK.  */
@@ -227,65 +227,65 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
   if (CMP_FUNC (needle, needle + period, suffix) == 0)
     {
       /* Entire needle is periodic; a mismatch can only advance by the
-        period, so use memory to avoid rescanning known occurrences
-        of the period.  */
+         period, so use memory to avoid rescanning known occurrences
+         of the period.  */
       size_t memory = 0;
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
-       {
-         /* Scan for matches in right half.  */
-         i = MAX (suffix, memory);
-         while (i < needle_len && (CANON_ELEMENT (needle[i])
-                                   == CANON_ELEMENT (haystack[i + j])))
-           ++i;
-         if (needle_len <= i)
-           {
-             /* Scan for matches in left half.  */
-             i = suffix - 1;
-             while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-               --i;
-             if (i + 1 < memory + 1)
-               return (RETURN_TYPE) (haystack + j);
-             /* No match, so remember how many repetitions of period
-                on the right half were scanned.  */
-             j += period;
-             memory = needle_len - period;
-           }
-         else
-           {
-             j += i - suffix + 1;
-             memory = 0;
-           }
-       }
+        {
+          /* Scan for matches in right half.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
     }
   else
     {
       /* The two halves of needle are distinct; no extra memory is
-        required, and any mismatch results in a maximal shift.  */
+         required, and any mismatch results in a maximal shift.  */
       period = MAX (suffix, needle_len - suffix) + 1;
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
-       {
-         /* Scan for matches in right half.  */
-         i = suffix;
-         while (i < needle_len && (CANON_ELEMENT (needle[i])
-                                   == CANON_ELEMENT (haystack[i + j])))
-           ++i;
-         if (needle_len <= i)
-           {
-             /* Scan for matches in left half.  */
-             i = suffix - 1;
-             while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-                                      == CANON_ELEMENT (haystack[i + j])))
-               --i;
-             if (i == SIZE_MAX)
-               return (RETURN_TYPE) (haystack + j);
-             j += period;
-           }
-         else
-           j += i - suffix + 1;
-       }
+        {
+          /* Scan for matches in right half.  */
+          i = suffix;
+          while (i < needle_len && (CANON_ELEMENT (needle[i])
+                                    == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
     }
   return NULL;
 }
@@ -304,7 +304,7 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
    sublinear performance is not possible.  */
 static RETURN_TYPE
 two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
-                    const unsigned char *needle, size_t needle_len)
+                     const unsigned char *needle, size_t needle_len)
 {
   size_t i; /* Index into current byte of NEEDLE.  */
   size_t j; /* Index into current window of HAYSTACK.  */
@@ -331,93 +331,93 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
   if (CMP_FUNC (needle, needle + period, suffix) == 0)
     {
       /* Entire needle is periodic; a mismatch can only advance by the
-        period, so use memory to avoid rescanning known occurrences
-        of the period.  */
+         period, so use memory to avoid rescanning known occurrences
+         of the period.  */
       size_t memory = 0;
       size_t shift;
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
-       {
-         /* Check the last byte first; if it does not match, then
-            shift to the next possible match location.  */
-         shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
-         if (0 < shift)
-           {
-             if (memory && shift < period)
-               {
-                 /* Since needle is periodic, but the last period has
-                    a byte out of place, there can be no match until
-                    after the mismatch.  */
-                 shift = needle_len - period;
-                 memory = 0;
-               }
-             j += shift;
-             continue;
-           }
-         /* Scan for matches in right half.  The last byte has
-            already been matched, by virtue of the shift table.  */
-         i = MAX (suffix, memory);
-         while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-           ++i;
-         if (needle_len - 1 <= i)
-           {
-             /* Scan for matches in left half.  */
-             i = suffix - 1;
-             while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-               --i;
-             if (i + 1 < memory + 1)
-               return (RETURN_TYPE) (haystack + j);
-             /* No match, so remember how many repetitions of period
-                on the right half were scanned.  */
-             j += period;
-             memory = needle_len - period;
-           }
-         else
-           {
-             j += i - suffix + 1;
-             memory = 0;
-           }
-       }
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              if (memory && shift < period)
+                {
+                  /* Since needle is periodic, but the last period has
+                     a byte out of place, there can be no match until
+                     after the mismatch.  */
+                  shift = needle_len - period;
+                  memory = 0;
+                }
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = MAX (suffix, memory);
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (memory < i + 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i + 1 < memory + 1)
+                return (RETURN_TYPE) (haystack + j);
+              /* No match, so remember how many repetitions of period
+                 on the right half were scanned.  */
+              j += period;
+              memory = needle_len - period;
+            }
+          else
+            {
+              j += i - suffix + 1;
+              memory = 0;
+            }
+        }
     }
   else
     {
       /* The two halves of needle are distinct; no extra memory is
-        required, and any mismatch results in a maximal shift.  */
+         required, and any mismatch results in a maximal shift.  */
       size_t shift;
       period = MAX (suffix, needle_len - suffix) + 1;
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
-       {
-         /* Check the last byte first; if it does not match, then
-            shift to the next possible match location.  */
-         shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
-         if (0 < shift)
-           {
-             j += shift;
-             continue;
-           }
-         /* Scan for matches in right half.  The last byte has
-            already been matched, by virtue of the shift table.  */
-         i = suffix;
-         while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-                                       == CANON_ELEMENT (haystack[i + j])))
-           ++i;
-         if (needle_len - 1 <= i)
-           {
-             /* Scan for matches in left half.  */
-             i = suffix - 1;
-             while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-                                      == CANON_ELEMENT (haystack[i + j])))
-               --i;
-             if (i == SIZE_MAX)
-               return (RETURN_TYPE) (haystack + j);
-             j += period;
-           }
-         else
-           j += i - suffix + 1;
-       }
+        {
+          /* Check the last byte first; if it does not match, then
+             shift to the next possible match location.  */
+          shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
+          if (0 < shift)
+            {
+              j += shift;
+              continue;
+            }
+          /* Scan for matches in right half.  The last byte has
+             already been matched, by virtue of the shift table.  */
+          i = suffix;
+          while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
+                                        == CANON_ELEMENT (haystack[i + j])))
+            ++i;
+          if (needle_len - 1 <= i)
+            {
+              /* Scan for matches in left half.  */
+              i = suffix - 1;
+              while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
+                                       == CANON_ELEMENT (haystack[i + j])))
+                --i;
+              if (i == SIZE_MAX)
+                return (RETURN_TYPE) (haystack + j);
+              j += period;
+            }
+          else
+            j += i - suffix + 1;
+        }
     }
   return NULL;
 }
index 065c9e378de031a91e5d2da96fa69ab730be7654..3d9ea4ac1914c6f2da12271cd01367072f897e57 100644 (file)
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison function.
-   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2010 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
@@ -46,7 +46,7 @@ strcasecmp (const char *s1, const char *s2)
       c2 = TOLOWER (*p2);
 
       if (c1 == '\0')
-       break;
+        break;
 
       ++p1;
       ++p2;
index 4b6d47f10d233010703682aa030101d98bc6b84f..4213e1448890e72eb2b72acbc69aa816fb8c5669 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2010 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
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* MirBSD defines mbslen as a macro.  */
+#if @GNULIB_MBSLEN@ && defined __MirBSD__
+# include <wchar.h>
+#endif
+
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
@@ -43,7 +48,9 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #ifdef __cplusplus
@@ -56,14 +63,13 @@ extern "C" {
 # if @REPLACE_MEMCHR@
 #  define memchr rpl_memchr
 extern void *memchr (void const *__s, int __c, size_t __n)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -73,16 +79,16 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 # if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
 extern void *memmem (void const *__haystack, size_t __haystack_len,
-                    void const *__needle, size_t __needle_len)
-  __attribute__ ((__pure__));
+                     void const *__needle, size_t __needle_len)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -90,28 +96,29 @@ extern void *memmem (void const *__haystack, size_t __haystack_len,
 #if @GNULIB_MEMPCPY@
 # if ! @HAVE_MEMPCPY@
 extern void *mempcpy (void *restrict __dest, void const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
 #if @GNULIB_MEMRCHR@
 # if ! @HAVE_DECL_MEMRCHR@
 extern void *memrchr (void const *, int, size_t)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -120,27 +127,28 @@ extern void *memrchr (void const *, int, size_t)
 #if @GNULIB_RAWMEMCHR@
 # if ! @HAVE_RAWMEMCHR@
 extern void *rawmemchr (void const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
 #if @GNULIB_STPCPY@
 # if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+extern char *stpcpy (char *restrict __dst, char const *restrict __src)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -149,39 +157,39 @@ extern char *stpcpy (char *restrict __dst, char const *restrict __src);
 # if ! @HAVE_STPNCPY@
 #  define stpncpy gnu_stpncpy
 extern char *stpncpy (char *restrict __dst, char const *restrict __src,
-                     size_t __n);
+                      size_t __n)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 #if @GNULIB_STRCHRNUL@
 # if ! @HAVE_STRCHRNUL@
 extern char *strchrnul (char const *__s, int __c_in)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -191,14 +199,14 @@ extern char *strchrnul (char const *__s, int __c_in)
 #  define strdup rpl_strdup
 # endif
 # if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
-extern char *strdup (char const *__s);
+extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -208,14 +216,14 @@ extern char *strdup (char const *__s);
 #  define strndup rpl_strndup
 # endif
 # if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n);
+extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -224,14 +232,14 @@ extern char *strndup (char const *__string, size_t __n);
 #if @GNULIB_STRNLEN@
 # if ! @HAVE_DECL_STRNLEN@
 extern size_t strnlen (char const *__string, size_t __maxlen)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -240,18 +248,17 @@ extern size_t strnlen (char const *__string, size_t __maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
 #if @GNULIB_STRPBRK@
 # if ! @HAVE_STRPBRK@
 extern char *strpbrk (char const *__s, char const *__accept)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 /* strpbrk() assumes the second argument is a list of single-byte characters.
@@ -259,40 +266,36 @@ extern char *strpbrk (char const *__s, char const *__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -313,29 +316,28 @@ extern char *strpbrk (char const *__s, char const *__accept)
    See also strtok_r().  */
 #if @GNULIB_STRSEP@
 # if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+extern char *strsep (char **restrict __stringp, char const *restrict __delim)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
 # if @REPLACE_STRSTR@
 #  define strstr rpl_strstr
-char *strstr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+extern char *strstr (const char *haystack, const char *needle)
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strstr() does not work with multibyte strings if the locale encoding is
@@ -343,13 +345,12 @@ char *strstr (const char *haystack, const char *needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -360,31 +361,31 @@ char *strstr (const char *haystack, const char *needle)
 # endif
 # if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
 extern char *strcasestr (const char *haystack, const char *needle)
-  __attribute__ ((__pure__));
+     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strcasestr() does not work with multibyte strings:
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = strtok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    This is a variant of strtok() that is multithread-safe.
 
@@ -402,27 +403,25 @@ extern char *strcasestr (const char *haystack, const char *needle)
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
 extern char *strtok_r (char *restrict s, char const *restrict delim,
-                      char **restrict save_ptr);
+                       char **restrict save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -432,13 +431,19 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
 #if @GNULIB_MBSLEN@
 /* Return the number of multibyte characters in the character string STRING.
    This considers multibyte characters, unlike strlen, which counts bytes.  */
-extern size_t mbslen (const char *string);
+# ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
+#  undef mbslen
+# endif
+# if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
+#  define mbslen rpl_mbslen
+# endif
+extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSNLEN@
 /* Return the number of multibyte characters in the character string starting
    at STRING and ending at STRING + LEN.  */
-extern size_t mbsnlen (const char *string, size_t len);
+extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSCHR@
@@ -447,7 +452,7 @@ extern size_t mbsnlen (const char *string, size_t len);
    Unlike strchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c);
+extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSRCHR@
@@ -456,7 +461,7 @@ extern char * mbschr (const char *string, int c);
    Unlike strrchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
 # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c);
+extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSSTR@
@@ -464,7 +469,8 @@ extern char * mbsrchr (const char *string, int c);
    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
    Unlike strstr(), this function works correctly in multibyte locales with
    encodings different from UTF-8.  */
-extern char * mbsstr (const char *haystack, const char *needle);
+extern char * mbsstr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASECMP@
@@ -474,7 +480,8 @@ extern char * mbsstr (const char *haystack, const char *needle);
    Note: This function may, in multibyte locales, return 0 for strings of
    different lengths!
    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
-extern int mbscasecmp (const char *s1, const char *s2);
+extern int mbscasecmp (const char *s1, const char *s2)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSNCASECMP@
@@ -487,7 +494,8 @@ extern int mbscasecmp (const char *s1, const char *s2);
    of different lengths!
    Unlike strncasecmp(), this function works correctly in multibyte locales.
    But beware that N is not a byte count but a character count!  */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPCASECMP@
@@ -500,7 +508,8 @@ extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
    smaller length than PREFIX!
    Unlike strncasecmp(), this function works correctly in multibyte
    locales.  */
-extern char * mbspcasecmp (const char *string, const char *prefix);
+extern char * mbspcasecmp (const char *string, const char *prefix)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCASESTR@
@@ -509,7 +518,8 @@ extern char * mbspcasecmp (const char *string, const char *prefix);
    Note: This function may, in multibyte locales, return success even if
    strlen (haystack) < strlen (needle) !
    Unlike strcasestr(), this function works correctly in multibyte locales.  */
-extern char * mbscasestr (const char *haystack, const char *needle);
+extern char * mbscasestr (const char *haystack, const char *needle)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSCSPN@
@@ -518,7 +528,8 @@ extern char * mbscasestr (const char *haystack, const char *needle);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strcspn(), this function works correctly in multibyte locales.  */
-extern size_t mbscspn (const char *string, const char *accept);
+extern size_t mbscspn (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSPBRK@
@@ -527,7 +538,8 @@ extern size_t mbscspn (const char *string, const char *accept);
    exists.
    Unlike strpbrk(), this function works correctly in multibyte locales.  */
 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept);
+extern char * mbspbrk (const char *string, const char *accept)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSPN@
@@ -536,7 +548,8 @@ extern char * mbspbrk (const char *string, const char *accept);
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strspn(), this function works correctly in multibyte locales.  */
-extern size_t mbsspn (const char *string, const char *reject);
+extern size_t mbsspn (const char *string, const char *reject)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSSEP@
@@ -554,7 +567,8 @@ extern size_t mbsspn (const char *string, const char *reject);
    Caveat: The identity of the delimiting character is lost.
 
    See also mbstok_r().  */
-extern char * mbssep (char **stringp, const char *delim);
+extern char * mbssep (char **stringp, const char *delim)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 
 #if @GNULIB_MBSTOK_R@
@@ -562,19 +576,20 @@ extern char * mbssep (char **stringp, const char *delim);
    the character string DELIM.
    If STRING is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = mbstok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
+        char s[] = "-abc-=-def";
+        char *sp;
+        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+        x = mbstok_r(NULL, "=", &sp);   // x = NULL
+                // s = "abc\0-def\0"
 
    Caveat: It modifies the original string.
    Caveat: These functions cannot be used on constant strings.
    Caveat: The identity of the delimiting character is lost.
 
    See also mbssep().  */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr)
+     _GL_ARG_NONNULL ((2, 3));
 #endif
 
 /* Map any int, typically from errno, into an error message.  */
@@ -586,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -601,22 +615,22 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
 # if !@HAVE_STRVERSCMP@
-extern int strverscmp (const char *, const char *);
+extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
index 8d9e9f1449e47394f7f4b8b1ac699bd3bf586134..4eff2f04f07cb3878ac2e9f3bc2033e3de25a36b 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute <strings.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -29,8 +29,9 @@
 #define _GL_STRINGS_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,21 +43,22 @@ extern "C" {
    than S2.
    Note: This function does not work in multibyte locales.  */
 #if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2);
+extern int strcasecmp (char const *s1, char const *s2)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 #if defined GNULIB_POSIXCHECK
 /* strcasecmp() does not work with multibyte strings:
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.   */
 # undef strcasecmp
-# define strcasecmp(a,b) \
-    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasecmp if you care about " \
-                      "internationalization, or use c_strcasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strcasecmp (a, b))
+# if HAVE_RAW_DECL_STRCASECMP
+_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasecmp if you care about "
+                 "internationalization, or use c_strcasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
@@ -64,21 +66,22 @@ extern int strcasecmp (char const *s1, char const *s2);
    lexicographically less than, equal to or greater than S2.
    Note: This function cannot work correctly in multibyte locales.  */
 #if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n);
+extern int strncasecmp (char const *s1, char const *s2, size_t n)
+     _GL_ARG_NONNULL ((1, 2));
 #endif
 #if defined GNULIB_POSIXCHECK
 /* strncasecmp() does not work with multibyte strings:
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strncasecmp
-# define strncasecmp(a,b,n) \
-    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - " \
-                      "use mbsncasecmp or mbspcasecmp if you care about " \
-                      "internationalization, or use c_strncasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strncasecmp (a, b, n))
+# if HAVE_RAW_DECL_STRNCASECMP
+_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbsncasecmp or mbspcasecmp if you care about "
+                 "internationalization, or use c_strncasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 
index 5b2af35fd9ddccc454b5526142e639750ba9bd19..788e4234e45d851683cc5d8bf2a01dc3ec1b424c 100644 (file)
@@ -1,5 +1,5 @@
 /* strncasecmp.c -- case insensitive string comparator
-   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2010 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
@@ -46,7 +46,7 @@ strncasecmp (const char *s1, const char *s2, size_t n)
       c2 = TOLOWER (*p2);
 
       if (--n == 0 || c1 == '\0')
-       break;
+        break;
 
       ++p1;
       ++p2;
index 84b4ab8a8897f48fcc05d2007c84928c0764ad59..5757d647f175630ddf83246fea840300f698fba4 100644 (file)
@@ -1,5 +1,6 @@
 /* Compare strings while treating digits characters numerically.
-   Copyright (C) 1997, 2000, 2002, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2010 Free Software
+   Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
 
@@ -117,8 +118,8 @@ __strverscmp (const char *s1, const char *s2)
 
     case LEN:
       while (ISDIGIT (*p1++))
-       if (!ISDIGIT (*p2++))
-         return 1;
+        if (!ISDIGIT (*p2++))
+          return 1;
 
       return ISDIGIT (*p2) ? -1 : diff;
 
index 8e9a7970e7d1506de15e67b2a4ca31d795add1c3..30b0d035220c77a4ef7389a18cd0342b7ef2ab1d 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,8 @@
 #ifndef _GL_SYS_SOCKET_H
 #define _GL_SYS_SOCKET_H
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 #if !@HAVE_SA_FAMILY_T@
 typedef unsigned short  sa_family_t;
 #endif
@@ -54,10 +56,10 @@ typedef unsigned short  sa_family_t;
 # define __ss_aligntype unsigned long int
 # define _SS_SIZE 256
 # define _SS_PADSIZE \
-    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)     \
-                 ? sizeof (sa_family_t)                                \
-                 : alignof (__ss_aligntype))                           \
-                + sizeof (__ss_aligntype)))
+    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)      \
+                  ? sizeof (sa_family_t)                                \
+                  : alignof (__ss_aligntype))                           \
+                 + sizeof (__ss_aligntype)))
 
 struct sockaddr_storage
 {
@@ -124,7 +126,7 @@ struct sockaddr_storage
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
@@ -177,7 +179,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
 # if @GNULIB_SOCKET@
 #  if @HAVE_WINSOCK2_H@
 #   undef socket
-#   define socket              rpl_socket
+#   define socket               rpl_socket
 extern int rpl_socket (int, int, int protocol);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -185,33 +187,33 @@ extern int rpl_socket (int, int, int protocol);
 #  define socket socket_used_without_requesting_gnulib_module_socket
 # elif defined GNULIB_POSIXCHECK
 #  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
+#  if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+#  endif
 # endif
 
 # if @GNULIB_CONNECT@
 #  if @HAVE_WINSOCK2_H@
 #   undef connect
-#   define connect             rpl_connect
-extern int rpl_connect (int, struct sockaddr *, int);
+#   define connect              rpl_connect
+extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef connect
 #  define connect socket_used_without_requesting_gnulib_module_connect
 # elif defined GNULIB_POSIXCHECK
 #  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
+#  if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+#  endif
 # endif
 
 # if @GNULIB_ACCEPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef accept
-#   define accept              rpl_accept
+#   define accept               rpl_accept
 extern int rpl_accept (int, struct sockaddr *, int *);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -219,84 +221,87 @@ extern int rpl_accept (int, struct sockaddr *, int *);
 #  define accept accept_used_without_requesting_gnulib_module_accept
 # elif defined GNULIB_POSIXCHECK
 #  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+#  endif
 # endif
 
 # if @GNULIB_BIND@
 #  if @HAVE_WINSOCK2_H@
 #   undef bind
-#   define bind                        rpl_bind
-extern int rpl_bind (int, struct sockaddr *, int);
+#   define bind                 rpl_bind
+extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef bind
 #  define bind bind_used_without_requesting_gnulib_module_bind
 # elif defined GNULIB_POSIXCHECK
 #  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
+#  if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETPEERNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getpeername
-#   define getpeername         rpl_getpeername
-extern int rpl_getpeername (int, struct sockaddr *, int *);
+#   define getpeername          rpl_getpeername
+extern int rpl_getpeername (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getpeername
 #  define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
 # elif defined GNULIB_POSIXCHECK
 #  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
+#  if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKNAME@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockname
-#   define getsockname         rpl_getsockname
-extern int rpl_getsockname (int, struct sockaddr *, int *);
+#   define getsockname          rpl_getsockname
+extern int rpl_getsockname (int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2, 3));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockname
 #  define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
+#  if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+#  endif
 # endif
 
 # if @GNULIB_GETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockopt
-#   define getsockopt          rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
+#   define getsockopt           rpl_getsockopt
+extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
+     _GL_ARG_NONNULL ((4, 5));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockopt
 #  define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_LISTEN@
 #  if @HAVE_WINSOCK2_H@
 #   undef listen
-#   define listen              rpl_listen
+#   define listen               rpl_listen
 extern int rpl_listen (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -304,101 +309,104 @@ extern int rpl_listen (int, int);
 #  define listen listen_used_without_requesting_gnulib_module_listen
 # elif defined GNULIB_POSIXCHECK
 #  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
+#  if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECV@
 #  if @HAVE_WINSOCK2_H@
 #   undef recv
-#   define recv                        rpl_recv
-extern int rpl_recv (int, void *, int, int);
+#   define recv                 rpl_recv
+extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recv
 #  define recv recv_used_without_requesting_gnulib_module_recv
 # elif defined GNULIB_POSIXCHECK
 #  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
+#  if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+#  endif
 # endif
 
 # if @GNULIB_SEND@
 #  if @HAVE_WINSOCK2_H@
 #   undef send
-#   define send                        rpl_send
-extern int rpl_send (int, const void *, int, int);
+#   define send                 rpl_send
+extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef send
 #  define send send_used_without_requesting_gnulib_module_send
 # elif defined GNULIB_POSIXCHECK
 #  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
+#  if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+#  endif
 # endif
 
 # if @GNULIB_RECVFROM@
 #  if @HAVE_WINSOCK2_H@
 #   undef recvfrom
-#   define recvfrom            rpl_recvfrom
-extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *);
+#   define recvfrom             rpl_recvfrom
+extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef recvfrom
 #  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
 # elif defined GNULIB_POSIXCHECK
 #  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+#  endif
 # endif
 
 # if @GNULIB_SENDTO@
 #  if @HAVE_WINSOCK2_H@
 #   undef sendto
-#   define sendto              rpl_sendto
-extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
+#   define sendto               rpl_sendto
+extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
+     _GL_ARG_NONNULL ((2));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef sendto
 #  define sendto sendto_used_without_requesting_gnulib_module_sendto
 # elif defined GNULIB_POSIXCHECK
 #  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
+#  if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
+#  endif
 # endif
 
 # if @GNULIB_SETSOCKOPT@
 #  if @HAVE_WINSOCK2_H@
 #   undef setsockopt
-#   define setsockopt          rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
+#   define setsockopt           rpl_setsockopt
+extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
+     _GL_ARG_NONNULL ((4));
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef setsockopt
 #  define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
 # elif defined GNULIB_POSIXCHECK
 #  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
+#  if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
+#  endif
 # endif
 
 # if @GNULIB_SHUTDOWN@
 #  if @HAVE_WINSOCK2_H@
 #   undef shutdown
-#   define shutdown            rpl_shutdown
+#   define shutdown             rpl_shutdown
 extern int rpl_shutdown (int, int);
 #  endif
 # elif @HAVE_WINSOCK2_H@
@@ -406,15 +414,15 @@ extern int rpl_shutdown (int, int);
 #  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
 # elif defined GNULIB_POSIXCHECK
 #  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+#  if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
+#  endif
 # endif
 
 # if @HAVE_WINSOCK2_H@
 #  undef select
-#  define select               select_used_without_including_sys_select_h
+#  define select                select_used_without_including_sys_select_h
 # endif
 
 # ifdef __cplusplus
@@ -437,13 +445,13 @@ extern "C" {
 #  define accept4 rpl_accept4
 # endif
 extern int accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
-                   int flags);
+                    int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef accept4
-# define accept4(s,a,l,f) \
-    (GL_LINK_WARNING ("accept4 is unportable - " \
-                      "use gnulib module accept4 for portability"), \
-     accept4 (s, a, l, f))
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
index f95571d6795fe22068944da0f33b77099855d90b..8423f50a0eb6276742051e2c7d4837d8ce36ab96 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 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
@@ -47,7 +47,9 @@
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
@@ -295,20 +297,21 @@ extern "C" {
 
 #if @GNULIB_FCHMODAT@
 # if !@HAVE_FCHMODAT@
-extern int fchmodat (int fd, char const *file, mode_t mode, int flag);
+extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_FSTAT@
 # define fstat rpl_fstat
-extern int fstat (int fd, struct stat *buf);
+extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
 #endif
 
 
@@ -318,14 +321,15 @@ extern int fstat (int fd, struct stat *buf);
 #  define fstatat rpl_fstatat
 # endif
 # if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@
-extern int fstatat (int fd, char const *name, struct stat *st, int flags);
+extern int fstatat (int fd, char const *name, struct stat *st, int flags)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -339,10 +343,10 @@ extern int futimens (int fd, struct timespec const times[2]);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -360,14 +364,14 @@ extern int futimens (int fd, struct timespec const times[2]);
 #  define lchmod chmod
 # endif
 # if 0 /* assume already declared */
-extern int lchmod (const char *filename, mode_t mode);
+extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -379,21 +383,22 @@ extern int lchmod (const char *filename, mode_t mode);
 # elif @REPLACE_LSTAT@
 #  undef lstat
 #  define lstat rpl_lstat
-extern int rpl_lstat (const char *name, struct stat *buf);
+extern int rpl_lstat (const char *name, struct stat *buf)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                    \
-  (GL_LINK_WARNING ("lstat is unportable - "                           \
-                   "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_MKDIR@
 # undef mkdir
 # define mkdir rpl_mkdir
-extern int mkdir (char const *name, mode_t mode);
+extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
 #else
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
@@ -413,14 +418,15 @@ rpl_mkdir (char const *name, mode_t mode)
 
 #if @GNULIB_MKDIRAT@
 # if !@HAVE_MKDIRAT@
-extern int mkdirat (int fd, char const *file, mode_t mode);
+extern int mkdirat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -430,27 +436,28 @@ extern int mkdirat (int fd, char const *file, mode_t mode);
 #  define mkfifo rpl_mkfifo
 # endif
 # if !@HAVE_MKFIFO@ || @REPLACE_MKFIFO@
-int mkfifo (char const *file, mode_t mode);
+extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKFIFOAT@
 # if !@HAVE_MKFIFOAT@
-int mkfifoat (int fd, char const *file, mode_t mode);
+extern int mkfifoat (int fd, char const *file, mode_t mode)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                    \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -460,27 +467,29 @@ int mkfifoat (int fd, char const *file, mode_t mode);
 #  define mknod rpl_mknod
 # endif
 # if !@HAVE_MKNOD@ || @REPLACE_MKNOD@
-int mknod (char const *file, mode_t mode, dev_t dev);
+extern int mknod (char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKNODAT@
 # if !@HAVE_MKNODAT@
-int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
+extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                           \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -499,14 +508,14 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
 #  else /* !_LARGE_FILES */
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
-extern int stat (const char *name, struct stat *buf);
+extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                     \
-  (GL_LINK_WARNING ("stat is unportable - "                            \
-                   "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
@@ -517,14 +526,15 @@ extern int stat (const char *name, struct stat *buf);
 # endif
 # if !@HAVE_UTIMENSAT@ || @REPLACE_UTIMENSAT@
    extern int utimensat (int fd, char const *name,
-                         struct timespec const times[2], int flag);
+                         struct timespec const times[2], int flag)
+        _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
index 58311a3b151f87c54677a40e0085c350d8ec3cf5..e70c294d2d029db00fde90da577e6a279b8526f2 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -14,6 +14,7 @@ AUTOMAKE_OPTIONS = 1.5 foreign
 
 SUBDIRS =
 TESTS =
+XFAIL_TESTS =
 TESTS_ENVIRONMENT =
 noinst_PROGRAMS =
 check_PROGRAMS =
@@ -42,6 +43,8 @@ libtests_a_DEPENDENCIES = $(lgltests_LIBOBJS)
 EXTRA_libtests_a_SOURCES =
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+
 ## begin gnulib module alloca-opt-tests
 
 TESTS += test-alloca-opt
@@ -51,12 +54,35 @@ EXTRA_DIST += test-alloca-opt.c
 
 ## end   gnulib module alloca-opt-tests
 
+## begin gnulib module arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
+arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/GL_ARG_NONNULL/,$$p' \
+         < $(top_srcdir)/build-aux/arg-nonnull.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
+
+## end   gnulib module arg-nonnull
+
 ## begin gnulib module byteswap-tests
 
 TESTS += test-byteswap
 check_PROGRAMS += test-byteswap
-
-EXTRA_DIST += test-byteswap.c
+EXTRA_DIST += test-byteswap.c macros.h
 
 ## end   gnulib module byteswap-tests
 
@@ -65,7 +91,7 @@ EXTRA_DIST += test-byteswap.c
 TESTS += test-c-ctype
 check_PROGRAMS += test-c-ctype
 
-EXTRA_DIST += test-c-ctype.c
+EXTRA_DIST += test-c-ctype.c macros.h
 
 ## end   gnulib module c-ctype-tests
 
@@ -81,9 +107,8 @@ EXTRA_DIST += test-errno.c
 ## begin gnulib module fseeko-tests
 
 TESTS += test-fseeko.sh test-fseeko2.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
 check_PROGRAMS += test-fseeko
-EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh
+EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h
 
 ## end   gnulib module fseeko-tests
 
@@ -91,7 +116,7 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh
 
 TESTS += test-func
 check_PROGRAMS += test-func
-EXTRA_DIST += test-func.c
+EXTRA_DIST += test-func.c macros.h
 
 ## end   gnulib module func-tests
 
@@ -102,19 +127,11 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
-## begin gnulib module link-warning
-
-LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module memchr-tests
 
 TESTS += test-memchr
 check_PROGRAMS += test-memchr
-EXTRA_DIST += test-memchr.c zerosize-ptr.h
+EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h
 
 ## end   gnulib module memchr-tests
 
@@ -122,7 +139,6 @@ EXTRA_DIST += test-memchr.c zerosize-ptr.h
 
 TESTS += test-netdb
 check_PROGRAMS += test-netdb
-
 EXTRA_DIST += test-netdb.c
 
 ## end   gnulib module netdb-tests
@@ -140,7 +156,7 @@ EXTRA_DIST += test-read-file.c
 TESTS += test-snprintf
 check_PROGRAMS += test-snprintf
 
-EXTRA_DIST += test-snprintf.c
+EXTRA_DIST += test-snprintf.c signature.h macros.h
 
 ## end   gnulib module snprintf-tests
 
@@ -157,7 +173,6 @@ EXTRA_DIST += test-sockets.c
 
 TESTS += test-stdbool
 check_PROGRAMS += test-stdbool
-
 EXTRA_DIST += test-stdbool.c
 
 ## end   gnulib module stdbool-tests
@@ -166,7 +181,6 @@ EXTRA_DIST += test-stdbool.c
 
 TESTS += test-stddef
 check_PROGRAMS += test-stddef
-
 EXTRA_DIST += test-stddef.c
 
 ## end   gnulib module stddef-tests
@@ -175,7 +189,6 @@ EXTRA_DIST += test-stddef.c
 
 TESTS += test-stdint
 check_PROGRAMS += test-stdint
-
 EXTRA_DIST += test-stdint.c
 
 ## end   gnulib module stdint-tests
@@ -184,7 +197,6 @@ EXTRA_DIST += test-stdint.c
 
 TESTS += test-stdio
 check_PROGRAMS += test-stdio
-
 EXTRA_DIST += test-stdio.c
 
 ## end   gnulib module stdio-tests
@@ -193,7 +205,6 @@ EXTRA_DIST += test-stdio.c
 
 TESTS += test-stdlib
 check_PROGRAMS += test-stdlib
-
 EXTRA_DIST += test-stdlib.c
 
 ## end   gnulib module stdlib-tests
@@ -202,7 +213,6 @@ EXTRA_DIST += test-stdlib.c
 
 TESTS += test-string
 check_PROGRAMS += test-string
-
 EXTRA_DIST += test-string.c
 
 ## end   gnulib module string-tests
@@ -211,7 +221,6 @@ EXTRA_DIST += test-string.c
 
 TESTS += test-strings
 check_PROGRAMS += test-strings
-
 EXTRA_DIST += test-strings.c
 
 ## end   gnulib module strings-tests
@@ -220,7 +229,7 @@ EXTRA_DIST += test-strings.c
 
 TESTS += test-strverscmp
 check_PROGRAMS += test-strverscmp
-EXTRA_DIST += test-strverscmp.c
+EXTRA_DIST += test-strverscmp.c signature.h macros.h
 
 ## end   gnulib module strverscmp-tests
 
@@ -228,7 +237,6 @@ EXTRA_DIST += test-strverscmp.c
 
 TESTS += test-sys_socket
 check_PROGRAMS += test-sys_socket
-
 EXTRA_DIST += test-sys_socket.c
 
 ## end   gnulib module sys_socket-tests
@@ -237,7 +245,6 @@ EXTRA_DIST += test-sys_socket.c
 
 TESTS += test-sys_stat
 check_PROGRAMS += test-sys_stat
-
 EXTRA_DIST += test-sys_stat.c
 
 ## end   gnulib module sys_stat-tests
@@ -246,7 +253,6 @@ EXTRA_DIST += test-sys_stat.c
 
 TESTS += test-time
 check_PROGRAMS += test-time
-
 EXTRA_DIST += test-time.c
 
 ## end   gnulib module time-tests
@@ -255,7 +261,6 @@ EXTRA_DIST += test-time.c
 
 TESTS += test-unistd
 check_PROGRAMS += test-unistd
-
 EXTRA_DIST += test-unistd.c
 
 ## end   gnulib module unistd-tests
@@ -265,7 +270,7 @@ EXTRA_DIST += test-unistd.c
 TESTS += test-vasnprintf
 check_PROGRAMS += test-vasnprintf
 
-EXTRA_DIST += test-vasnprintf.c
+EXTRA_DIST += test-vasnprintf.c macros.h
 
 ## end   gnulib module vasnprintf-tests
 
@@ -274,7 +279,7 @@ EXTRA_DIST += test-vasnprintf.c
 TESTS += test-vasprintf
 check_PROGRAMS += test-vasprintf
 
-EXTRA_DIST += test-vasprintf.c
+EXTRA_DIST += test-vasprintf.c signature.h macros.h
 
 ## end   gnulib module vasprintf-tests
 
@@ -289,15 +294,33 @@ libtests_a_SOURCES += verify.h
 TESTS += test-vsnprintf
 check_PROGRAMS += test-vsnprintf
 
-EXTRA_DIST += test-vsnprintf.c
+EXTRA_DIST += test-vsnprintf.c signature.h macros.h
 
 ## end   gnulib module vsnprintf-tests
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar-tests
 
 TESTS += test-wchar
 check_PROGRAMS += test-wchar
-
 EXTRA_DIST += test-wchar.c
 
 ## end   gnulib module wchar-tests
index ccb5c26f873bb2f1b41d198cae67547e0b3da030..0f9a277962f2fa79b8b444d303b4acdb49a4dcc9 100644 (file)
@@ -1,5 +1,5 @@
 /* A dummy file, to prevent empty libraries from breaking builds.
-   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2009, 2010 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
index 325c3979972abcf2403b36260d765a4bcbae5df1..46f4d47d709c7018fe5fe2e203e990416bce0f3a 100644 (file)
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    your host.  */
 # define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) 0 \
-       : TYPE_SIGNED_MAGNITUDE (t) \
-       ? ~ (t) 0 \
-       : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+        ? (t) 0 \
+        : TYPE_SIGNED_MAGNITUDE (t) \
+        ? ~ (t) 0 \
+        : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
 # define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-       ? (t) -1 \
-       : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+        ? (t) -1 \
+        : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
 
 /* Return zero if T can be determined to be an unsigned type.
    Otherwise, return 1.
index 68d906d8695b4f7610457580377e0d608cd40cf0..cfbecafcb9a58910e27ef2d4e2a0165edf3b09c1 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of optional automatic memory allocation.
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009, 2010 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
index 78f142d72df26eccb3f272d57b2f83ab1b314c05..0c036052f7380f89dce81fa5a5c726dafcf9d4d9 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <byteswap.h> substitute.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <byteswap.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main ()
index 6d7fe1b7a3566ff63b3426b779c968eac7b93553..ebe594dd4f534ca15e10b5b36a347c01b6021afb 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of character handling in C locale.
-   Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007-2010 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
 #include "c-ctype.h"
 
 #include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static void
 test_all (void)
@@ -46,81 +34,81 @@ test_all (void)
       ASSERT (c_isascii (c) == (c >= 0 && c < 0x80));
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-         ASSERT (c_isalnum (c) == 1);
-         break;
-       default:
-         ASSERT (c_isalnum (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+          ASSERT (c_isalnum (c) == 1);
+          break;
+        default:
+          ASSERT (c_isalnum (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-         ASSERT (c_isalpha (c) == 1);
-         break;
-       default:
-         ASSERT (c_isalpha (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+          ASSERT (c_isalpha (c) == 1);
+          break;
+        default:
+          ASSERT (c_isalpha (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case '\t': case ' ':
-         ASSERT (c_isblank (c) == 1);
-         break;
-       default:
-         ASSERT (c_isblank (c) == 0);
-         break;
-       }
+        {
+        case '\t': case ' ':
+          ASSERT (c_isblank (c) == 1);
+          break;
+        default:
+          ASSERT (c_isblank (c) == 0);
+          break;
+        }
 
       ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f));
 
       switch (c)
-       {
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-         ASSERT (c_isdigit (c) == 1);
-         break;
-       default:
-         ASSERT (c_isdigit (c) == 0);
-         break;
-       }
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+          ASSERT (c_isdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isdigit (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
-       case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
-       case 's': case 't': case 'u': case 'v': case 'w': case 'x':
-       case 'y': case 'z':
-         ASSERT (c_islower (c) == 1);
-         break;
-       default:
-         ASSERT (c_islower (c) == 0);
-         break;
-       }
+        {
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+        case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+        case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+        case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+        case 'y': case 'z':
+          ASSERT (c_islower (c) == 1);
+          break;
+        default:
+          ASSERT (c_islower (c) == 0);
+          break;
+        }
 
       ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' '));
 
@@ -129,257 +117,257 @@ test_all (void)
       ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c)));
 
       switch (c)
-       {
-       case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
-         ASSERT (c_isspace (c) == 1);
-         break;
-       default:
-         ASSERT (c_isspace (c) == 0);
-         break;
-       }
+        {
+        case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
+          ASSERT (c_isspace (c) == 1);
+          break;
+        default:
+          ASSERT (c_isspace (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-       case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-       case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-       case 'Y': case 'Z':
-         ASSERT (c_isupper (c) == 1);
-         break;
-       default:
-         ASSERT (c_isupper (c) == 0);
-         break;
-       }
+        {
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+        case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+        case 'Y': case 'Z':
+          ASSERT (c_isupper (c) == 1);
+          break;
+        default:
+          ASSERT (c_isupper (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9':
-       case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-       case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-         ASSERT (c_isxdigit (c) == 1);
-         break;
-       default:
-         ASSERT (c_isxdigit (c) == 0);
-         break;
-       }
+        {
+        case '0': case '1': case '2': case '3': case '4': case '5':
+        case '6': case '7': case '8': case '9':
+        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+          ASSERT (c_isxdigit (c) == 1);
+          break;
+        default:
+          ASSERT (c_isxdigit (c) == 0);
+          break;
+        }
 
       switch (c)
-       {
-       case 'A':
-         ASSERT (c_tolower (c) == 'a');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'B':
-         ASSERT (c_tolower (c) == 'b');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'C':
-         ASSERT (c_tolower (c) == 'c');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'D':
-         ASSERT (c_tolower (c) == 'd');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'E':
-         ASSERT (c_tolower (c) == 'e');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'F':
-         ASSERT (c_tolower (c) == 'f');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'G':
-         ASSERT (c_tolower (c) == 'g');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'H':
-         ASSERT (c_tolower (c) == 'h');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'I':
-         ASSERT (c_tolower (c) == 'i');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'J':
-         ASSERT (c_tolower (c) == 'j');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'K':
-         ASSERT (c_tolower (c) == 'k');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'L':
-         ASSERT (c_tolower (c) == 'l');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'M':
-         ASSERT (c_tolower (c) == 'm');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'N':
-         ASSERT (c_tolower (c) == 'n');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'O':
-         ASSERT (c_tolower (c) == 'o');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'P':
-         ASSERT (c_tolower (c) == 'p');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Q':
-         ASSERT (c_tolower (c) == 'q');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'R':
-         ASSERT (c_tolower (c) == 'r');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'S':
-         ASSERT (c_tolower (c) == 's');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'T':
-         ASSERT (c_tolower (c) == 't');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'U':
-         ASSERT (c_tolower (c) == 'u');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'V':
-         ASSERT (c_tolower (c) == 'v');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'W':
-         ASSERT (c_tolower (c) == 'w');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'X':
-         ASSERT (c_tolower (c) == 'x');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Y':
-         ASSERT (c_tolower (c) == 'y');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'Z':
-         ASSERT (c_tolower (c) == 'z');
-         ASSERT (c_toupper (c) == c);
-         break;
-       case 'a':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'A');
-         break;
-       case 'b':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'B');
-         break;
-       case 'c':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'C');
-         break;
-       case 'd':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'D');
-         break;
-       case 'e':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'E');
-         break;
-       case 'f':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'F');
-         break;
-       case 'g':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'G');
-         break;
-       case 'h':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'H');
-         break;
-       case 'i':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'I');
-         break;
-       case 'j':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'J');
-         break;
-       case 'k':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'K');
-         break;
-       case 'l':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'L');
-         break;
-       case 'm':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'M');
-         break;
-       case 'n':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'N');
-         break;
-       case 'o':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'O');
-         break;
-       case 'p':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'P');
-         break;
-       case 'q':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Q');
-         break;
-       case 'r':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'R');
-         break;
-       case 's':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'S');
-         break;
-       case 't':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'T');
-         break;
-       case 'u':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'U');
-         break;
-       case 'v':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'V');
-         break;
-       case 'w':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'W');
-         break;
-       case 'x':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'X');
-         break;
-       case 'y':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Y');
-         break;
-       case 'z':
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == 'Z');
-         break;
-       default:
-         ASSERT (c_tolower (c) == c);
-         ASSERT (c_toupper (c) == c);
-         break;
-       }
+        {
+        case 'A':
+          ASSERT (c_tolower (c) == 'a');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'B':
+          ASSERT (c_tolower (c) == 'b');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'C':
+          ASSERT (c_tolower (c) == 'c');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'D':
+          ASSERT (c_tolower (c) == 'd');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'E':
+          ASSERT (c_tolower (c) == 'e');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'F':
+          ASSERT (c_tolower (c) == 'f');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'G':
+          ASSERT (c_tolower (c) == 'g');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'H':
+          ASSERT (c_tolower (c) == 'h');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'I':
+          ASSERT (c_tolower (c) == 'i');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'J':
+          ASSERT (c_tolower (c) == 'j');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'K':
+          ASSERT (c_tolower (c) == 'k');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'L':
+          ASSERT (c_tolower (c) == 'l');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'M':
+          ASSERT (c_tolower (c) == 'm');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'N':
+          ASSERT (c_tolower (c) == 'n');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'O':
+          ASSERT (c_tolower (c) == 'o');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'P':
+          ASSERT (c_tolower (c) == 'p');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Q':
+          ASSERT (c_tolower (c) == 'q');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'R':
+          ASSERT (c_tolower (c) == 'r');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'S':
+          ASSERT (c_tolower (c) == 's');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'T':
+          ASSERT (c_tolower (c) == 't');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'U':
+          ASSERT (c_tolower (c) == 'u');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'V':
+          ASSERT (c_tolower (c) == 'v');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'W':
+          ASSERT (c_tolower (c) == 'w');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'X':
+          ASSERT (c_tolower (c) == 'x');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Y':
+          ASSERT (c_tolower (c) == 'y');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'Z':
+          ASSERT (c_tolower (c) == 'z');
+          ASSERT (c_toupper (c) == c);
+          break;
+        case 'a':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'A');
+          break;
+        case 'b':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'B');
+          break;
+        case 'c':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'C');
+          break;
+        case 'd':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'D');
+          break;
+        case 'e':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'E');
+          break;
+        case 'f':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'F');
+          break;
+        case 'g':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'G');
+          break;
+        case 'h':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'H');
+          break;
+        case 'i':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'I');
+          break;
+        case 'j':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'J');
+          break;
+        case 'k':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'K');
+          break;
+        case 'l':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'L');
+          break;
+        case 'm':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'M');
+          break;
+        case 'n':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'N');
+          break;
+        case 'o':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'O');
+          break;
+        case 'p':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'P');
+          break;
+        case 'q':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Q');
+          break;
+        case 'r':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'R');
+          break;
+        case 's':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'S');
+          break;
+        case 't':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'T');
+          break;
+        case 'u':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'U');
+          break;
+        case 'v':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'V');
+          break;
+        case 'w':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'W');
+          break;
+        case 'x':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'X');
+          break;
+        case 'y':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Y');
+          break;
+        case 'z':
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == 'Z');
+          break;
+        default:
+          ASSERT (c_tolower (c) == c);
+          ASSERT (c_toupper (c) == c);
+          break;
+        }
     }
 }
 
index 4642027dcea4a03b5f9ef2cd94bff031dded437c..129b236fe9c086bcacaf216e89fa10856b896b3a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <errno.h> substitute.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
index 93b0adc3613ea4bb1c7b9a928bb7a41fa860a433..be2a78dce1b702e291637dece49ab522afa36637 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of fseeko() function.
-   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010 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
 
 #include <config.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
 /* None of the files accessed by this test are large, so disable the
    fseek link warning if we are not using the gnulib fseek module.  */
-#if !GNULIB_FSEEK
-# undef fseek
-#endif
+#define _GL_NO_LARGE_FILES
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int));
+
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 #ifndef FUNC_UNGETC_BROKEN
 # define FUNC_UNGETC_BROKEN 0
 #endif
 
 int
-main (int argc, char **argv)
+main (int argc, char **argv _GL_UNUSED)
 {
   /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
      iff argc > 1.  */
index 106a20edceff3fbf16b473a8978cb378b9e56310..476e04dd9ef5647bf950577053b9a33a98e83aff 100644 (file)
@@ -1,5 +1,5 @@
 /* Test whether __func__ is available
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 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
 #include <config.h>
 
 #include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr)                                                        \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-       {                                                                    \
-         fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-         fflush (stderr);                                                   \
-         abort ();                                                          \
-       }                                                                    \
-    }                                                                       \
-  while (0)
+
+#include "macros.h"
 
 int
 main ()
@@ -46,7 +34,7 @@ main ()
 #endif
 
   ASSERT (strcmp (__func__, "main") == 0
-         || strcmp (__func__, "<unknown function>") == 0);
+          || strcmp (__func__, "<unknown function>") == 0);
 
   return 0;
 }
index d5e53e0081b1ae57b85157777840f25a11bad6e5..5d31e76f27afa35376509b31116fcce56a140483 100644 (file)
 
 #include <string.h>
 
-#include <stdio.h>
+#include "signature.h"
+SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t));
+
 #include <stdlib.h>
 
 #include "zerosize-ptr.h"
-
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-       {                                                                    \
-         fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-         fflush (stderr);                                                   \
-         abort ();                                                          \
-       }                                                                    \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 /* Calculating void * + int is not portable, so this wrapper converts
    to char * to make the tests easier to write.  */
@@ -76,7 +67,7 @@ main (void)
     size_t repeat = 10000;
     for (; repeat > 0; repeat--)
       {
-       ASSERT (MEMCHR (input, 'c', n) == input + 2);
+        ASSERT (MEMCHR (input, 'c', n) == input + 2);
       }
   }
 
@@ -85,12 +76,12 @@ main (void)
     int i, j;
     for (i = 0; i < 32; i++)
       {
-       for (j = 0; j < 256; j++)
-         input[i + j] = j;
-       for (j = 0; j < 256; j++)
-         {
-           ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
-         }
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMCHR (input + i, j, 256) == input + i + j);
+          }
       }
   }
 
@@ -102,23 +93,23 @@ main (void)
 
     if (page_boundary != NULL)
       {
-       for (n = 1; n <= 500; n++)
-         {
-           char *mem = page_boundary - n;
-           memset (mem, 'X', n);
-           ASSERT (MEMCHR (mem, 'U', n) == NULL);
-
-           {
-             size_t i;
-
-             for (i = 0; i < n; i++)
-               {
-                 mem[i] = 'U';
-                 ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
-                 mem[i] = 'X';
-               }
-           }
-         }
+        for (n = 1; n <= 500; n++)
+          {
+            char *mem = page_boundary - n;
+            memset (mem, 'X', n);
+            ASSERT (MEMCHR (mem, 'U', n) == NULL);
+
+            {
+              size_t i;
+
+              for (i = 0; i < n; i++)
+                {
+                  mem[i] = 'U';
+                  ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
+                  mem[i] = 'X';
+                }
+            }
+          }
       }
   }
 
index cde9105fdeb4f16aaea86311ea63185cc17b33fb..5f2bcd4e52e1a0879872e937dbd8e19dc1bb23bf 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <netdb.h> substitute.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index 392c4f7eaf3962c14a9254c26b6c43f69c44a854..2509680bae435695f805765d5a6564acca64005e 100644 (file)
@@ -41,25 +41,25 @@ main (void)
 
       if (!out)
         {
-         perror ("Could not read file");
-         err = 1;
-       }
+          perror ("Could not read file");
+          err = 1;
+        }
       else
-       {
-         if (out[len] != '\0')
-           {
-             perror ("BAD: out[len] not zero");
-             err = 1;
-           }
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
 
-         /* Assume FILE1 is a regular file or a symlink to a regular file.  */
-         if (len != statbuf.st_size)
-           {
-             fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
-             err = 1;
-           }
-         free (out);
-       }
+          /* Assume FILE1 is a regular file or a symlink to a regular file.  */
+          if (len != statbuf.st_size)
+            {
+              fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
+              err = 1;
+            }
+          free (out);
+        }
     }
 
   /* We can perform the test only if the file exists and is readable.
@@ -71,26 +71,26 @@ main (void)
 
       if (!out)
         {
-         perror ("Could not read file");
-         err = 1;
-       }
+          perror ("Could not read file");
+          err = 1;
+        }
       else
-       {
-         if (out[len] != '\0')
-           {
-             perror ("BAD: out[len] not zero");
-             err = 1;
-           }
+        {
+          if (out[len] != '\0')
+            {
+              perror ("BAD: out[len] not zero");
+              err = 1;
+            }
 
-         /* /dev/null should always be empty.  Ignore statbuf.st_size, since it
-            is not a regular file.  */
-         if (len != 0)
-           {
-             fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2);
-             err = 1;
-           }
-         free (out);
-       }
+          /* /dev/null should always be empty.  Ignore statbuf.st_size, since it
+             is not a regular file.  */
+          if (len != 0)
+            {
+              fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2);
+              err = 1;
+            }
+          free (out);
+        }
     }
 
   return err;
index 790c999649465907f22fd1f78c0fc2d1e571119c..62a411bf913415c82d57555dfa2801a02a7e4065 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of snprintf() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <stdio.h>
 
-#include <stdlib.h>
+#include "signature.h"
+SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...));
+
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 int
 main (int argc, char *argv[])
@@ -47,25 +39,25 @@ main (int argc, char *argv[])
       memcpy (buf, "DEADBEEF", 8);
       retval = snprintf (buf, size, "%d", 12345);
       if (size < 6)
-       {
+        {
 #if CHECK_SNPRINTF_POSIX
-         ASSERT (retval < 0 || retval >= size);
+          ASSERT (retval < 0 || retval >= size);
 #endif
-         if (size > 0)
-           {
-             ASSERT (memcmp (buf, "12345", size - 1) == 0);
-             ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
-           }
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
 #if !CHECK_SNPRINTF_POSIX
-         if (size > 0)
+          if (size > 0)
 #endif
-           ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
-       }
+            ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+        }
       else
-       {
-         ASSERT (retval == 5);
-         ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
-       }
+        {
+          ASSERT (retval == 5);
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
     }
 
   return 0;
index 30d53217a551cd962a7290262bb019222f068a27..560e0e534d3653dcec4ecaaebbf5ad5921afd3ae 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdbool.h> substitute.
-   Copyright (C) 2002-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009-2010 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
index c0a7515ecca1dfe0732bc7932ac2bed89724d0af..d047e57b6566bbd776555591b809bc332f9676cb 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stddef.h> substitute.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
index 4e9b3621eeb3829d372c7cf8bbdacbb77a2f2249..9cec2e2f808b4af5ab7d1a07b9899972336a3f38 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdint.h> substitute.
-   Copyright (C) 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 2006-2010 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
index 3f2f0677f0c7db62b28579e246d80d552ca36bad..87100576f0769b469e7c5eb4d48709995380eb9a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdio.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2010 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
@@ -29,6 +29,13 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
    per POSIX 2008.  */
 verify (sizeof NULL == sizeof (void *));
 
+/* Check that the types are all defined.  */
+fpos_t t1;
+off_t t2;
+size_t t3;
+ssize_t t4;
+va_list t5;
+
 int
 main (void)
 {
index fad5cf450e58bf42c1651dda278c752944e56a09..4bd8715f3d619615d80421bdb4f201cdc64e202d 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdlib.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 69df747eb675b6d820019029b2394cc6a42a3c6c..019a8174acbcd542226b742385fe864c66abc5be 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <string.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 81e7362fb4d48ba11a9dcede6aced0637c9c8ff4..caba95cd2aafc0bfc15576448d1675b684d043cc 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <strings.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index a98695baa0cc4c4191d8882d68d301583c5aeeba..d7348150e1692914eb0814f6759ebfb245a399bd 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of strverscmp() function.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
 
 #include <string.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "signature.h"
+SIGNATURE_CHECK (strverscmp, int, (const char *, const char *));
+
+#include "macros.h"
 
 int
 main (void)
index 606708dc1a5bdf49f71bb22c82c42313ec87cb9f..badf308b7a1468f25d0cbea48b2ffd9308727c7b 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/socket.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 4a85c9f08b48f08899cf4848981551369b21d641..5f1aacd1cc982ac7ce1dbed4618097676613dd1e 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/stat.h> substitute.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index 4afa3b39881abaef3203ce5950a9583aeeb8a013..8e250bd2d5496cdd272191b3a848fecfb836236a 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <time.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index dd907f4ebe9d4c227de732efcf2aae611df87930..ec02eeefcae397f195e6c1309f96624a102c92e8 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <unistd.h> substitute.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 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
index 2f3f8900d797ba9a80c5d45ee4196991767abe16..e2831420b43f87c1c20b97bcb4d8c14d7843371c 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 #include "vasnprintf.h"
 
 #include <stdarg.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static char *
 my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
@@ -77,10 +66,10 @@ test_vasnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-       ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-       free (result);
+        free (result);
     }
 }
 
@@ -112,10 +101,10 @@ test_asnprintf ()
       ASSERT (strcmp (result, "12345") == 0);
       ASSERT (length == 5);
       if (size < 6)
-       ASSERT (result != buf);
+        ASSERT (result != buf);
       ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
       if (result != buf)
-       free (result);
+        free (result);
     }
 }
 
index 7c4a728b0545c36d24fb47f5362a63c7f65e0298..e5dc3cd3d33d60e616bc05af683334beb9a13039 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of vasprintf() and asprintf() functions.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <stdio.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...));
+SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list));
+
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static int
 my_asprintf (char **result, const char *format, ...)
index 9c1be8d115330dcfa69816d1e8f9b0aefa1c9d0a..1bfa5540f743cad229e2b34a73745a8968363d90 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of vsnprintf() function.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
 
 #include <stdio.h>
 
+#include "signature.h"
+SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list));
+
 #include <stdarg.h>
-#include <stdlib.h>
 #include <string.h>
 
-#define ASSERT(expr) \
-  do                                                                        \
-    {                                                                       \
-      if (!(expr))                                                          \
-        {                                                                   \
-          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
-          fflush (stderr);                                                  \
-          abort ();                                                         \
-        }                                                                   \
-    }                                                                       \
-  while (0)
+#include "macros.h"
 
 static int
 my_snprintf (char *buf, int size, const char *format, ...)
@@ -60,25 +52,25 @@ main (int argc, char *argv[])
       memcpy (buf, "DEADBEEF", 8);
       retval = my_snprintf (buf, size, "%d", 12345);
       if (size < 6)
-       {
+        {
 #if CHECK_VSNPRINTF_POSIX
-         ASSERT (retval < 0 || retval >= size);
+          ASSERT (retval < 0 || retval >= size);
 #endif
-         if (size > 0)
-           {
-             ASSERT (memcmp (buf, "12345", size - 1) == 0);
-             ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
-           }
+          if (size > 0)
+            {
+              ASSERT (memcmp (buf, "12345", size - 1) == 0);
+              ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size);
+            }
 #if !CHECK_VSNPRINTF_POSIX
-         if (size > 0)
+          if (size > 0)
 #endif
-           ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
-       }
+            ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+        }
       else
-       {
-         ASSERT (retval == 5);
-         ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
-       }
+        {
+          ASSERT (retval == 5);
+          ASSERT (memcmp (buf, "12345\0EF", 8) == 0);
+        }
     }
 
   return 0;
index 2e60bb86db298b13e4dd656028ea8460a009fe1a..2a03d6b669d5a367193b721d16656ec975de4ba1 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <wchar.h> substitute.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
index fac53f6fc4ac94e4452f9d1ee63712dd3d04c14f..bcd3f5a09dceebb70a7d97f726297f315dbf60a1 100644 (file)
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 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
 
        #if 4 <= __GNUC__
        # define verify(R) \
-          extern int (* verify_function__ (void)) \
-                     [__builtin_constant_p (R) && (R) ? 1 : -1]
+           extern int (* verify_function__ (void)) \
+                      [__builtin_constant_p (R) && (R) ? 1 : -1]
        #endif
 
    * In C++, any struct definition inside sizeof is invalid.
index a38a2cf4941ab810d59019f69b9458f8d66bcebe..cfab200871d555ae80ec05fef686067498fa314b 100644 (file)
@@ -1,5 +1,5 @@
 /* Return a pointer to a zero-size object in memory.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 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
@@ -57,11 +57,11 @@ zerosize_ptr (void)
     {
       int pagesize = getpagesize ();
       char *two_pages =
-       (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
-                      flags, fd, 0);
+        (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+                       flags, fd, 0);
       if (two_pages != (char *)(-1)
-         && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
-       return two_pages + pagesize;
+          && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+        return two_pages + pagesize;
     }
 #endif
   return NULL;
index 6b218e8f1191b4b5b1d3ae9f8bd36ebb61ed809a..ed8f51b9de91a1546796c78097d49a7740ea9031 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -40,6 +40,8 @@
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -66,13 +68,14 @@ struct timespec
    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
 # if @REPLACE_NANOSLEEP@
 #  define nanosleep rpl_nanosleep
-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
+     _GL_ARG_NONNULL ((1));
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
 # if @REPLACE_MKTIME@
 #  define mktime rpl_mktime
-extern time_t mktime (struct tm *__tp);
+extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -83,10 +86,12 @@ extern time_t mktime (struct tm *__tp);
 #  define localtime_r rpl_localtime_r
 #  undef gmtime_r
 #  define gmtime_r rpl_gmtime_r
-struct tm *localtime_r (time_t const *restrict __timer,
-                       struct tm *restrict __result);
-struct tm *gmtime_r (time_t const *restrict __timer,
-                    struct tm *restrict __result);
+extern struct tm *localtime_r (time_t const *restrict __timer,
+                               struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
+extern struct tm *gmtime_r (time_t const *restrict __timer,
+                            struct tm *restrict __result)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
@@ -95,15 +100,17 @@ struct tm *gmtime_r (time_t const *restrict __timer,
 # if @REPLACE_STRPTIME@
 #  undef strptime
 #  define strptime rpl_strptime
-char *strptime (char const *restrict __buf, char const *restrict __format,
-               struct tm *restrict __tm);
+extern char *strptime (char const *restrict __buf,
+                       char const *restrict __format,
+                       struct tm *restrict __tm)
+     _GL_ARG_NONNULL ((1, 2, 3));
 # endif
 
 /* Convert TM to a time_t value, assuming UTC.  */
 # if @REPLACE_TIMEGM@
 #  undef timegm
 #  define timegm rpl_timegm
-time_t timegm (struct tm *__tm);
+extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
index 7317195e30ba8defd1b937593c0df4da5b0996ce..e5f57a917ab3a4b4a732a094c25ebba587bb92a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2009, 2010 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
index 49883e7e23fe7e016ca29de2e9ccfc3971066d25..b618bc2c9c3856eeb9184c99776ec0f3965626cd 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2010 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
 #include <stddef.h>
 
 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
+    && ! defined __GLIBC__
 # include <stdio.h>
 #endif
 
+/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+# include <fcntl.h>
+#endif
+
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
-#include <stdlib.h>
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdlib.h>
+#endif
 
-#if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@)   \
-     || (@GNULIB_READLINK@ && (!@HAVE_READLINK@ || @REPLACE_READLINK@)) \
-     || (@GNULIB_READLINKAT@ && !@HAVE_READLINKAT@))
+/* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
+#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
+     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# include <io.h>
+#endif
+
+#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+     || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK)
 /* Get ssize_t.  */
 # include <sys/types.h>
 #endif
 
-/* Get getopt(), optarg, optind, opterr, optopt.  */
-#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
+/* Get getopt(), optarg, optind, opterr, optopt.
+   But avoid namespace pollution on glibc systems.  */
+#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
 # include <getopt.h>
 #endif
 
 #  include <winsock2.h>
 #  if !defined _GL_SYS_SOCKET_H
 #   undef socket
-#   define socket              socket_used_without_including_sys_socket_h
+#   define socket               socket_used_without_including_sys_socket_h
 #   undef connect
-#   define connect             connect_used_without_including_sys_socket_h
+#   define connect              connect_used_without_including_sys_socket_h
 #   undef accept
-#   define accept              accept_used_without_including_sys_socket_h
+#   define accept               accept_used_without_including_sys_socket_h
 #   undef bind
-#   define bind                        bind_used_without_including_sys_socket_h
+#   define bind                 bind_used_without_including_sys_socket_h
 #   undef getpeername
-#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   define getpeername          getpeername_used_without_including_sys_socket_h
 #   undef getsockname
-#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   define getsockname          getsockname_used_without_including_sys_socket_h
 #   undef getsockopt
-#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   define getsockopt           getsockopt_used_without_including_sys_socket_h
 #   undef listen
-#   define listen              listen_used_without_including_sys_socket_h
+#   define listen               listen_used_without_including_sys_socket_h
 #   undef recv
-#   define recv                        recv_used_without_including_sys_socket_h
+#   define recv                 recv_used_without_including_sys_socket_h
 #   undef send
-#   define send                        send_used_without_including_sys_socket_h
+#   define send                 send_used_without_including_sys_socket_h
 #   undef recvfrom
-#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   define recvfrom             recvfrom_used_without_including_sys_socket_h
 #   undef sendto
-#   define sendto              sendto_used_without_including_sys_socket_h
+#   define sendto               sendto_used_without_including_sys_socket_h
 #   undef setsockopt
-#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   define setsockopt           setsockopt_used_without_including_sys_socket_h
 #   undef shutdown
-#   define shutdown            shutdown_used_without_including_sys_socket_h
+#   define shutdown             shutdown_used_without_including_sys_socket_h
 #  endif
 #  if !defined _GL_SYS_SELECT_H
 #   undef select
-#   define select              select_used_without_including_sys_select_h
+#   define select               select_used_without_including_sys_select_h
 #  endif
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* OS/2 EMX lacks these macros.  */
@@ -135,15 +157,16 @@ extern "C" {
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-extern int chown (const char *file, uid_t uid, gid_t gid);
+extern int chown (const char *file, uid_t uid, gid_t gid)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -159,10 +182,9 @@ extern int close (int);
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
@@ -186,10 +208,10 @@ extern int dup2 (int oldfd, int newfd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -208,10 +230,10 @@ extern int dup2 (int oldfd, int newfd);
 extern int dup3 (int oldfd, int newfd, int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -227,11 +249,17 @@ extern char **environ;
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef environ
-# define environ \
-    (GL_LINK_WARNING ("environ is unportable - " \
-                      "use gnulib module environ for portability"), \
-     environ)
+# if HAVE_RAW_DECL_ENVIRON
+static inline char ***
+rpl_environ (void)
+{
+  return &environ;
+}
+_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
+                 "use gnulib module environ for portability");
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
 #endif
 
 
@@ -239,27 +267,28 @@ extern char **environ;
 # if !@HAVE_EUIDACCESS@
 /* Like access(), except that it uses the effective user id and group id of
    the current process.  */
-extern int euidaccess (const char *filename, int mode);
+extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FACCESSAT@
 # if !@HAVE_FACCESSAT@
-int faccessat (int fd, char const *file, int mode, int flag);
+extern int faccessat (int fd, char const *file, int mode, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                        \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
@@ -273,7 +302,8 @@ int faccessat (int fd, char const *file, int mode, int flag);
 extern int fchdir (int /*fd*/);
 
 /* Gnulib internal hooks needed to maintain the fchdir metadata.  */
-extern int _gl_register_fd (int fd, const char *filename);
+extern int _gl_register_fd (int fd, const char *filename)
+     _GL_ARG_NONNULL ((2));
 extern void _gl_unregister_fd (int fd);
 extern int _gl_register_dup (int oldfd, int newfd);
 extern const char *_gl_directory_name (int fd);
@@ -281,10 +311,10 @@ extern const char *_gl_directory_name (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
@@ -294,14 +324,15 @@ extern const char *_gl_directory_name (int fd);
 #  define fchownat rpl_fchownat
 # endif
 # if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@
-extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
+extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                       \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -315,10 +346,10 @@ extern int fsync (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -332,17 +363,14 @@ extern int ftruncate (int fd, off_t length);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETCWD@
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-# include <stdlib.h>
 # if @REPLACE_GETCWD@
 /* Get the name of the current working directory, and put it in SIZE bytes
    of BUF.
@@ -359,10 +387,10 @@ extern char * getcwd (char *buf, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -378,14 +406,14 @@ extern char * getcwd (char *buf, size_t size);
    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
    Return 0 if successful, otherwise set errno and return -1.  */
 # if !@HAVE_GETDOMAINNAME@
-extern int getdomainname(char *name, size_t len);
+extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
@@ -397,10 +425,10 @@ extern int getdtablesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
@@ -419,10 +447,10 @@ int getgroups (int n, gid_t *groups);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -439,17 +467,40 @@ int getgroups (int n, gid_t *groups);
 #  define gethostname rpl_gethostname
 # endif
 # if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
-extern int gethostname(char *name, size_t len);
+extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
 # endif
 #elif @UNISTD_H_HAVE_WINSOCK2_H@
 # undef gethostname
 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if !@HAVE_GETLOGIN@
+extern char *getlogin (void);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -462,16 +513,21 @@ extern int gethostname(char *name, size_t len);
    provided (this case is hopefully rare but is left open by the POSIX spec).
 
    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
  */
 # if !@HAVE_DECL_GETLOGIN_R@
-extern int getlogin_r (char *name, size_t size);
+extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -526,10 +582,10 @@ extern int getpagesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -546,20 +602,20 @@ extern void endusershell (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
@@ -574,14 +630,15 @@ extern void endusershell (void);
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-extern int lchown (char const *file, uid_t owner, gid_t group);
+extern int lchown (char const *file, uid_t owner, gid_t group)
+     _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
@@ -594,14 +651,15 @@ extern int lchown (char const *file, uid_t owner, gid_t group);
    See POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/link.html>.  */
 # if !@HAVE_LINK@ || @REPLACE_LINK@
-extern int link (const char *path1, const char *path2);
+extern int link (const char *path1, const char *path2)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
 #if @GNULIB_LINKAT@
@@ -614,14 +672,15 @@ extern int link (const char *path1, const char *path2);
    Return 0 if successful, otherwise -1 and errno set.  */
 # if !@HAVE_LINKAT@ || @REPLACE_LINKAT@
 extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
-                  int flag);
+                   int flag)
+     _GL_ARG_NONNULL ((2, 4));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define link(f1,path1,f2,path2,f)             \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
 #if @GNULIB_LSEEK@
@@ -635,10 +694,10 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -654,13 +713,34 @@ extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
 # if @HAVE_PIPE2@
 #  define pipe2 rpl_pipe2
 # endif
-extern int pipe2 (int fd[2], int flags);
+extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
+#endif
+
+
+#if @GNULIB_PREAD@
+# if @REPLACE_PREAD@
+#  define pread rpl_pread
+# endif
+/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
+   Return the number of bytes placed into BUF if successful, otherwise
+   set errno and return -1.  0 indicates EOF.  See the POSIX:2001
+   specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
+# if !@HAVE_PREAD@ || @REPLACE_PREAD@
+  extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
+       _GL_ARG_NONNULL ((2));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef pread
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
@@ -674,27 +754,29 @@ extern int pipe2 (int fd[2], int flags);
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
 # if !@HAVE_READLINK@ || @REPLACE_READLINK@
-extern ssize_t readlink (const char *file, char *buf, size_t bufsize);
+extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_READLINKAT@
 # if !@HAVE_READLINKAT@
-ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
+extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
+     _GL_ARG_NONNULL ((2, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                        \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -702,31 +784,35 @@ ssize_t readlinkat (int fd, char const *file, char *buf, size_t len);
 # if @REPLACE_RMDIR@
 #  define rmdir rpl_rmdir
 /* Remove the directory DIR.  */
-extern int rmdir (char const *name);
+extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SLEEP@
+# if @REPLACE_SLEEP@
+#  undef sleep
+#  define sleep rpl_sleep
+# endif
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if !@HAVE_SLEEP@
+# if !@HAVE_SLEEP@ || @REPLACE_SLEEP@
 extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
@@ -736,27 +822,29 @@ extern unsigned int sleep (unsigned int n);
 #  define symlink rpl_symlink
 # endif
 # if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
-int symlink (char const *contents, char const *file);
+extern int symlink (char const *contents, char const *file)
+     _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                       \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SYMLINKAT@
 # if !@HAVE_SYMLINKAT@
-int symlinkat (char const *contents, int fd, char const *file);
+extern int symlinkat (char const *contents, int fd, char const *file)
+     _GL_ARG_NONNULL ((1, 3));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                           \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -764,14 +852,14 @@ int symlinkat (char const *contents, int fd, char const *file);
 # if @REPLACE_UNLINK@
 #  undef unlink
 #  define unlink rpl_unlink
-extern int unlink (char const *file);
+extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
@@ -781,14 +869,35 @@ extern int unlink (char const *file);
 #  define unlinkat rpl_unlinkat
 # endif
 # if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
-extern int unlinkat (int fd, char const *file, int flag);
+extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
+#endif
+
+
+#if @GNULIB_USLEEP@
+# if @REPLACE_USLEEP@
+#  undef usleep
+#  define usleep rpl_usleep
+# endif
+# if !@HAVE_USLEEP@ || @REPLACE_USLEEP@
+/* Pause the execution of the current thread for N microseconds.
+   Returns 0 on completion, or -1 on range error.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+extern int usleep (useconds_t n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef usleep
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
@@ -798,7 +907,8 @@ extern int unlinkat (int fd, char const *file, int flag);
    <http://www.opengroup.org/susv3xsh/write.html>.  */
 # undef write
 # define write rpl_write
-extern ssize_t write (int fd, const void *buf, size_t count);
+extern ssize_t write (int fd, const void *buf, size_t count)
+     _GL_ARG_NONNULL ((2));
 #endif
 
 
index 6f1b4660b2f50f01f269790537e0443a5585384b..ae238a87a6b64118f2a7725d86625a32e1e74d9e 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2010 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
 # endif
 #endif
 
-#include <locale.h>    /* localeconv() */
-#include <stdio.h>     /* snprintf(), sprintf() */
-#include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
-#include <string.h>    /* memcpy(), strlen() */
-#include <errno.h>     /* errno */
-#include <limits.h>    /* CHAR_BIT */
-#include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
+#include <locale.h>     /* localeconv() */
+#include <stdio.h>      /* snprintf(), sprintf() */
+#include <stdlib.h>     /* abort(), malloc(), realloc(), free() */
+#include <string.h>     /* memcpy(), strlen() */
+#include <errno.h>      /* errno */
+#include <limits.h>     /* CHAR_BIT */
+#include <float.h>      /* DBL_MAX_EXP, LDBL_MAX_EXP */
 #if HAVE_NL_LANGINFO
 # include <langinfo.h>
 #endif
@@ -261,10 +261,10 @@ decimal_point_char (void)
 {
   const char *point;
   /* Determine it in a multithread-safe way.  We know nl_langinfo is
-     multithread-safe on glibc systems, but is not required to be multithread-
-     safe by POSIX.  sprintf(), however, is multithread-safe.  localeconv()
-     is rarely multithread-safe.  */
-#  if HAVE_NL_LANGINFO && __GLIBC__
+     multithread-safe on glibc systems and MacOS X systems, but is not required
+     to be multithread-safe by POSIX.  sprintf(), however, is multithread-safe.
+     localeconv() is rarely multithread-safe.  */
+#  if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__))
   point = nl_langinfo (RADIXCHAR);
 #  elif 1
   char pointbuf[5];
@@ -364,26 +364,26 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
       dlen = len1 + len2;
       dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
       if (dp == NULL)
-       return NULL;
+        return NULL;
       for (k = len2; k > 0; )
-       dp[--k] = 0;
+        dp[--k] = 0;
       for (i = 0; i < len1; i++)
-       {
-         mp_limb_t digit1 = p1[i];
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < len2; j++)
-           {
-             mp_limb_t digit2 = p2[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             carry += dp[i + j];
-             dp[i + j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         dp[i + len2] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = p1[i];
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < len2; j++)
+            {
+              mp_limb_t digit2 = p2[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              carry += dp[i + j];
+              dp[i + j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          dp[i + len2] = (mp_limb_t) carry;
+        }
       /* Normalise.  */
       while (dlen > 0 && dp[dlen - 1] == 0)
-       dlen--;
+        dlen--;
       dest->nlimbs = dlen;
       dest->limbs = dp;
     }
@@ -477,12 +477,12 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   for (;;)
     {
       if (b_len == 0)
-       /* Division by zero.  */
-       abort ();
+        /* Division by zero.  */
+        abort ();
       if (b_ptr[b_len - 1] == 0)
-       b_len--;
+        b_len--;
       else
-       break;
+        break;
     }
 
   /* Here m = a_len >= 0 and n = b_len > 0.  */
@@ -499,261 +499,261 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
   else if (b_len == 1)
     {
       /* n=1: single precision division.
-        beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
+         beta^(m-1) <= a < beta^m  ==>  beta^(m-2) <= a/b < beta^m  */
       r_ptr = roomptr;
       q_ptr = roomptr + 1;
       {
-       mp_limb_t den = b_ptr[0];
-       mp_limb_t remainder = 0;
-       const mp_limb_t *sourceptr = a_ptr + a_len;
-       mp_limb_t *destptr = q_ptr + a_len;
-       size_t count;
-       for (count = a_len; count > 0; count--)
-         {
-           mp_twolimb_t num =
-             ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
-           *--destptr = num / den;
-           remainder = num % den;
-         }
-       /* Normalise and store r.  */
-       if (remainder > 0)
-         {
-           r_ptr[0] = remainder;
-           r_len = 1;
-         }
-       else
-         r_len = 0;
-       /* Normalise q.  */
-       q_len = a_len;
-       if (q_ptr[q_len - 1] == 0)
-         q_len--;
+        mp_limb_t den = b_ptr[0];
+        mp_limb_t remainder = 0;
+        const mp_limb_t *sourceptr = a_ptr + a_len;
+        mp_limb_t *destptr = q_ptr + a_len;
+        size_t count;
+        for (count = a_len; count > 0; count--)
+          {
+            mp_twolimb_t num =
+              ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
+            *--destptr = num / den;
+            remainder = num % den;
+          }
+        /* Normalise and store r.  */
+        if (remainder > 0)
+          {
+            r_ptr[0] = remainder;
+            r_len = 1;
+          }
+        else
+          r_len = 0;
+        /* Normalise q.  */
+        q_len = a_len;
+        if (q_ptr[q_len - 1] == 0)
+          q_len--;
       }
     }
   else
     {
       /* n>1: multiple precision division.
-        beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
-        beta^(m-n-1) <= a/b < beta^(m-n+1).  */
+         beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n  ==>
+         beta^(m-n-1) <= a/b < beta^(m-n+1).  */
       /* Determine s.  */
       size_t s;
       {
-       mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
-       s = 31;
-       if (msd >= 0x10000)
-         {
-           msd = msd >> 16;
-           s -= 16;
-         }
-       if (msd >= 0x100)
-         {
-           msd = msd >> 8;
-           s -= 8;
-         }
-       if (msd >= 0x10)
-         {
-           msd = msd >> 4;
-           s -= 4;
-         }
-       if (msd >= 0x4)
-         {
-           msd = msd >> 2;
-           s -= 2;
-         }
-       if (msd >= 0x2)
-         {
-           msd = msd >> 1;
-           s -= 1;
-         }
+        mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
+        s = 31;
+        if (msd >= 0x10000)
+          {
+            msd = msd >> 16;
+            s -= 16;
+          }
+        if (msd >= 0x100)
+          {
+            msd = msd >> 8;
+            s -= 8;
+          }
+        if (msd >= 0x10)
+          {
+            msd = msd >> 4;
+            s -= 4;
+          }
+        if (msd >= 0x4)
+          {
+            msd = msd >> 2;
+            s -= 2;
+          }
+        if (msd >= 0x2)
+          {
+            msd = msd >> 1;
+            s -= 1;
+          }
       }
       /* 0 <= s < GMP_LIMB_BITS.
-        Copy b, shifting it left by s bits.  */
+         Copy b, shifting it left by s bits.  */
       if (s > 0)
-       {
-         tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
-         if (tmp_roomptr == NULL)
-           {
-             free (roomptr);
-             return NULL;
-           }
-         {
-           const mp_limb_t *sourceptr = b_ptr;
-           mp_limb_t *destptr = tmp_roomptr;
-           mp_twolimb_t accu = 0;
-           size_t count;
-           for (count = b_len; count > 0; count--)
-             {
-               accu += (mp_twolimb_t) *sourceptr++ << s;
-               *destptr++ = (mp_limb_t) accu;
-               accu = accu >> GMP_LIMB_BITS;
-             }
-           /* accu must be zero, since that was how s was determined.  */
-           if (accu != 0)
-             abort ();
-         }
-         b_ptr = tmp_roomptr;
-       }
+        {
+          tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t));
+          if (tmp_roomptr == NULL)
+            {
+              free (roomptr);
+              return NULL;
+            }
+          {
+            const mp_limb_t *sourceptr = b_ptr;
+            mp_limb_t *destptr = tmp_roomptr;
+            mp_twolimb_t accu = 0;
+            size_t count;
+            for (count = b_len; count > 0; count--)
+              {
+                accu += (mp_twolimb_t) *sourceptr++ << s;
+                *destptr++ = (mp_limb_t) accu;
+                accu = accu >> GMP_LIMB_BITS;
+              }
+            /* accu must be zero, since that was how s was determined.  */
+            if (accu != 0)
+              abort ();
+          }
+          b_ptr = tmp_roomptr;
+        }
       /* Copy a, shifting it left by s bits, yields r.
-        Memory layout:
-        At the beginning: r = roomptr[0..a_len],
-        at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
+         Memory layout:
+         At the beginning: r = roomptr[0..a_len],
+         at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len]  */
       r_ptr = roomptr;
       if (s == 0)
-       {
-         memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
-         r_ptr[a_len] = 0;
-       }
+        {
+          memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t));
+          r_ptr[a_len] = 0;
+        }
       else
-       {
-         const mp_limb_t *sourceptr = a_ptr;
-         mp_limb_t *destptr = r_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *sourceptr++ << s;
-             *destptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         *destptr++ = (mp_limb_t) accu;
-       }
+        {
+          const mp_limb_t *sourceptr = a_ptr;
+          mp_limb_t *destptr = r_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *sourceptr++ << s;
+              *destptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          *destptr++ = (mp_limb_t) accu;
+        }
       q_ptr = roomptr + b_len;
       q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */
       {
-       size_t j = a_len - b_len; /* m-n */
-       mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
-       mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
-       mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
-         ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
-       /* Division loop, traversed m-n+1 times.
-          j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
-       for (;;)
-         {
-           mp_limb_t q_star;
-           mp_limb_t c1;
-           if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
-             {
-               /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
-               mp_twolimb_t num =
-                 ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
-                 | r_ptr[j + b_len - 1];
-               q_star = num / b_msd;
-               c1 = num % b_msd;
-             }
-           else
-             {
-               /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
-               q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
-               /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
-                  <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
-                  <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
-                       {<= beta !}.
-                  If yes, jump directly to the subtraction loop.
-                  (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
-                   <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
-               if (r_ptr[j + b_len] > b_msd
-                   || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
-                 /* r[j+n] >= b[n-1]+1 or
-                    r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
-                    carry.  */
-                 goto subtract;
-             }
-           /* q_star = q*,
-              c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
-           {
-             mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
-               ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
-             mp_twolimb_t c3 = /* b[n-2] * q* */
-               (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
-             /* While c2 < c3, increase c2 and decrease c3.
-                Consider c3-c2.  While it is > 0, decrease it by
-                b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
-                this can happen only twice.  */
-             if (c3 > c2)
-               {
-                 q_star = q_star - 1; /* q* := q* - 1 */
-                 if (c3 - c2 > b_msdd)
-                   q_star = q_star - 1; /* q* := q* - 1 */
-               }
-           }
-           if (q_star > 0)
-             subtract:
-             {
-               /* Subtract r := r - b * q* * beta^j.  */
-               mp_limb_t cr;
-               {
-                 const mp_limb_t *sourceptr = b_ptr;
-                 mp_limb_t *destptr = r_ptr + j;
-                 mp_twolimb_t carry = 0;
-                 size_t count;
-                 for (count = b_len; count > 0; count--)
-                   {
-                     /* Here 0 <= carry <= q*.  */
-                     carry =
-                       carry
-                       + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
-                       + (mp_limb_t) ~(*destptr);
-                     /* Here 0 <= carry <= beta*q* + beta-1.  */
-                     *destptr++ = ~(mp_limb_t) carry;
-                     carry = carry >> GMP_LIMB_BITS; /* <= q* */
-                   }
-                 cr = (mp_limb_t) carry;
-               }
-               /* Subtract cr from r_ptr[j + b_len], then forget about
-                  r_ptr[j + b_len].  */
-               if (cr > r_ptr[j + b_len])
-                 {
-                   /* Subtraction gave a carry.  */
-                   q_star = q_star - 1; /* q* := q* - 1 */
-                   /* Add b back.  */
-                   {
-                     const mp_limb_t *sourceptr = b_ptr;
-                     mp_limb_t *destptr = r_ptr + j;
-                     mp_limb_t carry = 0;
-                     size_t count;
-                     for (count = b_len; count > 0; count--)
-                       {
-                         mp_limb_t source1 = *sourceptr++;
-                         mp_limb_t source2 = *destptr;
-                         *destptr++ = source1 + source2 + carry;
-                         carry =
-                           (carry
-                            ? source1 >= (mp_limb_t) ~source2
-                            : source1 > (mp_limb_t) ~source2);
-                       }
-                   }
-                   /* Forget about the carry and about r[j+n].  */
-                 }
-             }
-           /* q* is determined.  Store it as q[j].  */
-           q_ptr[j] = q_star;
-           if (j == 0)
-             break;
-           j--;
-         }
+        size_t j = a_len - b_len; /* m-n */
+        mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */
+        mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */
+        mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */
+          ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd;
+        /* Division loop, traversed m-n+1 times.
+           j counts down, b is unchanged, beta/2 <= b[n-1] < beta.  */
+        for (;;)
+          {
+            mp_limb_t q_star;
+            mp_limb_t c1;
+            if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */
+              {
+                /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow.  */
+                mp_twolimb_t num =
+                  ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS)
+                  | r_ptr[j + b_len - 1];
+                q_star = num / b_msd;
+                c1 = num % b_msd;
+              }
+            else
+              {
+                /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1].  */
+                q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */
+                /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta
+                   <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta
+                   <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta)
+                        {<= beta !}.
+                   If yes, jump directly to the subtraction loop.
+                   (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta
+                    <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */
+                if (r_ptr[j + b_len] > b_msd
+                    || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd)
+                  /* r[j+n] >= b[n-1]+1 or
+                     r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a
+                     carry.  */
+                  goto subtract;
+              }
+            /* q_star = q*,
+               c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, <beta).  */
+            {
+              mp_twolimb_t c2 = /* c1*beta+r[j+n-2] */
+                ((mp_twolimb_t) c1 << GMP_LIMB_BITS) | r_ptr[j + b_len - 2];
+              mp_twolimb_t c3 = /* b[n-2] * q* */
+                (mp_twolimb_t) b_2msd * (mp_twolimb_t) q_star;
+              /* While c2 < c3, increase c2 and decrease c3.
+                 Consider c3-c2.  While it is > 0, decrease it by
+                 b[n-1]*beta+b[n-2].  Because of b[n-1]*beta+b[n-2] >= beta^2/2
+                 this can happen only twice.  */
+              if (c3 > c2)
+                {
+                  q_star = q_star - 1; /* q* := q* - 1 */
+                  if (c3 - c2 > b_msdd)
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                }
+            }
+            if (q_star > 0)
+              subtract:
+              {
+                /* Subtract r := r - b * q* * beta^j.  */
+                mp_limb_t cr;
+                {
+                  const mp_limb_t *sourceptr = b_ptr;
+                  mp_limb_t *destptr = r_ptr + j;
+                  mp_twolimb_t carry = 0;
+                  size_t count;
+                  for (count = b_len; count > 0; count--)
+                    {
+                      /* Here 0 <= carry <= q*.  */
+                      carry =
+                        carry
+                        + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++
+                        + (mp_limb_t) ~(*destptr);
+                      /* Here 0 <= carry <= beta*q* + beta-1.  */
+                      *destptr++ = ~(mp_limb_t) carry;
+                      carry = carry >> GMP_LIMB_BITS; /* <= q* */
+                    }
+                  cr = (mp_limb_t) carry;
+                }
+                /* Subtract cr from r_ptr[j + b_len], then forget about
+                   r_ptr[j + b_len].  */
+                if (cr > r_ptr[j + b_len])
+                  {
+                    /* Subtraction gave a carry.  */
+                    q_star = q_star - 1; /* q* := q* - 1 */
+                    /* Add b back.  */
+                    {
+                      const mp_limb_t *sourceptr = b_ptr;
+                      mp_limb_t *destptr = r_ptr + j;
+                      mp_limb_t carry = 0;
+                      size_t count;
+                      for (count = b_len; count > 0; count--)
+                        {
+                          mp_limb_t source1 = *sourceptr++;
+                          mp_limb_t source2 = *destptr;
+                          *destptr++ = source1 + source2 + carry;
+                          carry =
+                            (carry
+                             ? source1 >= (mp_limb_t) ~source2
+                             : source1 > (mp_limb_t) ~source2);
+                        }
+                    }
+                    /* Forget about the carry and about r[j+n].  */
+                  }
+              }
+            /* q* is determined.  Store it as q[j].  */
+            q_ptr[j] = q_star;
+            if (j == 0)
+              break;
+            j--;
+          }
       }
       r_len = b_len;
       /* Normalise q.  */
       if (q_ptr[q_len - 1] == 0)
-       q_len--;
+        q_len--;
 # if 0 /* Not needed here, since we need r only to compare it with b/2, and
-         b is shifted left by s bits.  */
+          b is shifted left by s bits.  */
       /* Shift r right by s bits.  */
       if (s > 0)
-       {
-         mp_limb_t ptr = r_ptr + r_len;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = r_len; count > 0; count--)
-           {
-             accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
-             accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
-             *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
-           }
-       }
+        {
+          mp_limb_t ptr = r_ptr + r_len;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = r_len; count > 0; count--)
+            {
+              accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
+              accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
+              *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS);
+            }
+        }
 # endif
       /* Normalise r.  */
       while (r_len > 0 && r_ptr[r_len - 1] == 0)
-       r_len--;
+        r_len--;
     }
   /* Compare r << 1 with b.  */
   if (r_len > b_len)
@@ -762,17 +762,17 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     size_t i;
     for (i = b_len;;)
       {
-       mp_limb_t r_i =
-         (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
-         | (i < r_len ? r_ptr[i] << 1 : 0);
-       mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
-       if (r_i > b_i)
-         goto increment_q;
-       if (r_i < b_i)
-         goto keep_q;
-       if (i == 0)
-         break;
-       i--;
+        mp_limb_t r_i =
+          (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
+          | (i < r_len ? r_ptr[i] << 1 : 0);
+        mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
+        if (r_i > b_i)
+          goto increment_q;
+        if (r_i < b_i)
+          goto keep_q;
+        if (i == 0)
+          break;
+        i--;
       }
   }
   if (q_len > 0 && ((q_ptr[0] & 1) != 0))
@@ -781,8 +781,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
     {
       size_t i;
       for (i = 0; i < q_len; i++)
-       if (++(q_ptr[i]) != 0)
-         goto keep_q;
+        if (++(q_ptr[i]) != 0)
+          goto keep_q;
       q_ptr[q_len++] = 1;
     }
   keep_q:
@@ -811,36 +811,36 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
     {
       char *d_ptr = c_ptr;
       for (; extra_zeroes > 0; extra_zeroes--)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       while (a_len > 0)
-       {
-         /* Divide a by 10^9, in-place.  */
-         mp_limb_t remainder = 0;
-         mp_limb_t *ptr = a_ptr + a_len;
-         size_t count;
-         for (count = a_len; count > 0; count--)
-           {
-             mp_twolimb_t num =
-               ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
-             *ptr = num / 1000000000;
-             remainder = num % 1000000000;
-           }
-         /* Store the remainder as 9 decimal digits.  */
-         for (count = 9; count > 0; count--)
-           {
-             *d_ptr++ = '0' + (remainder % 10);
-             remainder = remainder / 10;
-           }
-         /* Normalize a.  */
-         if (a_ptr[a_len - 1] == 0)
-           a_len--;
-       }
+        {
+          /* Divide a by 10^9, in-place.  */
+          mp_limb_t remainder = 0;
+          mp_limb_t *ptr = a_ptr + a_len;
+          size_t count;
+          for (count = a_len; count > 0; count--)
+            {
+              mp_twolimb_t num =
+                ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
+              *ptr = num / 1000000000;
+              remainder = num % 1000000000;
+            }
+          /* Store the remainder as 9 decimal digits.  */
+          for (count = 9; count > 0; count--)
+            {
+              *d_ptr++ = '0' + (remainder % 10);
+              remainder = remainder / 10;
+            }
+          /* Normalize a.  */
+          if (a_ptr[a_len - 1] == 0)
+            a_len--;
+        }
       /* Remove leading zeroes.  */
       while (d_ptr > c_ptr && d_ptr[-1] == '0')
-       d_ptr--;
+        d_ptr--;
       /* But keep at least one zero.  */
       if (d_ptr == c_ptr)
-       *d_ptr++ = '0';
+        *d_ptr++ = '0';
       /* Terminate the string.  */
       *d_ptr = '\0';
     }
@@ -885,12 +885,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #   else
@@ -900,7 +900,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -912,12 +912,12 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0L && y < 1.0L))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
@@ -973,12 +973,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
 #   else
@@ -988,7 +988,7 @@ decode_double (double x, int *ep, mpn_t *mp)
       d = (int) y;
       y -= d;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
 #   endif
@@ -1000,12 +1000,12 @@ decode_double (double x, int *ep, mpn_t *mp)
       hi = (int) y;
       y -= hi;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
       lo = (int) y;
       y -= lo;
       if (!(y >= 0.0 && y < 1.0))
-       abort ();
+        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
   if (!(y == 0.0))
@@ -1063,8 +1063,8 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
   abs_n = (n >= 0 ? n : -n);
   abs_s = (s >= 0 ? s : -s);
   pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
-                                   + abs_s / GMP_LIMB_BITS + 1)
-                                  * sizeof (mp_limb_t));
+                                    + abs_s / GMP_LIMB_BITS + 1)
+                                   * sizeof (mp_limb_t));
   if (pow5_ptr == NULL)
     {
       free (memory);
@@ -1077,26 +1077,26 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
   if (abs_n > 0)
     {
       static mp_limb_t const small_pow5[13 + 1] =
-       {
-         1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
-         48828125, 244140625, 1220703125
-       };
+        {
+          1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
+          48828125, 244140625, 1220703125
+        };
       unsigned int n13;
       for (n13 = 0; n13 <= abs_n; n13 += 13)
-       {
-         mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
-         size_t j;
-         mp_twolimb_t carry = 0;
-         for (j = 0; j < pow5_len; j++)
-           {
-             mp_limb_t digit2 = pow5_ptr[j];
-             carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
-             pow5_ptr[j] = (mp_limb_t) carry;
-             carry = carry >> GMP_LIMB_BITS;
-           }
-         if (carry > 0)
-           pow5_ptr[pow5_len++] = (mp_limb_t) carry;
-       }
+        {
+          mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
+          size_t j;
+          mp_twolimb_t carry = 0;
+          for (j = 0; j < pow5_len; j++)
+            {
+              mp_limb_t digit2 = pow5_ptr[j];
+              carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
+              pow5_ptr[j] = (mp_limb_t) carry;
+              carry = carry >> GMP_LIMB_BITS;
+            }
+          if (carry > 0)
+            pow5_ptr[pow5_len++] = (mp_limb_t) carry;
+        }
     }
   s_limbs = abs_s / GMP_LIMB_BITS;
   s_bits = abs_s % GMP_LIMB_BITS;
@@ -1104,129 +1104,129 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
     {
       /* Multiply with 2^|s|.  */
       if (s_bits > 0)
-       {
-         mp_limb_t *ptr = pow5_ptr;
-         mp_twolimb_t accu = 0;
-         size_t count;
-         for (count = pow5_len; count > 0; count--)
-           {
-             accu += (mp_twolimb_t) *ptr << s_bits;
-             *ptr++ = (mp_limb_t) accu;
-             accu = accu >> GMP_LIMB_BITS;
-           }
-         if (accu > 0)
-           {
-             *ptr = (mp_limb_t) accu;
-             pow5_len++;
-           }
-       }
+        {
+          mp_limb_t *ptr = pow5_ptr;
+          mp_twolimb_t accu = 0;
+          size_t count;
+          for (count = pow5_len; count > 0; count--)
+            {
+              accu += (mp_twolimb_t) *ptr << s_bits;
+              *ptr++ = (mp_limb_t) accu;
+              accu = accu >> GMP_LIMB_BITS;
+            }
+          if (accu > 0)
+            {
+              *ptr = (mp_limb_t) accu;
+              pow5_len++;
+            }
+        }
       if (s_limbs > 0)
-       {
-         size_t count;
-         for (count = pow5_len; count > 0;)
-           {
-             count--;
-             pow5_ptr[s_limbs + count] = pow5_ptr[count];
-           }
-         for (count = s_limbs; count > 0;)
-           {
-             count--;
-             pow5_ptr[count] = 0;
-           }
-         pow5_len += s_limbs;
-       }
+        {
+          size_t count;
+          for (count = pow5_len; count > 0;)
+            {
+              count--;
+              pow5_ptr[s_limbs + count] = pow5_ptr[count];
+            }
+          for (count = s_limbs; count > 0;)
+            {
+              count--;
+              pow5_ptr[count] = 0;
+            }
+          pow5_len += s_limbs;
+        }
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* Multiply m with pow5.  No division needed.  */
-         z_memory = multiply (m, pow5, &z);
-       }
+        {
+          /* Multiply m with pow5.  No division needed.  */
+          z_memory = multiply (m, pow5, &z);
+        }
       else
-       {
-         /* Divide m by pow5 and round.  */
-         z_memory = divide (m, pow5, &z);
-       }
+        {
+          /* Divide m by pow5 and round.  */
+          z_memory = divide (m, pow5, &z);
+        }
     }
   else
     {
       pow5.limbs = pow5_ptr;
       pow5.nlimbs = pow5_len;
       if (n >= 0)
-       {
-         /* n >= 0, s < 0.
-            Multiply m with pow5, then divide by 2^|s|.  */
-         mpn_t numerator;
-         mpn_t denominator;
-         void *tmp_memory;
-         tmp_memory = multiply (m, pow5, &numerator);
-         if (tmp_memory == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         /* Construct 2^|s|.  */
-         {
-           mp_limb_t *ptr = pow5_ptr + pow5_len;
-           size_t i;
-           for (i = 0; i < s_limbs; i++)
-             ptr[i] = 0;
-           ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
-           denominator.limbs = ptr;
-           denominator.nlimbs = s_limbs + 1;
-         }
-         z_memory = divide (numerator, denominator, &z);
-         free (tmp_memory);
-       }
+        {
+          /* n >= 0, s < 0.
+             Multiply m with pow5, then divide by 2^|s|.  */
+          mpn_t numerator;
+          mpn_t denominator;
+          void *tmp_memory;
+          tmp_memory = multiply (m, pow5, &numerator);
+          if (tmp_memory == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          /* Construct 2^|s|.  */
+          {
+            mp_limb_t *ptr = pow5_ptr + pow5_len;
+            size_t i;
+            for (i = 0; i < s_limbs; i++)
+              ptr[i] = 0;
+            ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
+            denominator.limbs = ptr;
+            denominator.nlimbs = s_limbs + 1;
+          }
+          z_memory = divide (numerator, denominator, &z);
+          free (tmp_memory);
+        }
       else
-       {
-         /* n < 0, s > 0.
-            Multiply m with 2^s, then divide by pow5.  */
-         mpn_t numerator;
-         mp_limb_t *num_ptr;
-         num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
-                                         * sizeof (mp_limb_t));
-         if (num_ptr == NULL)
-           {
-             free (pow5_ptr);
-             free (memory);
-             return NULL;
-           }
-         {
-           mp_limb_t *destptr = num_ptr;
-           {
-             size_t i;
-             for (i = 0; i < s_limbs; i++)
-               *destptr++ = 0;
-           }
-           if (s_bits > 0)
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               mp_twolimb_t accu = 0;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 {
-                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
-                   *destptr++ = (mp_limb_t) accu;
-                   accu = accu >> GMP_LIMB_BITS;
-                 }
-               if (accu > 0)
-                 *destptr++ = (mp_limb_t) accu;
-             }
-           else
-             {
-               const mp_limb_t *sourceptr = m.limbs;
-               size_t count;
-               for (count = m.nlimbs; count > 0; count--)
-                 *destptr++ = *sourceptr++;
-             }
-           numerator.limbs = num_ptr;
-           numerator.nlimbs = destptr - num_ptr;
-         }
-         z_memory = divide (numerator, pow5, &z);
-         free (num_ptr);
-       }
+        {
+          /* n < 0, s > 0.
+             Multiply m with 2^s, then divide by pow5.  */
+          mpn_t numerator;
+          mp_limb_t *num_ptr;
+          num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1)
+                                          * sizeof (mp_limb_t));
+          if (num_ptr == NULL)
+            {
+              free (pow5_ptr);
+              free (memory);
+              return NULL;
+            }
+          {
+            mp_limb_t *destptr = num_ptr;
+            {
+              size_t i;
+              for (i = 0; i < s_limbs; i++)
+                *destptr++ = 0;
+            }
+            if (s_bits > 0)
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                mp_twolimb_t accu = 0;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  {
+                    accu += (mp_twolimb_t) *sourceptr++ << s_bits;
+                    *destptr++ = (mp_limb_t) accu;
+                    accu = accu >> GMP_LIMB_BITS;
+                  }
+                if (accu > 0)
+                  *destptr++ = (mp_limb_t) accu;
+              }
+            else
+              {
+                const mp_limb_t *sourceptr = m.limbs;
+                size_t count;
+                for (count = m.nlimbs; count > 0; count--)
+                  *destptr++ = *sourceptr++;
+              }
+            numerator.limbs = num_ptr;
+            numerator.nlimbs = destptr - num_ptr;
+          }
+          z_memory = divide (numerator, pow5, &z);
+          free (num_ptr);
+        }
     }
   free (pow5_ptr);
   free (memory);
@@ -1298,35 +1298,35 @@ floorlog10l (long double x)
   if (y < 0.5L)
     {
       while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
-       {
-         y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0L / (1 << 16)))
-       {
-         y *= 1.0L * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0L * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0L / (1 << 8)))
-       {
-         y *= 1.0L * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0L * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0L / (1 << 4)))
-       {
-         y *= 1.0L * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0L * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0L / (1 << 2)))
-       {
-         y *= 1.0L * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0L * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0L / (1 << 1)))
-       {
-         y *= 1.0L * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0L * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5L && y < 1.0L))
     abort ();
@@ -1389,35 +1389,35 @@ floorlog10 (double x)
   if (y < 0.5)
     {
       while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
-       {
-         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
-         exp -= GMP_LIMB_BITS;
-       }
+        {
+          y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+          exp -= GMP_LIMB_BITS;
+        }
       if (y < (1.0 / (1 << 16)))
-       {
-         y *= 1.0 * (1 << 16);
-         exp -= 16;
-       }
+        {
+          y *= 1.0 * (1 << 16);
+          exp -= 16;
+        }
       if (y < (1.0 / (1 << 8)))
-       {
-         y *= 1.0 * (1 << 8);
-         exp -= 8;
-       }
+        {
+          y *= 1.0 * (1 << 8);
+          exp -= 8;
+        }
       if (y < (1.0 / (1 << 4)))
-       {
-         y *= 1.0 * (1 << 4);
-         exp -= 4;
-       }
+        {
+          y *= 1.0 * (1 << 4);
+          exp -= 4;
+        }
       if (y < (1.0 / (1 << 2)))
-       {
-         y *= 1.0 * (1 << 2);
-         exp -= 2;
-       }
+        {
+          y *= 1.0 * (1 << 2);
+          exp -= 2;
+        }
       if (y < (1.0 / (1 << 1)))
-       {
-         y *= 1.0 * (1 << 1);
-         exp -= 1;
-       }
+        {
+          y *= 1.0 * (1 << 1);
+          exp -= 1;
+        }
     }
   if (!(y >= 0.5 && y < 1.0))
     abort ();
@@ -1476,7 +1476,7 @@ is_borderline (const char *digits, size_t precision)
 
 DCHAR_T *
 VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
-           const FCHAR_T *format, va_list args)
+            const FCHAR_T *format, va_list args)
 {
   DIRECTIVES d;
   arguments a;
@@ -1486,8 +1486,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     return NULL;
 
 #define CLEANUP() \
-  free (d.dir);                                                                \
-  if (a.arg)                                                           \
+  free (d.dir);                                                         \
+  if (a.arg)                                                            \
     free (a.arg);
 
   if (PRINTF_FETCHARGS (args, &a) < 0)
@@ -1516,30 +1516,30 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #if HAVE_ALLOCA
     if (buf_neededlength < 4000 / sizeof (TCHAR_T))
       {
-       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
-       buf_malloced = NULL;
+        buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
+        buf_malloced = NULL;
       }
     else
 #endif
       {
-       size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
-       if (size_overflow_p (buf_memsize))
-         goto out_of_memory_1;
-       buf = (TCHAR_T *) malloc (buf_memsize);
-       if (buf == NULL)
-         goto out_of_memory_1;
-       buf_malloced = buf;
+        size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T));
+        if (size_overflow_p (buf_memsize))
+          goto out_of_memory_1;
+        buf = (TCHAR_T *) malloc (buf_memsize);
+        if (buf == NULL)
+          goto out_of_memory_1;
+        buf_malloced = buf;
       }
 
     if (resultbuf != NULL)
       {
-       result = resultbuf;
-       allocated = *lengthp;
+        result = resultbuf;
+        allocated = *lengthp;
       }
     else
       {
-       result = NULL;
-       allocated = 0;
+        result = NULL;
+        allocated = 0;
       }
     length = 0;
     /* Invariants:
@@ -1549,3881 +1549,3881 @@ 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) \
-    if ((needed) > allocated)                                               \
-      {                                                                             \
-       size_t memory_size;                                                  \
-       DCHAR_T *memory;                                                     \
-                                                                            \
-       allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
-       if ((needed) > allocated)                                            \
-         allocated = (needed);                                              \
-       memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
-       if (size_overflow_p (memory_size))                                   \
-         goto out_of_memory;                                                \
-       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;                                                \
-       if (result == resultbuf && length > 0)                               \
-         DCHAR_CPY (memory, result, length);                                \
-       result = memory;                                                     \
+    if ((needed) > allocated)                                                \
+      {                                                                      \
+        size_t memory_size;                                                  \
+        DCHAR_T *memory;                                                     \
+                                                                             \
+        allocated = (allocated > 0 ? xtimes (allocated, 2) : 12);            \
+        if ((needed) > allocated)                                            \
+          allocated = (needed);                                              \
+        memory_size = xtimes (allocated, sizeof (DCHAR_T));                  \
+        if (size_overflow_p (memory_size))                                   \
+          goto out_of_memory;                                                \
+        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;                                                \
+        if (result == resultbuf && length > 0)                               \
+          DCHAR_CPY (memory, result, length);                                \
+        result = memory;                                                     \
       }
 
     for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
       {
-       if (cp != dp->dir_start)
-         {
-           size_t n = dp->dir_start - cp;
-           size_t augmented_length = xsum (length, n);
-
-           ENSURE_ALLOCATION (augmented_length);
-           /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
-              need that the format string contains only ASCII characters
-              if FCHAR_T and DCHAR_T are not the same type.  */
-           if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
-             {
-               DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
-               length = augmented_length;
-             }
-           else
-             {
-               do
-                 result[length++] = (unsigned char) *cp++;
-               while (--n > 0);
-             }
-         }
-       if (i == d.count)
-         break;
-
-       /* Execute a single directive.  */
-       if (dp->conversion == '%')
-         {
-           size_t augmented_length;
-
-           if (!(dp->arg_index == ARG_NONE))
-             abort ();
-           augmented_length = xsum (length, 1);
-           ENSURE_ALLOCATION (augmented_length);
-           result[length] = '%';
-           length = augmented_length;
-         }
-       else
-         {
-           if (!(dp->arg_index != ARG_NONE))
-             abort ();
-
-           if (dp->conversion == 'n')
-             {
-               switch (a.arg[dp->arg_index].type)
-                 {
-                 case TYPE_COUNT_SCHAR_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
-                   break;
-                 case TYPE_COUNT_SHORT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_short_pointer = length;
-                   break;
-                 case TYPE_COUNT_INT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_int_pointer = length;
-                   break;
-                 case TYPE_COUNT_LONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
-                   break;
+        if (cp != dp->dir_start)
+          {
+            size_t n = dp->dir_start - cp;
+            size_t augmented_length = xsum (length, n);
+
+            ENSURE_ALLOCATION (augmented_length);
+            /* This copies a piece of FCHAR_T[] into a DCHAR_T[].  Here we
+               need that the format string contains only ASCII characters
+               if FCHAR_T and DCHAR_T are not the same type.  */
+            if (sizeof (FCHAR_T) == sizeof (DCHAR_T))
+              {
+                DCHAR_CPY (result + length, (const DCHAR_T *) cp, n);
+                length = augmented_length;
+              }
+            else
+              {
+                do
+                  result[length++] = (unsigned char) *cp++;
+                while (--n > 0);
+              }
+          }
+        if (i == d.count)
+          break;
+
+        /* Execute a single directive.  */
+        if (dp->conversion == '%')
+          {
+            size_t augmented_length;
+
+            if (!(dp->arg_index == ARG_NONE))
+              abort ();
+            augmented_length = xsum (length, 1);
+            ENSURE_ALLOCATION (augmented_length);
+            result[length] = '%';
+            length = augmented_length;
+          }
+        else
+          {
+            if (!(dp->arg_index != ARG_NONE))
+              abort ();
+
+            if (dp->conversion == 'n')
+              {
+                switch (a.arg[dp->arg_index].type)
+                  {
+                  case TYPE_COUNT_SCHAR_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
+                    break;
+                  case TYPE_COUNT_SHORT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_short_pointer = length;
+                    break;
+                  case TYPE_COUNT_INT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_int_pointer = length;
+                    break;
+                  case TYPE_COUNT_LONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
+                    break;
 #if HAVE_LONG_LONG_INT
-                 case TYPE_COUNT_LONGLONGINT_POINTER:
-                   *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
-                   break;
+                  case TYPE_COUNT_LONGLONGINT_POINTER:
+                    *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
+                    break;
 #endif
-                 default:
-                   abort ();
-                 }
-             }
+                  default:
+                    abort ();
+                  }
+              }
 #if ENABLE_UNISTDIO
-           /* The unistdio extensions.  */
-           else if (dp->conversion == 'U')
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               switch (type)
-                 {
-                 case TYPE_U8_STRING:
-                   {
-                     const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
-                     const uint8_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u8_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u8_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+            /* The unistdio extensions.  */
+            else if (dp->conversion == 'U')
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                switch (type)
+                  {
+                  case TYPE_U8_STRING:
+                    {
+                      const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string;
+                      const uint8_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u8_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u8_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT8_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-8 to locale encoding.  */
-                       converted =
-                         u8_conv_to_encoding (locale_charset (),
-                                              iconveh_question_mark,
-                                              arg, arg_end - arg, NULL,
-                                              converted, &converted_len);
+                        /* Convert from UTF-8 to locale encoding.  */
+                        converted =
+                          u8_conv_to_encoding (locale_charset (),
+                                               iconveh_question_mark,
+                                               arg, arg_end - arg, NULL,
+                                               converted, &converted_len);
 #  else
-                       /* Convert from UTF-8 to UTF-16/UTF-32.  */
-                       converted =
-                         U8_TO_DCHAR (arg, arg_end - arg,
-                                      converted, &converted_len);
+                        /* Convert from UTF-8 to UTF-16/UTF-32.  */
+                        converted =
+                          U8_TO_DCHAR (arg, arg_end - arg,
+                                       converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U16_STRING:
-                   {
-                     const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
-                     const uint16_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u16_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u16_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U16_STRING:
+                    {
+                      const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string;
+                      const uint16_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u16_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u16_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT16_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-16 to locale encoding.  */
-                       converted =
-                         u16_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-16 to locale encoding.  */
+                        converted =
+                          u16_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-16 to UTF-8/UTF-32.  */
-                       converted =
-                         U16_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-16 to UTF-8/UTF-32.  */
+                        converted =
+                          U16_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 case TYPE_U32_STRING:
-                   {
-                     const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
-                     const uint32_t *arg_end;
-                     size_t characters;
-
-                     if (has_precision)
-                       {
-                         /* Use only PRECISION characters, from the left.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (; precision > 0; precision--)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else if (has_width)
-                       {
-                         /* Use the entire string, and count the number of
-                            characters.  */
-                         arg_end = arg;
-                         characters = 0;
-                         for (;;)
-                           {
-                             int count = u32_strmblen (arg_end);
-                             if (count == 0)
-                               break;
-                             if (count < 0)
-                               {
-                                 if (!(result == resultbuf || result == NULL))
-                                   free (result);
-                                 if (buf_malloced != NULL)
-                                   free (buf_malloced);
-                                 CLEANUP ();
-                                 errno = EILSEQ;
-                                 return NULL;
-                               }
-                             arg_end += count;
-                             characters++;
-                           }
-                       }
-                     else
-                       {
-                         /* Use the entire string.  */
-                         arg_end = arg + u32_strlen (arg);
-                         /* The number of characters doesn't matter.  */
-                         characters = 0;
-                       }
-
-                     if (has_width && width > characters
-                         && !(dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  case TYPE_U32_STRING:
+                    {
+                      const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string;
+                      const uint32_t *arg_end;
+                      size_t characters;
+
+                      if (has_precision)
+                        {
+                          /* Use only PRECISION characters, from the left.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (; precision > 0; precision--)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else if (has_width)
+                        {
+                          /* Use the entire string, and count the number of
+                             characters.  */
+                          arg_end = arg;
+                          characters = 0;
+                          for (;;)
+                            {
+                              int count = u32_strmblen (arg_end);
+                              if (count == 0)
+                                break;
+                              if (count < 0)
+                                {
+                                  if (!(result == resultbuf || result == NULL))
+                                    free (result);
+                                  if (buf_malloced != NULL)
+                                    free (buf_malloced);
+                                  CLEANUP ();
+                                  errno = EILSEQ;
+                                  return NULL;
+                                }
+                              arg_end += count;
+                              characters++;
+                            }
+                        }
+                      else
+                        {
+                          /* Use the entire string.  */
+                          arg_end = arg + u32_strlen (arg);
+                          /* The number of characters doesn't matter.  */
+                          characters = 0;
+                        }
+
+                      if (has_width && width > characters
+                          && !(dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
 
 # if DCHAR_IS_UINT32_T
-                     {
-                       size_t n = arg_end - arg;
-                       ENSURE_ALLOCATION (xsum (length, n));
-                       DCHAR_CPY (result + length, arg, n);
-                       length += n;
-                     }
+                      {
+                        size_t n = arg_end - arg;
+                        ENSURE_ALLOCATION (xsum (length, n));
+                        DCHAR_CPY (result + length, arg, n);
+                        length += n;
+                      }
 # else
-                     { /* Convert.  */
-                       DCHAR_T *converted = result + length;
-                       size_t converted_len = allocated - length;
+                      { /* Convert.  */
+                        DCHAR_T *converted = result + length;
+                        size_t converted_len = allocated - length;
 #  if DCHAR_IS_TCHAR
-                       /* Convert from UTF-32 to locale encoding.  */
-                       converted =
-                         u32_conv_to_encoding (locale_charset (),
-                                               iconveh_question_mark,
-                                               arg, arg_end - arg, NULL,
-                                               converted, &converted_len);
+                        /* Convert from UTF-32 to locale encoding.  */
+                        converted =
+                          u32_conv_to_encoding (locale_charset (),
+                                                iconveh_question_mark,
+                                                arg, arg_end - arg, NULL,
+                                                converted, &converted_len);
 #  else
-                       /* Convert from UTF-32 to UTF-8/UTF-16.  */
-                       converted =
-                         U32_TO_DCHAR (arg, arg_end - arg,
-                                       converted, &converted_len);
+                        /* Convert from UTF-32 to UTF-8/UTF-16.  */
+                        converted =
+                          U32_TO_DCHAR (arg, arg_end - arg,
+                                        converted, &converted_len);
 #  endif
-                       if (converted == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       if (converted != result + length)
-                         {
-                           ENSURE_ALLOCATION (xsum (length, converted_len));
-                           DCHAR_CPY (result + length, converted, converted_len);
-                           free (converted);
-                         }
-                       length += converted_len;
-                     }
+                        if (converted == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        if (converted != result + length)
+                          {
+                            ENSURE_ALLOCATION (xsum (length, converted_len));
+                            DCHAR_CPY (result + length, converted, converted_len);
+                            free (converted);
+                          }
+                        length += converted_len;
+                      }
 # endif
 
-                     if (has_width && width > characters
-                         && (dp->flags & FLAG_LEFT))
-                       {
-                         size_t n = width - characters;
-                         ENSURE_ALLOCATION (xsum (length, n));
-                         DCHAR_SET (result + length, ' ', n);
-                         length += n;
-                       }
-                   }
-                   break;
-
-                 default:
-                   abort ();
-                 }
-             }
+                      if (has_width && width > characters
+                          && (dp->flags & FLAG_LEFT))
+                        {
+                          size_t n = width - characters;
+                          ENSURE_ALLOCATION (xsum (length, n));
+                          DCHAR_SET (result + length, ' ', n);
+                          length += n;
+                        }
+                    }
+                    break;
+
+                  default:
+                    abort ();
+                  }
+              }
 #endif
 #if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T
-           else if (dp->conversion == 's'
+            else if (dp->conversion == 's'
 # if WIDE_CHAR_VERSION
-                    && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
 # else
-                    && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
+                     && a.arg[dp->arg_index].type == TYPE_WIDE_STRING
 # endif
-                   )
-             {
-               /* The normal handling of the 's' directive below requires
-                  allocating a temporary buffer.  The determination of its
-                  length (tmp_length), in the case when a precision is
-                  specified, below requires a conversion between a char[]
-                  string and a wchar_t[] wide string.  It could be done, but
-                  we have no guarantee that the implementation of sprintf will
-                  use the exactly same algorithm.  Without this guarantee, it
-                  is possible to have buffer overrun bugs.  In order to avoid
-                  such bugs, we implement the entire processing of the 's'
-                  directive ourselves.  */
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
+                    )
+              {
+                /* The normal handling of the 's' directive below requires
+                   allocating a temporary buffer.  The determination of its
+                   length (tmp_length), in the case when a precision is
+                   specified, below requires a conversion between a char[]
+                   string and a wchar_t[] wide string.  It could be done, but
+                   we have no guarantee that the implementation of sprintf will
+                   use the exactly same algorithm.  Without this guarantee, it
+                   is possible to have buffer overrun bugs.  In order to avoid
+                   such bugs, we implement the entire processing of the 's'
+                   directive ourselves.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
 
 # if WIDE_CHAR_VERSION
-               /* %s in vasnwprintf.  See the specification of fwprintf.  */
-               {
-                 const char *arg = a.arg[dp->arg_index].a.a_string;
-                 const char *arg_end;
-                 size_t characters;
-
-                 if (has_precision)
-                   {
-                     /* Use only as many bytes as needed to produce PRECISION
-                        wide characters, from the left.  */
+                /* %s in vasnwprintf.  See the specification of fwprintf.  */
+                {
+                  const char *arg = a.arg[dp->arg_index].a.a_string;
+                  const char *arg_end;
+                  size_t characters;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many bytes as needed to produce PRECISION
+                         wide characters, from the left.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (; precision > 0; precision--)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (; precision > 0; precision--)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else if (has_width)
-                   {
-                     /* Use the entire string, and count the number of wide
-                        characters.  */
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else if (has_width)
+                    {
+                      /* Use the entire string, and count the number of wide
+                         characters.  */
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         int count;
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrlen (arg_end, MB_CUR_MAX, &state);
+                          count = mbrlen (arg_end, MB_CUR_MAX, &state);
 #  else
-                         count = mblen (arg_end, MB_CUR_MAX);
+                          count = mblen (arg_end, MB_CUR_MAX);
 #  endif
-                         if (count == 0)
-                           /* Found the terminating NUL.  */
-                           break;
-                         if (count < 0)
-                           {
-                             /* Invalid or incomplete multibyte character.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end += count;
-                         characters++;
-                       }
-                   }
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + strlen (arg);
-                     /* The number of characters doesn't matter.  */
-                     characters = 0;
-                   }
-
-                 if (has_width && width > characters
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of wide characters in advance.  */
-                     size_t remaining;
+                          if (count == 0)
+                            /* Found the terminating NUL.  */
+                            break;
+                          if (count < 0)
+                            {
+                              /* Invalid or incomplete multibyte character.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end += count;
+                          characters++;
+                        }
+                    }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + strlen (arg);
+                      /* The number of characters doesn't matter.  */
+                      characters = 0;
+                    }
+
+                  if (has_width && width > characters
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of wide characters in advance.  */
+                      size_t remaining;
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; remaining--)
-                       {
-                         wchar_t wc;
-                         int count;
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; remaining--)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
 #  if HAVE_MBRTOWC
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     while (arg < arg_end)
-                       {
-                         wchar_t wc;
-                         int count;
+                      while (arg < arg_end)
+                        {
+                          wchar_t wc;
+                          int count;
 #  if HAVE_MBRTOWC
-                         count = mbrtowc (&wc, arg, arg_end - arg, &state);
+                          count = mbrtowc (&wc, arg, arg_end - arg, &state);
 #  else
-                         count = mbtowc (&wc, arg, arg_end - arg);
+                          count = mbtowc (&wc, arg, arg_end - arg);
 #  endif
-                         if (count <= 0)
-                           /* mbrtowc not consistent with mbrlen, or mbtowc
-                              not consistent with mblen.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, 1));
-                         result[length++] = wc;
-                         arg += count;
-                       }
-                   }
-
-                 if (has_width && width > characters
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - characters;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
+                          if (count <= 0)
+                            /* mbrtowc not consistent with mbrlen, or mbtowc
+                               not consistent with mblen.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, 1));
+                          result[length++] = wc;
+                          arg += count;
+                        }
+                    }
+
+                  if (has_width && width > characters
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - characters;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
 # else
-               /* %ls in vasnprintf.  See the specification of fprintf.  */
-               {
-                 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
-                 const wchar_t *arg_end;
-                 size_t characters;
+                /* %ls in vasnprintf.  See the specification of fprintf.  */
+                {
+                  const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                  const wchar_t *arg_end;
+                  size_t characters;
 #  if !DCHAR_IS_TCHAR
-                 /* This code assumes that TCHAR_T is 'char'.  */
-                 typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
-                 TCHAR_T *tmpsrc;
-                 DCHAR_T *tmpdst;
-                 size_t tmpdst_len;
+                  /* This code assumes that TCHAR_T is 'char'.  */
+                  typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
+                  TCHAR_T *tmpsrc;
+                  DCHAR_T *tmpdst;
+                  size_t tmpdst_len;
 #  endif
-                 size_t w;
-
-                 if (has_precision)
-                   {
-                     /* Use only as many wide characters as needed to produce
-                        at most PRECISION bytes, from the left.  */
-#  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                  size_t w;
+
+                  if (has_precision)
+                    {
+                      /* Use only as many wide characters as needed to produce
+                         at most PRECISION bytes, from the left.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     while (precision > 0)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
-#  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                      arg_end = arg;
+                      characters = 0;
+                      while (precision > 0)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         if (precision < count)
-                           break;
-                         arg_end++;
-                         characters += count;
-                         precision -= count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          if (precision < count)
+                            break;
+                          arg_end++;
+                          characters += count;
+                          precision -= count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else if (has_width)
+                  else if (has_width)
 #  else
-                 else
+                  else
 #  endif
-                   {
-                     /* Use the entire string, and count the number of
-                        bytes.  */
-#  if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                    {
+                      /* Use the entire string, and count the number of
+                         bytes.  */
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #  endif
-                     arg_end = arg;
-                     characters = 0;
-                     for (;;)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg_end == 0)
-                           /* Found the terminating null wide character.  */
-                           break;
-#  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                      arg_end = arg;
+                      characters = 0;
+                      for (;;)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg_end == 0)
+                            /* Found the terminating null wide character.  */
+                            break;
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                          count = wctomb (cbuf, *arg_end);
 #  endif
-                         if (count < 0)
-                           {
-                             /* Cannot convert.  */
-                             if (!(result == resultbuf || result == NULL))
-                               free (result);
-                             if (buf_malloced != NULL)
-                               free (buf_malloced);
-                             CLEANUP ();
-                             errno = EILSEQ;
-                             return NULL;
-                           }
-                         arg_end++;
-                         characters += count;
-                       }
-                   }
+                          if (count < 0)
+                            {
+                              /* Cannot convert.  */
+                              if (!(result == resultbuf || result == NULL))
+                                free (result);
+                              if (buf_malloced != NULL)
+                                free (buf_malloced);
+                              CLEANUP ();
+                              errno = EILSEQ;
+                              return NULL;
+                            }
+                          arg_end++;
+                          characters += count;
+                        }
+                    }
 #  if DCHAR_IS_TCHAR
-                 else
-                   {
-                     /* Use the entire string.  */
-                     arg_end = arg + local_wcslen (arg);
-                     /* The number of bytes doesn't matter.  */
-                     characters = 0;
-                   }
+                  else
+                    {
+                      /* Use the entire string.  */
+                      arg_end = arg + local_wcslen (arg);
+                      /* The number of bytes doesn't matter.  */
+                      characters = 0;
+                    }
 #  endif
 
 #  if !DCHAR_IS_TCHAR
-                 /* Convert the string into a piece of temporary memory.  */
-                 tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
-                 if (tmpsrc == NULL)
-                   goto out_of_memory;
-                 {
-                   TCHAR_T *tmpptr = tmpsrc;
-                   size_t remaining;
-#   if HAVE_WCRTOMB
-                   mbstate_t state;
-                   memset (&state, '\0', sizeof (mbstate_t));
+                  /* Convert the string into a piece of temporary memory.  */
+                  tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
+                  if (tmpsrc == NULL)
+                    goto out_of_memory;
+                  {
+                    TCHAR_T *tmpptr = tmpsrc;
+                    size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                    mbstate_t state;
+                    memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                   for (remaining = characters; remaining > 0; )
-                     {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                       int count;
-
-                       if (*arg == 0)
-                         abort ();
-#   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                    for (remaining = characters; remaining > 0; )
+                      {
+                        char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                        int count;
+
+                        if (*arg == 0)
+                          abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                        count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                        count = wctomb (cbuf, *arg);
 #   endif
-                       if (count <= 0)
-                         /* Inconsistency.  */
-                         abort ();
-                       memcpy (tmpptr, buf, count);
-                       tmpptr += count;
-                       arg++;
-                       remaining -= count;
-                     }
-                   if (!(arg == arg_end))
-                     abort ();
-                 }
-
-                 /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                 tmpdst =
-                   DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                             iconveh_question_mark,
-                                             tmpsrc, characters,
-                                             NULL,
-                                             NULL, &tmpdst_len);
-                 if (tmpdst == NULL)
-                   {
-                     int saved_errno = errno;
-                     free (tmpsrc);
-                     if (!(result == resultbuf || result == NULL))
-                       free (result);
-                     if (buf_malloced != NULL)
-                       free (buf_malloced);
-                     CLEANUP ();
-                     errno = saved_errno;
-                     return NULL;
-                   }
-                 free (tmpsrc);
+                        if (count <= 0)
+                          /* Inconsistency.  */
+                          abort ();
+                        memcpy (tmpptr, cbuf, count);
+                        tmpptr += count;
+                        arg++;
+                        remaining -= count;
+                      }
+                    if (!(arg == arg_end))
+                      abort ();
+                  }
+
+                  /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                  tmpdst =
+                    DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                              iconveh_question_mark,
+                                              tmpsrc, characters,
+                                              NULL,
+                                              NULL, &tmpdst_len);
+                  if (tmpdst == NULL)
+                    {
+                      int saved_errno = errno;
+                      free (tmpsrc);
+                      if (!(result == resultbuf || result == NULL))
+                        free (result);
+                      if (buf_malloced != NULL)
+                        free (buf_malloced);
+                      CLEANUP ();
+                      errno = saved_errno;
+                      return NULL;
+                    }
+                  free (tmpsrc);
 #  endif
 
-                 if (has_width)
-                   {
+                  if (has_width)
+                    {
 #  if ENABLE_UNISTDIO
-                     /* Outside POSIX, it's preferrable to compare the width
-                        against the number of _characters_ of the converted
-                        value.  */
-                     w = DCHAR_MBSNLEN (result + length, characters);
+                      /* Outside POSIX, it's preferrable to compare the width
+                         against the number of _characters_ of the converted
+                         value.  */
+                      w = DCHAR_MBSNLEN (result + length, characters);
 #  else
-                     /* The width is compared against the number of _bytes_
-                        of the converted value, says POSIX.  */
-                     w = characters;
+                      /* The width is compared against the number of _bytes_
+                         of the converted value, says POSIX.  */
+                      w = characters;
 #  endif
-                   }
-                 else
-                   /* w doesn't matter.  */
-                   w = 0;
-
-                 if (has_width && width > w
-                     && !(dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
+                    }
+                  else
+                    /* w doesn't matter.  */
+                    w = 0;
+
+                  if (has_width && width > w
+                      && !(dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
 
 #  if DCHAR_IS_TCHAR
-                 if (has_precision || has_width)
-                   {
-                     /* We know the number of bytes in advance.  */
-                     size_t remaining;
-#   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                  if (has_precision || has_width)
+                    {
+                      /* We know the number of bytes in advance.  */
+                      size_t remaining;
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     ENSURE_ALLOCATION (xsum (length, characters));
-                     for (remaining = characters; remaining > 0; )
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg == 0)
-                           abort ();
-#   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                      ENSURE_ALLOCATION (xsum (length, characters));
+                      for (remaining = characters; remaining > 0; )
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                         remaining -= count;
-                       }
-                     if (!(arg == arg_end))
-                       abort ();
-                   }
-                 else
-                   {
-#   if HAVE_WCRTOMB
-                     mbstate_t state;
-                     memset (&state, '\0', sizeof (mbstate_t));
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                          remaining -= count;
+                        }
+                      if (!(arg == arg_end))
+                        abort ();
+                    }
+                  else
+                    {
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                      mbstate_t state;
+                      memset (&state, '\0', sizeof (mbstate_t));
 #   endif
-                     while (arg < arg_end)
-                       {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
-                         int count;
-
-                         if (*arg == 0)
-                           abort ();
-#   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                      while (arg < arg_end)
+                        {
+                          char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                          int count;
+
+                          if (*arg == 0)
+                            abort ();
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
+                          count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                          count = wctomb (cbuf, *arg);
 #   endif
-                         if (count <= 0)
-                           /* Inconsistency.  */
-                           abort ();
-                         ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
-                         length += count;
-                         arg++;
-                       }
-                   }
+                          if (count <= 0)
+                            /* Inconsistency.  */
+                            abort ();
+                          ENSURE_ALLOCATION (xsum (length, count));
+                          memcpy (result + length, cbuf, count);
+                          length += count;
+                          arg++;
+                        }
+                    }
 #  else
-                 ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                 free (tmpdst);
-                 length += tmpdst_len;
+                  ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                  DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                  free (tmpdst);
+                  length += tmpdst_len;
 #  endif
 
-                 if (has_width && width > w
-                     && (dp->flags & FLAG_LEFT))
-                   {
-                     size_t n = width - w;
-                     ENSURE_ALLOCATION (xsum (length, n));
-                     DCHAR_SET (result + length, ' ', n);
-                     length += n;
-                   }
-               }
-             }
+                  if (has_width && width > w
+                      && (dp->flags & FLAG_LEFT))
+                    {
+                      size_t n = width - w;
+                      ENSURE_ALLOCATION (xsum (length, n));
+                      DCHAR_SET (result + length, ' ', n);
+                      length += n;
+                    }
+                }
+              }
 # endif
 #endif
 #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
-           else if ((dp->conversion == 'a' || dp->conversion == 'A')
+            else if ((dp->conversion == 'a' || dp->conversion == 'A')
 # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
-                    && (0
+                     && (0
 #  if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 #  endif
 #  if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 #  endif
-                       )
+                        )
 # endif
-                   )
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* Allocate a temporary buffer of sufficient size.  */
-               if (type == TYPE_LONGDOUBLE)
-                 tmp_length =
-                   (unsigned int) ((LDBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               else
-                 tmp_length =
-                   (unsigned int) ((DBL_DIG + 1)
-                                   * 0.831 /* decimal -> hexadecimal */
-                                  )
-                   + 1; /* turn floor into ceil */
-               if (tmp_length < precision)
-                 tmp_length = precision;
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
-
-               if (tmp_length < width)
-                 tmp_length = width;
-
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
-
-               pad_ptr = NULL;
-               p = tmp;
-               if (type == TYPE_LONGDOUBLE)
-                 {
+                    )
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* Allocate a temporary buffer of sufficient size.  */
+                if (type == TYPE_LONGDOUBLE)
+                  tmp_length =
+                    (unsigned int) ((LDBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                else
+                  tmp_length =
+                    (unsigned int) ((DBL_DIG + 1)
+                                    * 0.831 /* decimal -> hexadecimal */
+                                   )
+                    + 1; /* turn floor into ceil */
+                if (tmp_length < precision)
+                  tmp_length = precision;
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
+
+                if (tmp_length < width)
+                  tmp_length = width;
+
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
+
+                pad_ptr = NULL;
+                p = tmp;
+                if (type == TYPE_LONGDOUBLE)
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           long double mantissa;
-
-                           if (arg > 0.0L)
-                             mantissa = printf_frexpl (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0L;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               long double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0L;
-                                 }
-                               if (tail != 0.0L)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625L;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0L || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0L)
-                                   {
-                                     mantissa *= 16.0L;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            long double mantissa;
+
+                            if (arg > 0.0L)
+                              mantissa = printf_frexpl (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0L;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                long double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5L : tail > 0.5L)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0L;
+                                  }
+                                if (tail != 0.0L)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625L;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0L || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0L)
+                                    {
+                                      mantissa *= 16.0L;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               else
-                 {
+                  }
+                else
+                  {
 # if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion == 'A')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion == 'A')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
-                           int exponent;
-                           double mantissa;
-
-                           if (arg > 0.0)
-                             mantissa = printf_frexp (arg, &exponent);
-                           else
-                             {
-                               exponent = 0;
-                               mantissa = 0.0;
-                             }
-
-                           if (has_precision
-                               && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
-                             {
-                               /* Round the mantissa.  */
-                               double tail = mantissa;
-                               size_t q;
-
-                               for (q = precision; ; q--)
-                                 {
-                                   int digit = (int) tail;
-                                   tail -= digit;
-                                   if (q == 0)
-                                     {
-                                       if (digit & 1 ? tail >= 0.5 : tail > 0.5)
-                                         tail = 1 - tail;
-                                       else
-                                         tail = - tail;
-                                       break;
-                                     }
-                                   tail *= 16.0;
-                                 }
-                               if (tail != 0.0)
-                                 for (q = precision; q > 0; q--)
-                                   tail *= 0.0625;
-                               mantissa += tail;
-                             }
-
-                           *p++ = '0';
-                           *p++ = dp->conversion - 'A' + 'X';
-                           pad_ptr = p;
-                           {
-                             int digit;
-
-                             digit = (int) mantissa;
-                             mantissa -= digit;
-                             *p++ = '0' + digit;
-                             if ((flags & FLAG_ALT)
-                                 || mantissa > 0.0 || precision > 0)
-                               {
-                                 *p++ = decimal_point_char ();
-                                 /* This loop terminates because we assume
-                                    that FLT_RADIX is a power of 2.  */
-                                 while (mantissa > 0.0)
-                                   {
-                                     mantissa *= 16.0;
-                                     digit = (int) mantissa;
-                                     mantissa -= digit;
-                                     *p++ = digit
-                                            + (digit < 10
-                                               ? '0'
-                                               : dp->conversion - 10);
-                                     if (precision > 0)
-                                       precision--;
-                                   }
-                                 while (precision > 0)
-                                   {
-                                     *p++ = '0';
-                                     precision--;
-                                   }
-                               }
-                             }
-                             *p++ = dp->conversion - 'A' + 'P';
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion == 'A')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion == 'A')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
+                            int exponent;
+                            double mantissa;
+
+                            if (arg > 0.0)
+                              mantissa = printf_frexp (arg, &exponent);
+                            else
+                              {
+                                exponent = 0;
+                                mantissa = 0.0;
+                              }
+
+                            if (has_precision
+                                && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1)
+                              {
+                                /* Round the mantissa.  */
+                                double tail = mantissa;
+                                size_t q;
+
+                                for (q = precision; ; q--)
+                                  {
+                                    int digit = (int) tail;
+                                    tail -= digit;
+                                    if (q == 0)
+                                      {
+                                        if (digit & 1 ? tail >= 0.5 : tail > 0.5)
+                                          tail = 1 - tail;
+                                        else
+                                          tail = - tail;
+                                        break;
+                                      }
+                                    tail *= 16.0;
+                                  }
+                                if (tail != 0.0)
+                                  for (q = precision; q > 0; q--)
+                                    tail *= 0.0625;
+                                mantissa += tail;
+                              }
+
+                            *p++ = '0';
+                            *p++ = dp->conversion - 'A' + 'X';
+                            pad_ptr = p;
+                            {
+                              int digit;
+
+                              digit = (int) mantissa;
+                              mantissa -= digit;
+                              *p++ = '0' + digit;
+                              if ((flags & FLAG_ALT)
+                                  || mantissa > 0.0 || precision > 0)
+                                {
+                                  *p++ = decimal_point_char ();
+                                  /* This loop terminates because we assume
+                                     that FLT_RADIX is a power of 2.  */
+                                  while (mantissa > 0.0)
+                                    {
+                                      mantissa *= 16.0;
+                                      digit = (int) mantissa;
+                                      mantissa -= digit;
+                                      *p++ = digit
+                                             + (digit < 10
+                                                ? '0'
+                                                : dp->conversion - 10);
+                                      if (precision > 0)
+                                        precision--;
+                                    }
+                                  while (precision > 0)
+                                    {
+                                      *p++ = '0';
+                                      precision--;
+                                    }
+                                }
+                              }
+                              *p++ = dp->conversion - 'A' + 'P';
 #  if WIDE_CHAR_VERSION
-                             {
-                               static const wchar_t decimal_format[] =
-                                 { '%', '+', 'd', '\0' };
-                               SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                             }
-                             while (*p != '\0')
-                               p++;
+                              {
+                                static const wchar_t decimal_format[] =
+                                  { '%', '+', 'd', '\0' };
+                                SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                              }
+                              while (*p != '\0')
+                                p++;
 #  else
-                             if (sizeof (DCHAR_T) == 1)
-                               {
-                                 sprintf ((char *) p, "%+d", exponent);
-                                 while (*p != '\0')
-                                   p++;
-                               }
-                             else
-                               {
-                                 char expbuf[6 + 1];
-                                 const char *ep;
-                                 sprintf (expbuf, "%+d", exponent);
-                                 for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                   p++;
-                               }
+                              if (sizeof (DCHAR_T) == 1)
+                                {
+                                  sprintf ((char *) p, "%+d", exponent);
+                                  while (*p != '\0')
+                                    p++;
+                                }
+                              else
+                                {
+                                  char expbuf[6 + 1];
+                                  const char *ep;
+                                  sprintf (expbuf, "%+d", exponent);
+                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                    p++;
+                                }
 #  endif
-                         }
-                     }
+                          }
+                      }
 # else
-                   abort ();
+                    abort ();
 # endif
-                 }
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                  }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
 #if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
-           else if ((dp->conversion == 'f' || dp->conversion == 'F'
-                     || dp->conversion == 'e' || dp->conversion == 'E'
-                     || dp->conversion == 'g' || dp->conversion == 'G'
-                     || dp->conversion == 'a' || dp->conversion == 'A')
-                    && (0
+            else if ((dp->conversion == 'f' || dp->conversion == 'F'
+                      || dp->conversion == 'e' || dp->conversion == 'E'
+                      || dp->conversion == 'g' || dp->conversion == 'G'
+                      || dp->conversion == 'a' || dp->conversion == 'A')
+                     && (0
 # if NEED_PRINTF_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_DOUBLE
 # elif NEED_PRINTF_INFINITE_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_DOUBLE
-                            /* The systems (mingw) which produce wrong output
-                               for Inf, -Inf, and NaN also do so for -0.0.
-                               Therefore we treat this case here as well.  */
-                            && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
+                         || (a.arg[dp->arg_index].type == TYPE_DOUBLE
+                             /* The systems (mingw) which produce wrong output
+                                for Inf, -Inf, and NaN also do so for -0.0.
+                                Therefore we treat this case here as well.  */
+                             && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double))
 # endif
 # if NEED_PRINTF_LONG_DOUBLE
-                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                         || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
 # elif NEED_PRINTF_INFINITE_LONG_DOUBLE
-                        || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
-                            /* Some systems produce wrong output for Inf,
-                               -Inf, and NaN.  Some systems in this category
-                               (IRIX 5.3) also do so for -0.0.  Therefore we
-                               treat this case here as well.  */
-                            && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
+                         || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+                             /* Some systems produce wrong output for Inf,
+                                -Inf, and NaN.  Some systems in this category
+                                (IRIX 5.3) also do so for -0.0.  Therefore we
+                                treat this case here as well.  */
+                             && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
 # endif
-                       ))
-             {
+                        ))
+              {
 # if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
-               arg_type type = a.arg[dp->arg_index].type;
+                arg_type type = a.arg[dp->arg_index].type;
 # endif
-               int flags = dp->flags;
-               int has_width;
-               size_t width;
-               int has_precision;
-               size_t precision;
-               size_t tmp_length;
-               DCHAR_T tmpbuf[700];
-               DCHAR_T *tmp;
-               DCHAR_T *pad_ptr;
-               DCHAR_T *p;
-
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
-
-               has_precision = 0;
-               precision = 0;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
-
-               /* POSIX specifies the default precision to be 6 for %f, %F,
-                  %e, %E, but not for %g, %G.  Implementations appear to use
-                  the same default precision also for %g, %G.  But for %a, %A,
-                  the default precision is 0.  */
-               if (!has_precision)
-                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
-                   precision = 6;
-
-               /* Allocate a temporary buffer of sufficient size.  */
+                int flags = dp->flags;
+                int has_width;
+                size_t width;
+                int has_precision;
+                size_t precision;
+                size_t tmp_length;
+                DCHAR_T tmpbuf[700];
+                DCHAR_T *tmp;
+                DCHAR_T *pad_ptr;
+                DCHAR_T *p;
+
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
+
+                has_precision = 0;
+                precision = 0;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
+
+                /* POSIX specifies the default precision to be 6 for %f, %F,
+                   %e, %E, but not for %g, %G.  Implementations appear to use
+                   the same default precision also for %g, %G.  But for %a, %A,
+                   the default precision is 0.  */
+                if (!has_precision)
+                  if (!(dp->conversion == 'a' || dp->conversion == 'A'))
+                    precision = 6;
+
+                /* Allocate a temporary buffer of sufficient size.  */
 # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
 # elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
-               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
+                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
 # elif NEED_PRINTF_LONG_DOUBLE
-               tmp_length = LDBL_DIG + 1;
+                tmp_length = LDBL_DIG + 1;
 # elif NEED_PRINTF_DOUBLE
-               tmp_length = DBL_DIG + 1;
+                tmp_length = DBL_DIG + 1;
 # else
-               tmp_length = 0;
+                tmp_length = 0;
 # endif
-               if (tmp_length < precision)
-                 tmp_length = precision;
+                if (tmp_length < precision)
+                  tmp_length = precision;
 # if NEED_PRINTF_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                     if (!(isnanl (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10l (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                      if (!(isnanl (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10l (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
 # if NEED_PRINTF_DOUBLE
 #  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-               if (type == TYPE_DOUBLE)
+                if (type == TYPE_DOUBLE)
 #  endif
-                 if (dp->conversion == 'f' || dp->conversion == 'F')
-                   {
-                     double arg = a.arg[dp->arg_index].a.a_double;
-                     if (!(isnand (arg) || arg + arg == arg))
-                       {
-                         /* arg is finite and nonzero.  */
-                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
-                         if (exponent >= 0 && tmp_length < exponent + precision)
-                           tmp_length = exponent + precision;
-                       }
-                   }
+                  if (dp->conversion == 'f' || dp->conversion == 'F')
+                    {
+                      double arg = a.arg[dp->arg_index].a.a_double;
+                      if (!(isnand (arg) || arg + arg == arg))
+                        {
+                          /* arg is finite and nonzero.  */
+                          int exponent = floorlog10 (arg < 0 ? -arg : arg);
+                          if (exponent >= 0 && tmp_length < exponent + precision)
+                            tmp_length = exponent + precision;
+                        }
+                    }
 # endif
-               /* Account for sign, decimal point etc. */
-               tmp_length = xsum (tmp_length, 12);
+                /* Account for sign, decimal point etc. */
+                tmp_length = xsum (tmp_length, 12);
 
-               if (tmp_length < width)
-                 tmp_length = width;
+                if (tmp_length < width)
+                  tmp_length = width;
 
-               tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+                tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
 
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T));
 
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (DCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (DCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 
-               pad_ptr = NULL;
-               p = tmp;
+                pad_ptr = NULL;
+                p = tmp;
 
 # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               if (type == TYPE_LONGDOUBLE)
+                if (type == TYPE_LONGDOUBLE)
 #  endif
-                 {
-                   long double arg = a.arg[dp->arg_index].a.a_longdouble;
-
-                   if (isnanl (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-                       DECL_LONG_DOUBLE_ROUNDING
-
-                       BEGIN_LONG_DOUBLE_ROUNDING ();
-
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0L && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
+
+                    if (isnanl (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+                        DECL_LONG_DOUBLE_ROUNDING
+
+                        BEGIN_LONG_DOUBLE_ROUNDING ();
+
+                        if (signbit (arg)) /* arg < 0.0L or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0L && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_LONG_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_long_double (arg, precision);
-                               if (digits == NULL)
-                                 {
-                                   END_LONG_DOUBLE_ROUNDING ();
-                                   goto out_of_memory;
-                                 }
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0L)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)precision - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_long_double (arg, precision);
+                                if (digits == NULL)
+                                  {
+                                    END_LONG_DOUBLE_ROUNDING ();
+                                    goto out_of_memory;
+                                  }
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0L)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   { '%', '+', '.', '2', 'd', '\0' };
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    { '%', '+', '.', '2', 'd', '\0' };
+                                  SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               if (sizeof (DCHAR_T) == 1)
-                                 {
-                                   sprintf ((char *) p, "%+.2d", exponent);
-                                   while (*p != '\0')
-                                     p++;
-                                 }
-                               else
-                                 {
-                                   char expbuf[6 + 1];
-                                   const char *ep;
-                                   sprintf (expbuf, "%+.2d", exponent);
-                                   for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                     p++;
-                                 }
+                                if (sizeof (DCHAR_T) == 1)
+                                  {
+                                    sprintf ((char *) p, "%+.2d", exponent);
+                                    while (*p != '\0')
+                                      p++;
+                                  }
+                                else
+                                  {
+                                    char expbuf[6 + 1];
+                                    const char *ep;
+                                    sprintf (expbuf, "%+.2d", exponent);
+                                    for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                      p++;
+                                  }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0L)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0L.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10l (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         {
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_long_double (arg,
-                                                                            (int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           END_LONG_DOUBLE_ROUNDING ();
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0L)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0L.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10l (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          {
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_long_double (arg,
+                                                                             (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            END_LONG_DOUBLE_ROUNDING ();
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] =
-                                           { '%', '+', '.', '2', 'd', '\0' };
-                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            { '%', '+', '.', '2', 'd', '\0' };
+                                          SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       if (sizeof (DCHAR_T) == 1)
-                                         {
-                                           sprintf ((char *) p, "%+.2d", exponent);
-                                           while (*p != '\0')
-                                             p++;
-                                         }
-                                       else
-                                         {
-                                           char expbuf[6 + 1];
-                                           const char *ep;
-                                           sprintf (expbuf, "%+.2d", exponent);
-                                           for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                             p++;
-                                         }
+                                        if (sizeof (DCHAR_T) == 1)
+                                          {
+                                            sprintf ((char *) p, "%+.2d", exponent);
+                                            while (*p != '\0')
+                                              p++;
+                                          }
+                                        else
+                                          {
+                                            char expbuf[6 + 1];
+                                            const char *ep;
+                                            sprintf (expbuf, "%+.2d", exponent);
+                                            for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                              p++;
+                                          }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0L))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'a' || dp->conversion == 'A')
-                             {
-                               *p++ = '0';
-                               *p++ = dp->conversion - 'A' + 'X';
-                               pad_ptr = p;
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion - 'A' + 'P';
-                               *p++ = '+';
-                               *p++ = '0';
-                             }
-                           else
-                             abort ();
+                            /* arg is finite.  */
+                            if (!(arg == 0.0L))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'a' || dp->conversion == 'A')
+                              {
+                                *p++ = '0';
+                                *p++ = dp->conversion - 'A' + 'X';
+                                pad_ptr = p;
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion - 'A' + 'P';
+                                *p++ = '+';
+                                *p++ = '0';
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
+                          }
 
-                       END_LONG_DOUBLE_ROUNDING ();
-                     }
-                 }
+                        END_LONG_DOUBLE_ROUNDING ();
+                      }
+                  }
 #  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-               else
+                else
 #  endif
 # endif
 # if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
-                 {
-                   double arg = a.arg[dp->arg_index].a.a_double;
-
-                   if (isnand (arg))
-                     {
-                       if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                         {
-                           *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
-                         }
-                       else
-                         {
-                           *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
-                         }
-                     }
-                   else
-                     {
-                       int sign = 0;
-
-                       if (signbit (arg)) /* arg < 0.0 or negative zero */
-                         {
-                           sign = -1;
-                           arg = -arg;
-                         }
-
-                       if (sign < 0)
-                         *p++ = '-';
-                       else if (flags & FLAG_SHOWSIGN)
-                         *p++ = '+';
-                       else if (flags & FLAG_SPACE)
-                         *p++ = ' ';
-
-                       if (arg > 0.0 && arg + arg == arg)
-                         {
-                           if (dp->conversion >= 'A' && dp->conversion <= 'Z')
-                             {
-                               *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
-                             }
-                           else
-                             {
-                               *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
-                             }
-                         }
-                       else
-                         {
+                  {
+                    double arg = a.arg[dp->arg_index].a.a_double;
+
+                    if (isnand (arg))
+                      {
+                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                          {
+                            *p++ = 'N'; *p++ = 'A'; *p++ = 'N';
+                          }
+                        else
+                          {
+                            *p++ = 'n'; *p++ = 'a'; *p++ = 'n';
+                          }
+                      }
+                    else
+                      {
+                        int sign = 0;
+
+                        if (signbit (arg)) /* arg < 0.0 or negative zero */
+                          {
+                            sign = -1;
+                            arg = -arg;
+                          }
+
+                        if (sign < 0)
+                          *p++ = '-';
+                        else if (flags & FLAG_SHOWSIGN)
+                          *p++ = '+';
+                        else if (flags & FLAG_SPACE)
+                          *p++ = ' ';
+
+                        if (arg > 0.0 && arg + arg == arg)
+                          {
+                            if (dp->conversion >= 'A' && dp->conversion <= 'Z')
+                              {
+                                *p++ = 'I'; *p++ = 'N'; *p++ = 'F';
+                              }
+                            else
+                              {
+                                *p++ = 'i'; *p++ = 'n'; *p++ = 'f';
+                              }
+                          }
+                        else
+                          {
 #  if NEED_PRINTF_DOUBLE
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               char *digits;
-                               size_t ndigits;
-
-                               digits =
-                                 scale10_round_decimal_double (arg, precision);
-                               if (digits == NULL)
-                                 goto out_of_memory;
-                               ndigits = strlen (digits);
-
-                               if (ndigits > precision)
-                                 do
-                                   {
-                                     --ndigits;
-                                     *p++ = digits[ndigits];
-                                   }
-                                 while (ndigits > precision);
-                               else
-                                 *p++ = '0';
-                               /* Here ndigits <= precision.  */
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > ndigits; precision--)
-                                     *p++ = '0';
-                                   while (ndigits > 0)
-                                     {
-                                       --ndigits;
-                                       *p++ = digits[ndigits];
-                                     }
-                                 }
-
-                               free (digits);
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               int exponent;
-
-                               if (arg == 0.0)
-                                 {
-                                   exponent = 0;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       for (; precision > 0; precision--)
-                                         *p++ = '0';
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)precision - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision + 1)
-                                         break;
-                                       if (ndigits < precision
-                                           || ndigits > precision + 2)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits == precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision+1.  */
-                                   if (is_borderline (digits, precision))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)precision - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision + 1)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision+1.  */
-
-                                   *p++ = digits[--ndigits];
-                                   if ((flags & FLAG_ALT) || precision > 0)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > 0)
-                                         {
-                                           --ndigits;
-                                           *p++ = digits[ndigits];
-                                         }
-                                     }
-
-                                   free (digits);
-                                 }
-
-                               *p++ = dp->conversion; /* 'e' or 'E' */
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                char *digits;
+                                size_t ndigits;
+
+                                digits =
+                                  scale10_round_decimal_double (arg, precision);
+                                if (digits == NULL)
+                                  goto out_of_memory;
+                                ndigits = strlen (digits);
+
+                                if (ndigits > precision)
+                                  do
+                                    {
+                                      --ndigits;
+                                      *p++ = digits[ndigits];
+                                    }
+                                  while (ndigits > precision);
+                                else
+                                  *p++ = '0';
+                                /* Here ndigits <= precision.  */
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > ndigits; precision--)
+                                      *p++ = '0';
+                                    while (ndigits > 0)
+                                      {
+                                        --ndigits;
+                                        *p++ = digits[ndigits];
+                                      }
+                                  }
+
+                                free (digits);
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                int exponent;
+
+                                if (arg == 0.0)
+                                  {
+                                    exponent = 0;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        for (; precision > 0; precision--)
+                                          *p++ = '0';
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)precision - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision + 1)
+                                          break;
+                                        if (ndigits < precision
+                                            || ndigits > precision + 2)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits == precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision+1.  */
+                                    if (is_borderline (digits, precision))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)precision - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision + 1)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision+1.  */
+
+                                    *p++ = digits[--ndigits];
+                                    if ((flags & FLAG_ALT) || precision > 0)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > 0)
+                                          {
+                                            --ndigits;
+                                            *p++ = digits[ndigits];
+                                          }
+                                      }
+
+                                    free (digits);
+                                  }
+
+                                *p++ = dp->conversion; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                               {
-                                 static const wchar_t decimal_format[] =
-                                   /* Produce the same number of exponent digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const wchar_t decimal_format[] =
+                                    /* Produce the same number of exponent digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   { '%', '+', '.', '3', 'd', '\0' };
+                                    { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                   { '%', '+', '.', '2', 'd', '\0' };
+                                    { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                               }
-                               while (*p != '\0')
-                                 p++;
+                                  SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                }
+                                while (*p != '\0')
+                                  p++;
 #   else
-                               {
-                                 static const char decimal_format[] =
-                                   /* Produce the same number of exponent digits
-                                      as the native printf implementation.  */
+                                {
+                                  static const char decimal_format[] =
+                                    /* Produce the same number of exponent digits
+                                       as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                   "%+.3d";
+                                    "%+.3d";
 #    else
-                                   "%+.2d";
+                                    "%+.2d";
 #    endif
-                                 if (sizeof (DCHAR_T) == 1)
-                                   {
-                                     sprintf ((char *) p, decimal_format, exponent);
-                                     while (*p != '\0')
-                                       p++;
-                                   }
-                                 else
-                                   {
-                                     char expbuf[6 + 1];
-                                     const char *ep;
-                                     sprintf (expbuf, decimal_format, exponent);
-                                     for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                       p++;
-                                   }
-                               }
+                                  if (sizeof (DCHAR_T) == 1)
+                                    {
+                                      sprintf ((char *) p, decimal_format, exponent);
+                                      while (*p != '\0')
+                                        p++;
+                                    }
+                                  else
+                                    {
+                                      char expbuf[6 + 1];
+                                      const char *ep;
+                                      sprintf (expbuf, decimal_format, exponent);
+                                      for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                        p++;
+                                    }
+                                }
 #   endif
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               if (precision == 0)
-                                 precision = 1;
-                               /* precision >= 1.  */
-
-                               if (arg == 0.0)
-                                 /* The exponent is 0, >= -4, < precision.
-                                    Use fixed-point notation.  */
-                                 {
-                                   size_t ndigits = precision;
-                                   /* Number of trailing zeroes that have to be
-                                      dropped.  */
-                                   size_t nzeroes =
-                                     (flags & FLAG_ALT ? 0 : precision - 1);
-
-                                   --ndigits;
-                                   *p++ = '0';
-                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                     {
-                                       *p++ = decimal_point_char ();
-                                       while (ndigits > nzeroes)
-                                         {
-                                           --ndigits;
-                                           *p++ = '0';
-                                         }
-                                     }
-                                 }
-                               else
-                                 {
-                                   /* arg > 0.0.  */
-                                   int exponent;
-                                   int adjusted;
-                                   char *digits;
-                                   size_t ndigits;
-                                   size_t nzeroes;
-
-                                   exponent = floorlog10 (arg);
-                                   adjusted = 0;
-                                   for (;;)
-                                     {
-                                       digits =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)(precision - 1) - exponent);
-                                       if (digits == NULL)
-                                         goto out_of_memory;
-                                       ndigits = strlen (digits);
-
-                                       if (ndigits == precision)
-                                         break;
-                                       if (ndigits < precision - 1
-                                           || ndigits > precision + 1)
-                                         /* The exponent was not guessed
-                                            precisely enough.  */
-                                         abort ();
-                                       if (adjusted)
-                                         /* None of two values of exponent is
-                                            the right one.  Prevent an endless
-                                            loop.  */
-                                         abort ();
-                                       free (digits);
-                                       if (ndigits < precision)
-                                         exponent -= 1;
-                                       else
-                                         exponent += 1;
-                                       adjusted = 1;
-                                     }
-                                   /* Here ndigits = precision.  */
-                                   if (is_borderline (digits, precision - 1))
-                                     {
-                                       /* Maybe the exponent guess was too high
-                                          and a smaller exponent can be reached
-                                          by turning a 10...0 into 9...9x.  */
-                                       char *digits2 =
-                                         scale10_round_decimal_double (arg,
-                                                                       (int)(precision - 1) - exponent + 1);
-                                       if (digits2 == NULL)
-                                         {
-                                           free (digits);
-                                           goto out_of_memory;
-                                         }
-                                       if (strlen (digits2) == precision)
-                                         {
-                                           free (digits);
-                                           digits = digits2;
-                                           exponent -= 1;
-                                         }
-                                       else
-                                         free (digits2);
-                                     }
-                                   /* Here ndigits = precision.  */
-
-                                   /* Determine the number of trailing zeroes
-                                      that have to be dropped.  */
-                                   nzeroes = 0;
-                                   if ((flags & FLAG_ALT) == 0)
-                                     while (nzeroes < ndigits
-                                            && digits[nzeroes] == '0')
-                                       nzeroes++;
-
-                                   /* The exponent is now determined.  */
-                                   if (exponent >= -4
-                                       && exponent < (long)precision)
-                                     {
-                                       /* Fixed-point notation:
-                                          max(exponent,0)+1 digits, then the
-                                          decimal point, then the remaining
-                                          digits without trailing zeroes.  */
-                                       if (exponent >= 0)
-                                         {
-                                           size_t count = exponent + 1;
-                                           /* Note: count <= precision = ndigits.  */
-                                           for (; count > 0; count--)
-                                             *p++ = digits[--ndigits];
-                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                             {
-                                               *p++ = decimal_point_char ();
-                                               while (ndigits > nzeroes)
-                                                 {
-                                                   --ndigits;
-                                                   *p++ = digits[ndigits];
-                                                 }
-                                             }
-                                         }
-                                       else
-                                         {
-                                           size_t count = -exponent - 1;
-                                           *p++ = '0';
-                                           *p++ = decimal_point_char ();
-                                           for (; count > 0; count--)
-                                             *p++ = '0';
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                     }
-                                   else
-                                     {
-                                       /* Exponential notation.  */
-                                       *p++ = digits[--ndigits];
-                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
-                                         {
-                                           *p++ = decimal_point_char ();
-                                           while (ndigits > nzeroes)
-                                             {
-                                               --ndigits;
-                                               *p++ = digits[ndigits];
-                                             }
-                                         }
-                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                if (precision == 0)
+                                  precision = 1;
+                                /* precision >= 1.  */
+
+                                if (arg == 0.0)
+                                  /* The exponent is 0, >= -4, < precision.
+                                     Use fixed-point notation.  */
+                                  {
+                                    size_t ndigits = precision;
+                                    /* Number of trailing zeroes that have to be
+                                       dropped.  */
+                                    size_t nzeroes =
+                                      (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                    --ndigits;
+                                    *p++ = '0';
+                                    if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                      {
+                                        *p++ = decimal_point_char ();
+                                        while (ndigits > nzeroes)
+                                          {
+                                            --ndigits;
+                                            *p++ = '0';
+                                          }
+                                      }
+                                  }
+                                else
+                                  {
+                                    /* arg > 0.0.  */
+                                    int exponent;
+                                    int adjusted;
+                                    char *digits;
+                                    size_t ndigits;
+                                    size_t nzeroes;
+
+                                    exponent = floorlog10 (arg);
+                                    adjusted = 0;
+                                    for (;;)
+                                      {
+                                        digits =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)(precision - 1) - exponent);
+                                        if (digits == NULL)
+                                          goto out_of_memory;
+                                        ndigits = strlen (digits);
+
+                                        if (ndigits == precision)
+                                          break;
+                                        if (ndigits < precision - 1
+                                            || ndigits > precision + 1)
+                                          /* The exponent was not guessed
+                                             precisely enough.  */
+                                          abort ();
+                                        if (adjusted)
+                                          /* None of two values of exponent is
+                                             the right one.  Prevent an endless
+                                             loop.  */
+                                          abort ();
+                                        free (digits);
+                                        if (ndigits < precision)
+                                          exponent -= 1;
+                                        else
+                                          exponent += 1;
+                                        adjusted = 1;
+                                      }
+                                    /* Here ndigits = precision.  */
+                                    if (is_borderline (digits, precision - 1))
+                                      {
+                                        /* Maybe the exponent guess was too high
+                                           and a smaller exponent can be reached
+                                           by turning a 10...0 into 9...9x.  */
+                                        char *digits2 =
+                                          scale10_round_decimal_double (arg,
+                                                                        (int)(precision - 1) - exponent + 1);
+                                        if (digits2 == NULL)
+                                          {
+                                            free (digits);
+                                            goto out_of_memory;
+                                          }
+                                        if (strlen (digits2) == precision)
+                                          {
+                                            free (digits);
+                                            digits = digits2;
+                                            exponent -= 1;
+                                          }
+                                        else
+                                          free (digits2);
+                                      }
+                                    /* Here ndigits = precision.  */
+
+                                    /* Determine the number of trailing zeroes
+                                       that have to be dropped.  */
+                                    nzeroes = 0;
+                                    if ((flags & FLAG_ALT) == 0)
+                                      while (nzeroes < ndigits
+                                             && digits[nzeroes] == '0')
+                                        nzeroes++;
+
+                                    /* The exponent is now determined.  */
+                                    if (exponent >= -4
+                                        && exponent < (long)precision)
+                                      {
+                                        /* Fixed-point notation:
+                                           max(exponent,0)+1 digits, then the
+                                           decimal point, then the remaining
+                                           digits without trailing zeroes.  */
+                                        if (exponent >= 0)
+                                          {
+                                            size_t count = exponent + 1;
+                                            /* Note: count <= precision = ndigits.  */
+                                            for (; count > 0; count--)
+                                              *p++ = digits[--ndigits];
+                                            if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                              {
+                                                *p++ = decimal_point_char ();
+                                                while (ndigits > nzeroes)
+                                                  {
+                                                    --ndigits;
+                                                    *p++ = digits[ndigits];
+                                                  }
+                                              }
+                                          }
+                                        else
+                                          {
+                                            size_t count = -exponent - 1;
+                                            *p++ = '0';
+                                            *p++ = decimal_point_char ();
+                                            for (; count > 0; count--)
+                                              *p++ = '0';
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                      }
+                                    else
+                                      {
+                                        /* Exponential notation.  */
+                                        *p++ = digits[--ndigits];
+                                        if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                          {
+                                            *p++ = decimal_point_char ();
+                                            while (ndigits > nzeroes)
+                                              {
+                                                --ndigits;
+                                                *p++ = digits[ndigits];
+                                              }
+                                          }
+                                        *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
 #   if WIDE_CHAR_VERSION
-                                       {
-                                         static const wchar_t decimal_format[] =
-                                           /* Produce the same number of exponent digits
-                                              as the native printf implementation.  */
+                                        {
+                                          static const wchar_t decimal_format[] =
+                                            /* Produce the same number of exponent digits
+                                               as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           { '%', '+', '.', '3', 'd', '\0' };
+                                            { '%', '+', '.', '3', 'd', '\0' };
 #    else
-                                           { '%', '+', '.', '2', 'd', '\0' };
+                                            { '%', '+', '.', '2', 'd', '\0' };
 #    endif
-                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
-                                       }
-                                       while (*p != '\0')
-                                         p++;
+                                          SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                        }
+                                        while (*p != '\0')
+                                          p++;
 #   else
-                                       {
-                                         static const char decimal_format[] =
-                                           /* Produce the same number of exponent digits
-                                              as the native printf implementation.  */
+                                        {
+                                          static const char decimal_format[] =
+                                            /* Produce the same number of exponent digits
+                                               as the native printf implementation.  */
 #    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                                           "%+.3d";
+                                            "%+.3d";
 #    else
-                                           "%+.2d";
+                                            "%+.2d";
 #    endif
-                                         if (sizeof (DCHAR_T) == 1)
-                                           {
-                                             sprintf ((char *) p, decimal_format, exponent);
-                                             while (*p != '\0')
-                                               p++;
-                                           }
-                                         else
-                                           {
-                                             char expbuf[6 + 1];
-                                             const char *ep;
-                                             sprintf (expbuf, decimal_format, exponent);
-                                             for (ep = expbuf; (*p = *ep) != '\0'; ep++)
-                                               p++;
-                                           }
-                                       }
+                                          if (sizeof (DCHAR_T) == 1)
+                                            {
+                                              sprintf ((char *) p, decimal_format, exponent);
+                                              while (*p != '\0')
+                                                p++;
+                                            }
+                                          else
+                                            {
+                                              char expbuf[6 + 1];
+                                              const char *ep;
+                                              sprintf (expbuf, decimal_format, exponent);
+                                              for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                                p++;
+                                            }
+                                        }
 #   endif
-                                     }
+                                      }
 
-                                   free (digits);
-                                 }
-                             }
-                           else
-                             abort ();
+                                    free (digits);
+                                  }
+                              }
+                            else
+                              abort ();
 #  else
-                           /* arg is finite.  */
-                           if (!(arg == 0.0))
-                             abort ();
-
-                           pad_ptr = p;
-
-                           if (dp->conversion == 'f' || dp->conversion == 'F')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else if (dp->conversion == 'e' || dp->conversion == 'E')
-                             {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
-                                 {
-                                   *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
-                                     *p++ = '0';
-                                 }
-                               *p++ = dp->conversion; /* 'e' or 'E' */
-                               *p++ = '+';
-                               /* Produce the same number of exponent digits as
-                                  the native printf implementation.  */
+                            /* arg is finite.  */
+                            if (!(arg == 0.0))
+                              abort ();
+
+                            pad_ptr = p;
+
+                            if (dp->conversion == 'f' || dp->conversion == 'F')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else if (dp->conversion == 'e' || dp->conversion == 'E')
+                              {
+                                *p++ = '0';
+                                if ((flags & FLAG_ALT) || precision > 0)
+                                  {
+                                    *p++ = decimal_point_char ();
+                                    for (; precision > 0; precision--)
+                                      *p++ = '0';
+                                  }
+                                *p++ = dp->conversion; /* 'e' or 'E' */
+                                *p++ = '+';
+                                /* Produce the same number of exponent digits as
+                                   the native printf implementation.  */
 #   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                               *p++ = '0';
+                                *p++ = '0';
 #   endif
-                               *p++ = '0';
-                               *p++ = '0';
-                             }
-                           else if (dp->conversion == 'g' || dp->conversion == 'G')
-                             {
-                               *p++ = '0';
-                               if (flags & FLAG_ALT)
-                                 {
-                                   size_t ndigits =
-                                     (precision > 0 ? precision - 1 : 0);
-                                   *p++ = decimal_point_char ();
-                                   for (; ndigits > 0; --ndigits)
-                                     *p++ = '0';
-                                 }
-                             }
-                           else
-                             abort ();
+                                *p++ = '0';
+                                *p++ = '0';
+                              }
+                            else if (dp->conversion == 'g' || dp->conversion == 'G')
+                              {
+                                *p++ = '0';
+                                if (flags & FLAG_ALT)
+                                  {
+                                    size_t ndigits =
+                                      (precision > 0 ? precision - 1 : 0);
+                                    *p++ = decimal_point_char ();
+                                    for (; ndigits > 0; --ndigits)
+                                      *p++ = '0';
+                                  }
+                              }
+                            else
+                              abort ();
 #  endif
-                         }
-                     }
-                 }
+                          }
+                      }
+                  }
 # endif
 
-               /* The generated string now extends from tmp to p, with the
-                  zero padding insertion point being at pad_ptr.  */
-               if (has_width && p - tmp < width)
-                 {
-                   size_t pad = width - (p - tmp);
-                   DCHAR_T *end = p + pad;
-
-                   if (flags & FLAG_LEFT)
-                     {
-                       /* Pad with spaces on the right.  */
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-                   else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                     {
-                       /* Pad with zeroes.  */
-                       DCHAR_T *q = end;
-
-                       while (p > pad_ptr)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = '0';
-                     }
-                   else
-                     {
-                       /* Pad with spaces on the left.  */
-                       DCHAR_T *q = end;
-
-                       while (p > tmp)
-                         *--q = *--p;
-                       for (; pad > 0; pad--)
-                         *p++ = ' ';
-                     }
-
-                   p = end;
-                 }
-
-               {
-                 size_t count = p - tmp;
-
-                 if (count >= tmp_length)
-                   /* tmp_length was incorrectly calculated - fix the
-                      code above!  */
-                   abort ();
-
-                 /* Make room for the result.  */
-                 if (count >= allocated - length)
-                   {
-                     size_t n = xsum (length, count);
-
-                     ENSURE_ALLOCATION (n);
-                   }
-
-                 /* Append the result.  */
-                 memcpy (result + length, tmp, count * sizeof (DCHAR_T));
-                 if (tmp != tmpbuf)
-                   free (tmp);
-                 length += count;
-               }
-             }
+                /* The generated string now extends from tmp to p, with the
+                   zero padding insertion point being at pad_ptr.  */
+                if (has_width && p - tmp < width)
+                  {
+                    size_t pad = width - (p - tmp);
+                    DCHAR_T *end = p + pad;
+
+                    if (flags & FLAG_LEFT)
+                      {
+                        /* Pad with spaces on the right.  */
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+                    else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                      {
+                        /* Pad with zeroes.  */
+                        DCHAR_T *q = end;
+
+                        while (p > pad_ptr)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = '0';
+                      }
+                    else
+                      {
+                        /* Pad with spaces on the left.  */
+                        DCHAR_T *q = end;
+
+                        while (p > tmp)
+                          *--q = *--p;
+                        for (; pad > 0; pad--)
+                          *p++ = ' ';
+                      }
+
+                    p = end;
+                  }
+
+                {
+                  size_t count = p - tmp;
+
+                  if (count >= tmp_length)
+                    /* tmp_length was incorrectly calculated - fix the
+                       code above!  */
+                    abort ();
+
+                  /* Make room for the result.  */
+                  if (count >= allocated - length)
+                    {
+                      size_t n = xsum (length, count);
+
+                      ENSURE_ALLOCATION (n);
+                    }
+
+                  /* Append the result.  */
+                  memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                  if (tmp != tmpbuf)
+                    free (tmp);
+                  length += count;
+                }
+              }
 #endif
-           else
-             {
-               arg_type type = a.arg[dp->arg_index].type;
-               int flags = dp->flags;
+            else
+              {
+                arg_type type = a.arg[dp->arg_index].type;
+                int flags = dp->flags;
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_width;
-               size_t width;
+                int has_width;
+                size_t width;
 #endif
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               int has_precision;
-               size_t precision;
+                int has_precision;
+                size_t precision;
 #endif
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               int prec_ourselves;
+                int prec_ourselves;
 #else
-#              define prec_ourselves 0
+#               define prec_ourselves 0
 #endif
 #if NEED_PRINTF_FLAG_LEFTADJUST
-#              define pad_ourselves 1
+#               define pad_ourselves 1
 #elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               int pad_ourselves;
+                int pad_ourselves;
 #else
-#              define pad_ourselves 0
+#               define pad_ourselves 0
 #endif
-               TCHAR_T *fbp;
-               unsigned int prefix_count;
-               int prefixes[2] IF_LINT (= { 0 });
+                TCHAR_T *fbp;
+                unsigned int prefix_count;
+                int prefixes[2] IF_LINT (= { 0 });
 #if !USE_SNPRINTF
-               size_t tmp_length;
-               TCHAR_T tmpbuf[700];
-               TCHAR_T *tmp;
+                size_t tmp_length;
+                TCHAR_T tmpbuf[700];
+                TCHAR_T *tmp;
 #endif
 
 #if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-               has_width = 0;
-               width = 0;
-               if (dp->width_start != dp->width_end)
-                 {
-                   if (dp->width_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->width_arg_index].a.a_int;
-                       if (arg < 0)
-                         {
-                           /* "A negative field width is taken as a '-' flag
-                               followed by a positive field width."  */
-                           flags |= FLAG_LEFT;
-                           width = (unsigned int) (-arg);
-                         }
-                       else
-                         width = arg;
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->width_start;
-
-                       do
-                         width = xsum (xtimes (width, 10), *digitp++ - '0');
-                       while (digitp != dp->width_end);
-                     }
-                   has_width = 1;
-                 }
+                has_width = 0;
+                width = 0;
+                if (dp->width_start != dp->width_end)
+                  {
+                    if (dp->width_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->width_arg_index].a.a_int;
+                        if (arg < 0)
+                          {
+                            /* "A negative field width is taken as a '-' flag
+                                followed by a positive field width."  */
+                            flags |= FLAG_LEFT;
+                            width = (unsigned int) (-arg);
+                          }
+                        else
+                          width = arg;
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->width_start;
+
+                        do
+                          width = xsum (xtimes (width, 10), *digitp++ - '0');
+                        while (digitp != dp->width_end);
+                      }
+                    has_width = 1;
+                  }
 #endif
 
 #if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
-               has_precision = 0;
-               precision = 6;
-               if (dp->precision_start != dp->precision_end)
-                 {
-                   if (dp->precision_arg_index != ARG_NONE)
-                     {
-                       int arg;
-
-                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                         abort ();
-                       arg = a.arg[dp->precision_arg_index].a.a_int;
-                       /* "A negative precision is taken as if the precision
-                           were omitted."  */
-                       if (arg >= 0)
-                         {
-                           precision = arg;
-                           has_precision = 1;
-                         }
-                     }
-                   else
-                     {
-                       const FCHAR_T *digitp = dp->precision_start + 1;
-
-                       precision = 0;
-                       while (digitp != dp->precision_end)
-                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       has_precision = 1;
-                     }
-                 }
+                has_precision = 0;
+                precision = 6;
+                if (dp->precision_start != dp->precision_end)
+                  {
+                    if (dp->precision_arg_index != ARG_NONE)
+                      {
+                        int arg;
+
+                        if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                          abort ();
+                        arg = a.arg[dp->precision_arg_index].a.a_int;
+                        /* "A negative precision is taken as if the precision
+                            were omitted."  */
+                        if (arg >= 0)
+                          {
+                            precision = arg;
+                            has_precision = 1;
+                          }
+                      }
+                    else
+                      {
+                        const FCHAR_T *digitp = dp->precision_start + 1;
+
+                        precision = 0;
+                        while (digitp != dp->precision_end)
+                          precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                        has_precision = 1;
+                      }
+                  }
 #endif
 
-               /* Decide whether to handle the precision ourselves.  */
+                /* Decide whether to handle the precision ourselves.  */
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-               switch (dp->conversion)
-                 {
-                 case 'd': case 'i': case 'u':
-                 case 'o':
-                 case 'x': case 'X': case 'p':
-                   prec_ourselves = has_precision && (precision > 0);
-                   break;
-                 default:
-                   prec_ourselves = 0;
-                   break;
-                 }
+                switch (dp->conversion)
+                  {
+                  case 'd': case 'i': case 'u':
+                  case 'o':
+                  case 'x': case 'X': case 'p':
+                    prec_ourselves = has_precision && (precision > 0);
+                    break;
+                  default:
+                    prec_ourselves = 0;
+                    break;
+                  }
 #endif
 
-               /* Decide whether to perform the padding ourselves.  */
+                /* Decide whether to perform the padding ourselves.  */
 #if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
-               switch (dp->conversion)
-                 {
+                switch (dp->conversion)
+                  {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
-                    to perform the padding after this conversion.  Functions
-                    with unistdio extensions perform the padding based on
-                    character count rather than element count.  */
-                 case 'c': case 's':
+                  /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
+                     to perform the padding after this conversion.  Functions
+                     with unistdio extensions perform the padding based on
+                     character count rather than element count.  */
+                  case 'c': case 's':
 # endif
 # if NEED_PRINTF_FLAG_ZERO
-                 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
-                 case 'a': case 'A':
+                  case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
+                  case 'a': case 'A':
 # endif
-                   pad_ourselves = 1;
-                   break;
-                 default:
-                   pad_ourselves = prec_ourselves;
-                   break;
-                 }
+                    pad_ourselves = 1;
+                    break;
+                  default:
+                    pad_ourselves = prec_ourselves;
+                    break;
+                  }
 #endif
 
 #if !USE_SNPRINTF
-               /* Allocate a temporary buffer of sufficient size for calling
-                  sprintf.  */
-               {
-                 switch (dp->conversion)
-                   {
+                /* Allocate a temporary buffer of sufficient size for calling
+                   sprintf.  */
+                {
+                  switch (dp->conversion)
+                    {
 
-                   case 'd': case 'i': case 'u':
+                    case 'd': case 'i': case 'u':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.30103 /* binary -> decimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Multiply by 2, as an estimate for FLAG_GROUP.  */
-                     tmp_length = xsum (tmp_length, tmp_length);
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'o':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.30103 /* binary -> decimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Multiply by 2, as an estimate for FLAG_GROUP.  */
+                      tmp_length = xsum (tmp_length, tmp_length);
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'o':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.333334 /* binary -> octal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 1, to account for a leading sign.  */
-                     tmp_length = xsum (tmp_length, 1);
-                     break;
-
-                   case 'x': case 'X':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.333334 /* binary -> octal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 1, to account for a leading sign.  */
+                      tmp_length = xsum (tmp_length, 1);
+                      break;
+
+                    case 'x': case 'X':
 # if HAVE_LONG_LONG_INT
-                     if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
+                      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
 # endif
-                     if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned long) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (sizeof (unsigned int) * CHAR_BIT
-                                         * 0.25 /* binary -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Add 2, to account for a leading sign or alternate form.  */
-                     tmp_length = xsum (tmp_length, 2);
-                     break;
-
-                   case 'f': case 'F':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_MAX_EXP
-                                         * 0.30103 /* binary -> decimal */
-                                         * 2 /* estimate for FLAG_GROUP */
-                                        )
-                         + 1 /* turn floor into ceil */
-                         + 10; /* sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'e': case 'E': case 'g': case 'G':
-                     tmp_length =
-                       12; /* sign, decimal point, exponent etc. */
-                     tmp_length = xsum (tmp_length, precision);
-                     break;
-
-                   case 'a': case 'A':
-                     if (type == TYPE_LONGDOUBLE)
-                       tmp_length =
-                         (unsigned int) (LDBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     else
-                       tmp_length =
-                         (unsigned int) (DBL_DIG
-                                         * 0.831 /* decimal -> hexadecimal */
-                                        )
-                         + 1; /* turn floor into ceil */
-                     if (tmp_length < precision)
-                       tmp_length = precision;
-                     /* Account for sign, decimal point etc. */
-                     tmp_length = xsum (tmp_length, 12);
-                     break;
-
-                   case 'c':
+                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned long) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (sizeof (unsigned int) * CHAR_BIT
+                                          * 0.25 /* binary -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Add 2, to account for a leading sign or alternate form.  */
+                      tmp_length = xsum (tmp_length, 2);
+                      break;
+
+                    case 'f': case 'F':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_MAX_EXP
+                                          * 0.30103 /* binary -> decimal */
+                                          * 2 /* estimate for FLAG_GROUP */
+                                         )
+                          + 1 /* turn floor into ceil */
+                          + 10; /* sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'e': case 'E': case 'g': case 'G':
+                      tmp_length =
+                        12; /* sign, decimal point, exponent etc. */
+                      tmp_length = xsum (tmp_length, precision);
+                      break;
+
+                    case 'a': case 'A':
+                      if (type == TYPE_LONGDOUBLE)
+                        tmp_length =
+                          (unsigned int) (LDBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      else
+                        tmp_length =
+                          (unsigned int) (DBL_DIG
+                                          * 0.831 /* decimal -> hexadecimal */
+                                         )
+                          + 1; /* turn floor into ceil */
+                      if (tmp_length < precision)
+                        tmp_length = precision;
+                      /* Account for sign, decimal point etc. */
+                      tmp_length = xsum (tmp_length, 12);
+                      break;
+
+                    case 'c':
 # if HAVE_WINT_T && !WIDE_CHAR_VERSION
-                     if (type == TYPE_WIDE_CHAR)
-                       tmp_length = MB_CUR_MAX;
-                     else
+                      if (type == TYPE_WIDE_CHAR)
+                        tmp_length = MB_CUR_MAX;
+                      else
 # endif
-                       tmp_length = 1;
-                     break;
+                        tmp_length = 1;
+                      break;
 
-                   case 's':
+                    case 's':
 # if HAVE_WCHAR_T
-                     if (type == TYPE_WIDE_STRING)
-                       {
+                      if (type == TYPE_WIDE_STRING)
+                        {
 #  if WIDE_CHAR_VERSION
-                         /* ISO C says about %ls in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the array, the array shall
-                               contain a null wide character."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         const wchar_t *arg =
-                           a.arg[dp->arg_index].a.a_wide_string;
-
-                         if (has_precision)
-                           tmp_length = local_wcsnlen (arg, precision);
-                         else
-                           tmp_length = local_wcslen (arg);
+                          /* ISO C says about %ls in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the array, the array shall
+                                contain a null wide character."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          const wchar_t *arg =
+                            a.arg[dp->arg_index].a.a_wide_string;
+
+                          if (has_precision)
+                            tmp_length = local_wcsnlen (arg, precision);
+                          else
+                            tmp_length = local_wcslen (arg);
 #  else
-                         /* ISO C says about %ls in fprintf:
-                              "If a precision is specified, no more than that
-                               many bytes are written (including shift
-                               sequences, if any), and the array shall contain
-                               a null wide character if, to equal the
-                               multibyte character sequence length given by
-                               the precision, the function would need to
-                               access a wide character one past the end of the
-                               array."
-                            So if there is a precision, we must not use
-                            wcslen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %ls in fprintf:
+                               "If a precision is specified, no more than that
+                                many bytes are written (including shift
+                                sequences, if any), and the array shall contain
+                                a null wide character if, to equal the
+                                multibyte character sequence length given by
+                                the precision, the function would need to
+                                access a wide character one past the end of the
+                                array."
+                             So if there is a precision, we must not use
+                             wcslen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 #  endif
-                       }
-                     else
+                        }
+                      else
 # endif
-                       {
+                        {
 # if WIDE_CHAR_VERSION
-                         /* ISO C says about %s in fwprintf:
-                              "If the precision is not specified or is greater
-                               than the size of the converted array, the
-                               converted array shall contain a null wide
-                               character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         /* This case has already been handled above.  */
-                         abort ();
+                          /* ISO C says about %s in fwprintf:
+                               "If the precision is not specified or is greater
+                                than the size of the converted array, the
+                                converted array shall contain a null wide
+                                character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          /* This case has already been handled above.  */
+                          abort ();
 # else
-                         /* ISO C says about %s in fprintf:
-                              "If the precision is not specified or greater
-                               than the size of the array, the array shall
-                               contain a null character."
-                            So if there is a precision, we must not use
-                            strlen.  */
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-
-                         if (has_precision)
-                           tmp_length = local_strnlen (arg, precision);
-                         else
-                           tmp_length = strlen (arg);
+                          /* ISO C says about %s in fprintf:
+                               "If the precision is not specified or greater
+                                than the size of the array, the array shall
+                                contain a null character."
+                             So if there is a precision, we must not use
+                             strlen.  */
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+
+                          if (has_precision)
+                            tmp_length = local_strnlen (arg, precision);
+                          else
+                            tmp_length = strlen (arg);
 # endif
-                       }
-                     break;
-
-                   case 'p':
-                     tmp_length =
-                       (unsigned int) (sizeof (void *) * CHAR_BIT
-                                       * 0.25 /* binary -> hexadecimal */
-                                      )
-                         + 1 /* turn floor into ceil */
-                         + 2; /* account for leading 0x */
-                     break;
-
-                   default:
-                     abort ();
-                   }
-
-                 if (!pad_ourselves)
-                   {
+                        }
+                      break;
+
+                    case 'p':
+                      tmp_length =
+                        (unsigned int) (sizeof (void *) * CHAR_BIT
+                                        * 0.25 /* binary -> hexadecimal */
+                                       )
+                          + 1 /* turn floor into ceil */
+                          + 2; /* account for leading 0x */
+                      break;
+
+                    default:
+                      abort ();
+                    }
+
+                  if (!pad_ourselves)
+                    {
 # if ENABLE_UNISTDIO
-                     /* Padding considers the number of characters, therefore
-                        the number of elements after padding may be
-                          > max (tmp_length, width)
-                        but is certainly
-                          <= tmp_length + width.  */
-                     tmp_length = xsum (tmp_length, width);
+                      /* Padding considers the number of characters, therefore
+                         the number of elements after padding may be
+                           > max (tmp_length, width)
+                         but is certainly
+                           <= tmp_length + width.  */
+                      tmp_length = xsum (tmp_length, width);
 # else
-                     /* Padding considers the number of elements,
-                        says POSIX.  */
-                     if (tmp_length < width)
-                       tmp_length = width;
+                      /* Padding considers the number of elements,
+                         says POSIX.  */
+                      if (tmp_length < width)
+                        tmp_length = width;
 # endif
-                   }
-
-                 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
-               }
-
-               if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
-                 tmp = tmpbuf;
-               else
-                 {
-                   size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
-
-                   if (size_overflow_p (tmp_memsize))
-                     /* Overflow, would lead to out of memory.  */
-                     goto out_of_memory;
-                   tmp = (TCHAR_T *) malloc (tmp_memsize);
-                   if (tmp == NULL)
-                     /* Out of memory.  */
-                     goto out_of_memory;
-                 }
+                    }
+
+                  tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
+                }
+
+                if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T))
+                  tmp = tmpbuf;
+                else
+                  {
+                    size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T));
+
+                    if (size_overflow_p (tmp_memsize))
+                      /* Overflow, would lead to out of memory.  */
+                      goto out_of_memory;
+                    tmp = (TCHAR_T *) malloc (tmp_memsize);
+                    if (tmp == NULL)
+                      /* Out of memory.  */
+                      goto out_of_memory;
+                  }
 #endif
 
-               /* Construct the format string for calling snprintf or
-                  sprintf.  */
-               fbp = buf;
-               *fbp++ = '%';
+                /* Construct the format string for calling snprintf or
+                   sprintf.  */
+                fbp = buf;
+                *fbp++ = '%';
 #if NEED_PRINTF_FLAG_GROUPING
-               /* The underlying implementation doesn't support the ' flag.
-                  Produce no grouping characters in this case; this is
-                  acceptable because the grouping is locale dependent.  */
+                /* The underlying implementation doesn't support the ' flag.
+                   Produce no grouping characters in this case; this is
+                   acceptable because the grouping is locale dependent.  */
 #else
-               if (flags & FLAG_GROUP)
-                 *fbp++ = '\'';
+                if (flags & FLAG_GROUP)
+                  *fbp++ = '\'';
 #endif
-               if (flags & FLAG_LEFT)
-                 *fbp++ = '-';
-               if (flags & FLAG_SHOWSIGN)
-                 *fbp++ = '+';
-               if (flags & FLAG_SPACE)
-                 *fbp++ = ' ';
-               if (flags & FLAG_ALT)
-                 *fbp++ = '#';
-               if (!pad_ourselves)
-                 {
-                   if (flags & FLAG_ZERO)
-                     *fbp++ = '0';
-                   if (dp->width_start != dp->width_end)
-                     {
-                       size_t n = dp->width_end - dp->width_start;
-                       /* The width specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->width_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-               if (!prec_ourselves)
-                 {
-                   if (dp->precision_start != dp->precision_end)
-                     {
-                       size_t n = dp->precision_end - dp->precision_start;
-                       /* The precision specification is known to consist only
-                          of standard ASCII characters.  */
-                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
-                         {
-                           memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
-                           fbp += n;
-                         }
-                       else
-                         {
-                           const FCHAR_T *mp = dp->precision_start;
-                           do
-                             *fbp++ = (unsigned char) *mp++;
-                           while (--n > 0);
-                         }
-                     }
-                 }
-
-               switch (type)
-                 {
+                if (flags & FLAG_LEFT)
+                  *fbp++ = '-';
+                if (flags & FLAG_SHOWSIGN)
+                  *fbp++ = '+';
+                if (flags & FLAG_SPACE)
+                  *fbp++ = ' ';
+                if (flags & FLAG_ALT)
+                  *fbp++ = '#';
+                if (!pad_ourselves)
+                  {
+                    if (flags & FLAG_ZERO)
+                      *fbp++ = '0';
+                    if (dp->width_start != dp->width_end)
+                      {
+                        size_t n = dp->width_end - dp->width_start;
+                        /* The width specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->width_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+                if (!prec_ourselves)
+                  {
+                    if (dp->precision_start != dp->precision_end)
+                      {
+                        size_t n = dp->precision_end - dp->precision_start;
+                        /* The precision specification is known to consist only
+                           of standard ASCII characters.  */
+                        if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                          {
+                            memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
+                            fbp += n;
+                          }
+                        else
+                          {
+                            const FCHAR_T *mp = dp->precision_start;
+                            do
+                              *fbp++ = (unsigned char) *mp++;
+                            while (--n > 0);
+                          }
+                      }
+                  }
+
+                switch (type)
+                  {
 #if HAVE_LONG_LONG_INT
-                 case TYPE_LONGLONGINT:
-                 case TYPE_ULONGLONGINT:
+                  case TYPE_LONGLONGINT:
+                  case TYPE_ULONGLONGINT:
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                   *fbp++ = 'I';
-                   *fbp++ = '6';
-                   *fbp++ = '4';
-                   break;
+                    *fbp++ = 'I';
+                    *fbp++ = '6';
+                    *fbp++ = '4';
+                    break;
 # else
-                   *fbp++ = 'l';
-                   /*FALLTHROUGH*/
+                    *fbp++ = 'l';
+                    /*FALLTHROUGH*/
 # endif
 #endif
-                 case TYPE_LONGINT:
-                 case TYPE_ULONGINT:
+                  case TYPE_LONGINT:
+                  case TYPE_ULONGINT:
 #if HAVE_WINT_T
-                 case TYPE_WIDE_CHAR:
+                  case TYPE_WIDE_CHAR:
 #endif
 #if HAVE_WCHAR_T
-                 case TYPE_WIDE_STRING:
+                  case TYPE_WIDE_STRING:
 #endif
-                   *fbp++ = 'l';
-                   break;
-                 case TYPE_LONGDOUBLE:
-                   *fbp++ = 'L';
-                   break;
-                 default:
-                   break;
-                 }
+                    *fbp++ = 'l';
+                    break;
+                  case TYPE_LONGDOUBLE:
+                    *fbp++ = 'L';
+                    break;
+                  default:
+                    break;
+                  }
 #if NEED_PRINTF_DIRECTIVE_F
-               if (dp->conversion == 'F')
-                 *fbp = 'f';
-               else
+                if (dp->conversion == 'F')
+                  *fbp = 'f';
+                else
 #endif
-                 *fbp = dp->conversion;
+                  *fbp = dp->conversion;
 #if USE_SNPRINTF
 # if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-               fbp[1] = '%';
-               fbp[2] = 'n';
-               fbp[3] = '\0';
+                fbp[1] = '%';
+                fbp[2] = 'n';
+                fbp[3] = '\0';
 # else
-               /* On glibc2 systems from glibc >= 2.3 - probably also older
-                  ones - we know that snprintf's returns value conforms to
-                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
-                  Therefore we can avoid using %n in this situation.
-                  On glibc2 systems from 2004-10-18 or newer, the use of %n
-                  in format strings in writable memory may crash the program
-                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
-                  in this situation.  */
-               /* On native Win32 systems (such as mingw), we can avoid using
-                  %n because:
-                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
-                      snprintf does not write more than the specified number
-                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
-                      '4', '5', '6' into buf, not '4', '5', '\0'.)
-                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
-                      allows us to recognize the case of an insufficient
-                      buffer size: it returns -1 in this case.
-                  On native Win32 systems (such as mingw) where the OS is
-                  Windows Vista, the use of %n in format strings by default
-                  crashes the program. See
-                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
-                    <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
-                  So we should avoid %n in this situation.  */
-               fbp[1] = '\0';
+                /* On glibc2 systems from glibc >= 2.3 - probably also older
+                   ones - we know that snprintf's returns value conforms to
+                   ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
+                   Therefore we can avoid using %n in this situation.
+                   On glibc2 systems from 2004-10-18 or newer, the use of %n
+                   in format strings in writable memory may crash the program
+                   (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+                   in this situation.  */
+                /* On native Win32 systems (such as mingw), we can avoid using
+                   %n because:
+                     - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+                       snprintf does not write more than the specified number
+                       of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+                       '4', '5', '6' into buf, not '4', '5', '\0'.)
+                     - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+                       allows us to recognize the case of an insufficient
+                       buffer size: it returns -1 in this case.
+                   On native Win32 systems (such as mingw) where the OS is
+                   Windows Vista, the use of %n in format strings by default
+                   crashes the program. See
+                     <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+                     <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
+                   So we should avoid %n in this situation.  */
+                fbp[1] = '\0';
 # endif
 #else
-               fbp[1] = '\0';
+                fbp[1] = '\0';
 #endif
 
-               /* Construct the arguments for calling snprintf or sprintf.  */
-               prefix_count = 0;
-               if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
-                 }
-               if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
-                 {
-                   if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                     abort ();
-                   prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
-                 }
+                /* Construct the arguments for calling snprintf or sprintf.  */
+                prefix_count = 0;
+                if (!pad_ourselves && dp->width_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
+                  }
+                if (!prec_ourselves && dp->precision_arg_index != ARG_NONE)
+                  {
+                    if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                      abort ();
+                    prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
+                  }
 
 #if USE_SNPRINTF
-               /* The SNPRINTF result is appended after result[0..length].
-                  The latter is an array of DCHAR_T; SNPRINTF appends an
-                  array of TCHAR_T to it.  This is possible because
-                  sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
-                  alignof (TCHAR_T) <= alignof (DCHAR_T).  */
+                /* The SNPRINTF result is appended after result[0..length].
+                   The latter is an array of DCHAR_T; SNPRINTF appends an
+                   array of TCHAR_T to it.  This is possible because
+                   sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
+                   alignof (TCHAR_T) <= alignof (DCHAR_T).  */
 # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
-               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
-                  where an snprintf() with maxlen==1 acts like sprintf().  */
-               ENSURE_ALLOCATION (xsum (length,
-                                        (2 + TCHARS_PER_DCHAR - 1)
-                                        / TCHARS_PER_DCHAR));
-               /* Prepare checking whether snprintf returns the count
-                  via %n.  */
-               *(TCHAR_T *) (result + length) = '\0';
+                /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
+                   where an snprintf() with maxlen==1 acts like sprintf().  */
+                ENSURE_ALLOCATION (xsum (length,
+                                         (2 + TCHARS_PER_DCHAR - 1)
+                                         / TCHARS_PER_DCHAR));
+                /* Prepare checking whether snprintf returns the count
+                   via %n.  */
+                *(TCHAR_T *) (result + length) = '\0';
 #endif
 
-               for (;;)
-                 {
-                   int count = -1;
+                for (;;)
+                  {
+                    int count = -1;
 
 #if USE_SNPRINTF
-                   int retcount = 0;
-                   size_t maxlen = allocated - length;
-                   /* SNPRINTF can fail if its second argument is
-                      > INT_MAX.  */
-                   if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
-                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
-                   maxlen = maxlen * TCHARS_PER_DCHAR;
+                    int retcount = 0;
+                    size_t maxlen = allocated - length;
+                    /* SNPRINTF can fail if its second argument is
+                       > INT_MAX.  */
+                    if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
+                      maxlen = INT_MAX / TCHARS_PER_DCHAR;
+                    maxlen = maxlen * TCHARS_PER_DCHAR;
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            arg, &count);                  \
-                       break;                                              \
-                     case 1:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], arg, &count);     \
-                       break;                                              \
-                     case 2:                                               \
-                       retcount = SNPRINTF ((TCHAR_T *) (result + length), \
-                                            maxlen, buf,                   \
-                                            prefixes[0], prefixes[1], arg, \
-                                            &count);                       \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             arg, &count);                  \
+                        break;                                              \
+                      case 1:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], arg, &count);     \
+                        break;                                              \
+                      case 2:                                               \
+                        retcount = SNPRINTF ((TCHAR_T *) (result + length), \
+                                             maxlen, buf,                   \
+                                             prefixes[0], prefixes[1], arg, \
+                                             &count);                       \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #else
 # define SNPRINTF_BUF(arg) \
-                   switch (prefix_count)                                   \
-                     {                                                     \
-                     case 0:                                               \
-                       count = sprintf (tmp, buf, arg);                    \
-                       break;                                              \
-                     case 1:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], arg);       \
-                       break;                                              \
-                     case 2:                                               \
-                       count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
-                                        arg);                              \
-                       break;                                              \
-                     default:                                              \
-                       abort ();                                           \
-                     }
+                    switch (prefix_count)                                   \
+                      {                                                     \
+                      case 0:                                               \
+                        count = sprintf (tmp, buf, arg);                    \
+                        break;                                              \
+                      case 1:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], arg);       \
+                        break;                                              \
+                      case 2:                                               \
+                        count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
+                                         arg);                              \
+                        break;                                              \
+                      default:                                              \
+                        abort ();                                           \
+                      }
 #endif
 
-                   switch (type)
-                     {
-                     case TYPE_SCHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_schar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UCHAR:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_SHORT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_short;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_USHORT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_INT:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_int;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_UINT:
-                       {
-                         unsigned int arg = a.arg[dp->arg_index].a.a_uint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGINT:
-                       {
-                         long int arg = a.arg[dp->arg_index].a.a_longint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGINT:
-                       {
-                         unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                    switch (type)
+                      {
+                      case TYPE_SCHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_schar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UCHAR:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_SHORT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_short;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_USHORT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_INT:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_int;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_UINT:
+                        {
+                          unsigned int arg = a.arg[dp->arg_index].a.a_uint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGINT:
+                        {
+                          long int arg = a.arg[dp->arg_index].a.a_longint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGINT:
+                        {
+                          unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_LONG_LONG_INT
-                     case TYPE_LONGLONGINT:
-                       {
-                         long long int arg = a.arg[dp->arg_index].a.a_longlongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_ULONGLONGINT:
-                       {
-                         unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_LONGLONGINT:
+                        {
+                          long long int arg = a.arg[dp->arg_index].a.a_longlongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_ULONGLONGINT:
+                        {
+                          unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_DOUBLE:
-                       {
-                         double arg = a.arg[dp->arg_index].a.a_double;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_LONGDOUBLE:
-                       {
-                         long double arg = a.arg[dp->arg_index].a.a_longdouble;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     case TYPE_CHAR:
-                       {
-                         int arg = a.arg[dp->arg_index].a.a_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_DOUBLE:
+                        {
+                          double arg = a.arg[dp->arg_index].a.a_double;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_LONGDOUBLE:
+                        {
+                          long double arg = a.arg[dp->arg_index].a.a_longdouble;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      case TYPE_CHAR:
+                        {
+                          int arg = a.arg[dp->arg_index].a.a_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WINT_T
-                     case TYPE_WIDE_CHAR:
-                       {
-                         wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_CHAR:
+                        {
+                          wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_STRING:
-                       {
-                         const char *arg = a.arg[dp->arg_index].a.a_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_STRING:
+                        {
+                          const char *arg = a.arg[dp->arg_index].a.a_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #if HAVE_WCHAR_T
-                     case TYPE_WIDE_STRING:
-                       {
-                         const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
+                      case TYPE_WIDE_STRING:
+                        {
+                          const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
 #endif
-                     case TYPE_POINTER:
-                       {
-                         void *arg = a.arg[dp->arg_index].a.a_pointer;
-                         SNPRINTF_BUF (arg);
-                       }
-                       break;
-                     default:
-                       abort ();
-                     }
+                      case TYPE_POINTER:
+                        {
+                          void *arg = a.arg[dp->arg_index].a.a_pointer;
+                          SNPRINTF_BUF (arg);
+                        }
+                        break;
+                      default:
+                        abort ();
+                      }
 
 #if USE_SNPRINTF
-                   /* Portability: Not all implementations of snprintf()
-                      are ISO C 99 compliant.  Determine the number of
-                      bytes that snprintf() has produced or would have
-                      produced.  */
-                   if (count >= 0)
-                     {
-                       /* Verify that snprintf() has NUL-terminated its
-                          result.  */
-                       if (count < maxlen
-                           && ((TCHAR_T *) (result + length)) [count] != '\0')
-                         abort ();
-                       /* Portability hack.  */
-                       if (retcount > count)
-                         count = retcount;
-                     }
-                   else
-                     {
-                       /* snprintf() doesn't understand the '%n'
-                          directive.  */
-                       if (fbp[1] != '\0')
-                         {
-                           /* Don't use the '%n' directive; instead, look
-                              at the snprintf() return value.  */
-                           fbp[1] = '\0';
-                           continue;
-                         }
-                       else
-                         {
-                           /* Look at the snprintf() return value.  */
-                           if (retcount < 0)
-                             {
-                               /* HP-UX 10.20 snprintf() is doubly deficient:
-                                  It doesn't understand the '%n' directive,
-                                  *and* it returns -1 (rather than the length
-                                  that would have been required) when the
-                                  buffer is too small.  */
-                               size_t bigger_need =
-                                 xsum (xtimes (allocated, 2), 12);
-                               ENSURE_ALLOCATION (bigger_need);
-                               continue;
-                             }
-                           else
-                             count = retcount;
-                         }
-                     }
+                    /* Portability: Not all implementations of snprintf()
+                       are ISO C 99 compliant.  Determine the number of
+                       bytes that snprintf() has produced or would have
+                       produced.  */
+                    if (count >= 0)
+                      {
+                        /* Verify that snprintf() has NUL-terminated its
+                           result.  */
+                        if (count < maxlen
+                            && ((TCHAR_T *) (result + length)) [count] != '\0')
+                          abort ();
+                        /* Portability hack.  */
+                        if (retcount > count)
+                          count = retcount;
+                      }
+                    else
+                      {
+                        /* snprintf() doesn't understand the '%n'
+                           directive.  */
+                        if (fbp[1] != '\0')
+                          {
+                            /* Don't use the '%n' directive; instead, look
+                               at the snprintf() return value.  */
+                            fbp[1] = '\0';
+                            continue;
+                          }
+                        else
+                          {
+                            /* Look at the snprintf() return value.  */
+                            if (retcount < 0)
+                              {
+                                /* HP-UX 10.20 snprintf() is doubly deficient:
+                                   It doesn't understand the '%n' directive,
+                                   *and* it returns -1 (rather than the length
+                                   that would have been required) when the
+                                   buffer is too small.  */
+                                size_t bigger_need =
+                                  xsum (xtimes (allocated, 2), 12);
+                                ENSURE_ALLOCATION (bigger_need);
+                                continue;
+                              }
+                            else
+                              count = retcount;
+                          }
+                      }
 #endif
 
-                   /* Attempt to handle failure.  */
-                   if (count < 0)
-                     {
-                       if (!(result == resultbuf || result == NULL))
-                         free (result);
-                       if (buf_malloced != NULL)
-                         free (buf_malloced);
-                       CLEANUP ();
-                       errno = EINVAL;
-                       return NULL;
-                     }
+                    /* Attempt to handle failure.  */
+                    if (count < 0)
+                      {
+                        if (!(result == resultbuf || result == NULL))
+                          free (result);
+                        if (buf_malloced != NULL)
+                          free (buf_malloced);
+                        CLEANUP ();
+                        errno = EINVAL;
+                        return NULL;
+                      }
 
 #if USE_SNPRINTF
-                   /* Handle overflow of the allocated buffer.
-                      If such an overflow occurs, a C99 compliant snprintf()
-                      returns a count >= maxlen.  However, a non-compliant
-                      snprintf() function returns only count = maxlen - 1.  To
-                      cover both cases, test whether count >= maxlen - 1.  */
-                   if ((unsigned int) count + 1 >= maxlen)
-                     {
-                       /* If maxlen already has attained its allowed maximum,
-                          allocating more memory will not increase maxlen.
-                          Instead of looping, bail out.  */
-                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
-                         goto overflow;
-                       else
-                         {
-                           /* Need at least (count + 1) * sizeof (TCHAR_T)
-                              bytes.  (The +1 is for the trailing NUL.)
-                              But ask for (count + 2) * sizeof (TCHAR_T)
-                              bytes, so that in the next round, we likely get
-                                maxlen > (unsigned int) count + 1
-                              and so we don't get here again.
-                              And allocate proportionally, to avoid looping
-                              eternally if snprintf() reports a too small
-                              count.  */
-                           size_t n =
-                             xmax (xsum (length,
-                                         ((unsigned int) count + 2
-                                          + TCHARS_PER_DCHAR - 1)
-                                         / TCHARS_PER_DCHAR),
-                                   xtimes (allocated, 2));
-
-                           ENSURE_ALLOCATION (n);
-                           continue;
-                         }
-                     }
+                    /* Handle overflow of the allocated buffer.
+                       If such an overflow occurs, a C99 compliant snprintf()
+                       returns a count >= maxlen.  However, a non-compliant
+                       snprintf() function returns only count = maxlen - 1.  To
+                       cover both cases, test whether count >= maxlen - 1.  */
+                    if ((unsigned int) count + 1 >= maxlen)
+                      {
+                        /* If maxlen already has attained its allowed maximum,
+                           allocating more memory will not increase maxlen.
+                           Instead of looping, bail out.  */
+                        if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
+                          goto overflow;
+                        else
+                          {
+                            /* Need at least (count + 1) * sizeof (TCHAR_T)
+                               bytes.  (The +1 is for the trailing NUL.)
+                               But ask for (count + 2) * sizeof (TCHAR_T)
+                               bytes, so that in the next round, we likely get
+                                 maxlen > (unsigned int) count + 1
+                               and so we don't get here again.
+                               And allocate proportionally, to avoid looping
+                               eternally if snprintf() reports a too small
+                               count.  */
+                            size_t n =
+                              xmax (xsum (length,
+                                          ((unsigned int) count + 2
+                                           + TCHARS_PER_DCHAR - 1)
+                                          / TCHARS_PER_DCHAR),
+                                    xtimes (allocated, 2));
+
+                            ENSURE_ALLOCATION (n);
+                            continue;
+                          }
+                      }
 #endif
 
 #if NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (prec_ourselves)
-                     {
-                       /* Handle the precision.  */
-                       TCHAR_T *prec_ptr =
+                    if (prec_ourselves)
+                      {
+                        /* Handle the precision.  */
+                        TCHAR_T *prec_ptr =
 # if USE_SNPRINTF
-                         (TCHAR_T *) (result + length);
+                          (TCHAR_T *) (result + length);
 # else
-                         tmp;
+                          tmp;
 # endif
-                       size_t prefix_count;
-                       size_t move;
-
-                       prefix_count = 0;
-                       /* Put the additional zeroes after the sign.  */
-                       if (count >= 1
-                           && (*prec_ptr == '-' || *prec_ptr == '+'
-                               || *prec_ptr == ' '))
-                         prefix_count = 1;
-                       /* Put the additional zeroes after the 0x prefix if
-                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
-                       else if (count >= 2
-                                && prec_ptr[0] == '0'
-                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
-                         prefix_count = 2;
-
-                       move = count - prefix_count;
-                       if (precision > move)
-                         {
-                           /* Insert zeroes.  */
-                           size_t insert = precision - move;
-                           TCHAR_T *prec_end;
+                        size_t prefix_count;
+                        size_t move;
+
+                        prefix_count = 0;
+                        /* Put the additional zeroes after the sign.  */
+                        if (count >= 1
+                            && (*prec_ptr == '-' || *prec_ptr == '+'
+                                || *prec_ptr == ' '))
+                          prefix_count = 1;
+                        /* Put the additional zeroes after the 0x prefix if
+                           (flags & FLAG_ALT) || (dp->conversion == 'p').  */
+                        else if (count >= 2
+                                 && prec_ptr[0] == '0'
+                                 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
+                          prefix_count = 2;
+
+                        move = count - prefix_count;
+                        if (precision > move)
+                          {
+                            /* Insert zeroes.  */
+                            size_t insert = precision - move;
+                            TCHAR_T *prec_end;
 
 # if USE_SNPRINTF
-                           size_t n =
-                             xsum (length,
-                                   (count + insert + TCHARS_PER_DCHAR - 1)
-                                   / TCHARS_PER_DCHAR);
-                           length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
-                           ENSURE_ALLOCATION (n);
-                           length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
-                           prec_ptr = (TCHAR_T *) (result + length);
+                            size_t n =
+                              xsum (length,
+                                    (count + insert + TCHARS_PER_DCHAR - 1)
+                                    / TCHARS_PER_DCHAR);
+                            length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                            ENSURE_ALLOCATION (n);
+                            length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                            prec_ptr = (TCHAR_T *) (result + length);
 # endif
 
-                           prec_end = prec_ptr + count;
-                           prec_ptr += prefix_count;
+                            prec_end = prec_ptr + count;
+                            prec_ptr += prefix_count;
 
-                           while (prec_end > prec_ptr)
-                             {
-                               prec_end--;
-                               prec_end[insert] = prec_end[0];
-                             }
+                            while (prec_end > prec_ptr)
+                              {
+                                prec_end--;
+                                prec_end[insert] = prec_end[0];
+                              }
 
-                           prec_end += insert;
-                           do
-                             *--prec_end = '0';
-                           while (prec_end > prec_ptr);
+                            prec_end += insert;
+                            do
+                              *--prec_end = '0';
+                            while (prec_end > prec_ptr);
 
-                           count += insert;
-                         }
-                     }
+                            count += insert;
+                          }
+                      }
 #endif
 
 #if !USE_SNPRINTF
-                   if (count >= tmp_length)
-                     /* tmp_length was incorrectly calculated - fix the
-                        code above!  */
-                     abort ();
+                    if (count >= tmp_length)
+                      /* tmp_length was incorrectly calculated - fix the
+                         code above!  */
+                      abort ();
 #endif
 
 #if !DCHAR_IS_TCHAR
-                   /* Convert from TCHAR_T[] to DCHAR_T[].  */
-                   if (dp->conversion == 'c' || dp->conversion == 's')
-                     {
-                       /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
-                          TYPE_WIDE_STRING.
-                          The result string is not certainly ASCII.  */
-                       const TCHAR_T *tmpsrc;
-                       DCHAR_T *tmpdst;
-                       size_t tmpdst_len;
-                       /* This code assumes that TCHAR_T is 'char'.  */
-                       typedef int TCHAR_T_verify
-                                   [2 * (sizeof (TCHAR_T) == 1) - 1];
+                    /* Convert from TCHAR_T[] to DCHAR_T[].  */
+                    if (dp->conversion == 'c' || dp->conversion == 's')
+                      {
+                        /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING
+                           TYPE_WIDE_STRING.
+                           The result string is not certainly ASCII.  */
+                        const TCHAR_T *tmpsrc;
+                        DCHAR_T *tmpdst;
+                        size_t tmpdst_len;
+                        /* This code assumes that TCHAR_T is 'char'.  */
+                        typedef int TCHAR_T_verify
+                                    [2 * (sizeof (TCHAR_T) == 1) - 1];
 # if USE_SNPRINTF
-                       tmpsrc = (TCHAR_T *) (result + length);
+                        tmpsrc = (TCHAR_T *) (result + length);
 # else
-                       tmpsrc = tmp;
+                        tmpsrc = tmp;
 # endif
-                       tmpdst =
-                         DCHAR_CONV_FROM_ENCODING (locale_charset (),
-                                                   iconveh_question_mark,
-                                                   tmpsrc, count,
-                                                   NULL,
-                                                   NULL, &tmpdst_len);
-                       if (tmpdst == NULL)
-                         {
-                           int saved_errno = errno;
-                           if (!(result == resultbuf || result == NULL))
-                             free (result);
-                           if (buf_malloced != NULL)
-                             free (buf_malloced);
-                           CLEANUP ();
-                           errno = saved_errno;
-                           return NULL;
-                         }
-                       ENSURE_ALLOCATION (xsum (length, tmpdst_len));
-                       DCHAR_CPY (result + length, tmpdst, tmpdst_len);
-                       free (tmpdst);
-                       count = tmpdst_len;
-                     }
-                   else
-                     {
-                       /* The result string is ASCII.
-                          Simple 1:1 conversion.  */
+                        tmpdst =
+                          DCHAR_CONV_FROM_ENCODING (locale_charset (),
+                                                    iconveh_question_mark,
+                                                    tmpsrc, count,
+                                                    NULL,
+                                                    NULL, &tmpdst_len);
+                        if (tmpdst == NULL)
+                          {
+                            int saved_errno = errno;
+                            if (!(result == resultbuf || result == NULL))
+                              free (result);
+                            if (buf_malloced != NULL)
+                              free (buf_malloced);
+                            CLEANUP ();
+                            errno = saved_errno;
+                            return NULL;
+                          }
+                        ENSURE_ALLOCATION (xsum (length, tmpdst_len));
+                        DCHAR_CPY (result + length, tmpdst, tmpdst_len);
+                        free (tmpdst);
+                        count = tmpdst_len;
+                      }
+                    else
+                      {
+                        /* The result string is ASCII.
+                           Simple 1:1 conversion.  */
 # if USE_SNPRINTF
-                       /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
-                          no-op conversion, in-place on the array starting
-                          at (result + length).  */
-                       if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
+                        /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a
+                           no-op conversion, in-place on the array starting
+                           at (result + length).  */
+                        if (sizeof (DCHAR_T) != sizeof (TCHAR_T))
 # endif
-                         {
-                           const TCHAR_T *tmpsrc;
-                           DCHAR_T *tmpdst;
-                           size_t n;
+                          {
+                            const TCHAR_T *tmpsrc;
+                            DCHAR_T *tmpdst;
+                            size_t n;
 
 # if USE_SNPRINTF
-                           if (result == resultbuf)
-                             {
-                               tmpsrc = (TCHAR_T *) (result + length);
-                               /* ENSURE_ALLOCATION will not move tmpsrc
-                                  (because it's part of resultbuf).  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                             }
-                           else
-                             {
-                               /* ENSURE_ALLOCATION will move the array
-                                  (because it uses realloc().  */
-                               ENSURE_ALLOCATION (xsum (length, count));
-                               tmpsrc = (TCHAR_T *) (result + length);
-                             }
+                            if (result == resultbuf)
+                              {
+                                tmpsrc = (TCHAR_T *) (result + length);
+                                /* ENSURE_ALLOCATION will not move tmpsrc
+                                   (because it's part of resultbuf).  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                              }
+                            else
+                              {
+                                /* ENSURE_ALLOCATION will move the array
+                                   (because it uses realloc().  */
+                                ENSURE_ALLOCATION (xsum (length, count));
+                                tmpsrc = (TCHAR_T *) (result + length);
+                              }
 # else
-                           tmpsrc = tmp;
-                           ENSURE_ALLOCATION (xsum (length, count));
+                            tmpsrc = tmp;
+                            ENSURE_ALLOCATION (xsum (length, count));
 # endif
-                           tmpdst = result + length;
-                           /* Copy backwards, because of overlapping.  */
-                           tmpsrc += count;
-                           tmpdst += count;
-                           for (n = count; n > 0; n--)
-                             *--tmpdst = (unsigned char) *--tmpsrc;
-                         }
-                     }
+                            tmpdst = result + length;
+                            /* Copy backwards, because of overlapping.  */
+                            tmpsrc += count;
+                            tmpdst += count;
+                            for (n = count; n > 0; n--)
+                              *--tmpdst = (unsigned char) *--tmpsrc;
+                          }
+                      }
 #endif
 
 #if DCHAR_IS_TCHAR && !USE_SNPRINTF
-                   /* Make room for the result.  */
-                   if (count > allocated - length)
-                     {
-                       /* Need at least count elements.  But allocate
-                          proportionally.  */
-                       size_t n =
-                         xmax (xsum (length, count), xtimes (allocated, 2));
-
-                       ENSURE_ALLOCATION (n);
-                     }
+                    /* Make room for the result.  */
+                    if (count > allocated - length)
+                      {
+                        /* Need at least count elements.  But allocate
+                           proportionally.  */
+                        size_t n =
+                          xmax (xsum (length, count), xtimes (allocated, 2));
+
+                        ENSURE_ALLOCATION (n);
+                      }
 #endif
 
-                   /* Here count <= allocated - length.  */
+                    /* Here count <= allocated - length.  */
 
-                   /* Perform padding.  */
+                    /* Perform padding.  */
 #if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
-                   if (pad_ourselves && has_width)
-                     {
-                       size_t w;
+                    if (pad_ourselves && has_width)
+                      {
+                        size_t w;
 # if ENABLE_UNISTDIO
-                       /* Outside POSIX, it's preferrable to compare the width
-                          against the number of _characters_ of the converted
-                          value.  */
-                       w = DCHAR_MBSNLEN (result + length, count);
+                        /* Outside POSIX, it's preferrable to compare the width
+                           against the number of _characters_ of the converted
+                           value.  */
+                        w = DCHAR_MBSNLEN (result + length, count);
 # else
-                       /* The width is compared against the number of _bytes_
-                          of the converted value, says POSIX.  */
-                       w = count;
+                        /* The width is compared against the number of _bytes_
+                           of the converted value, says POSIX.  */
+                        w = count;
 # endif
-                       if (w < width)
-                         {
-                           size_t pad = width - w;
-
-                           /* Make room for the result.  */
-                           if (xsum (count, pad) > allocated - length)
-                             {
-                               /* Need at least count + pad elements.  But
-                                  allocate proportionally.  */
-                               size_t n =
-                                 xmax (xsum3 (length, count, pad),
-                                       xtimes (allocated, 2));
+                        if (w < width)
+                          {
+                            size_t pad = width - w;
+
+                            /* Make room for the result.  */
+                            if (xsum (count, pad) > allocated - length)
+                              {
+                                /* Need at least count + pad elements.  But
+                                   allocate proportionally.  */
+                                size_t n =
+                                  xmax (xsum3 (length, count, pad),
+                                        xtimes (allocated, 2));
 
 # if USE_SNPRINTF
-                               length += count;
-                               ENSURE_ALLOCATION (n);
-                               length -= count;
+                                length += count;
+                                ENSURE_ALLOCATION (n);
+                                length -= count;
 # else
-                               ENSURE_ALLOCATION (n);
+                                ENSURE_ALLOCATION (n);
 # endif
-                             }
-                           /* Here count + pad <= allocated - length.  */
+                              }
+                            /* Here count + pad <= allocated - length.  */
 
-                           {
+                            {
 # if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                             DCHAR_T * const rp = result + length;
+                              DCHAR_T * const rp = result + length;
 # else
-                             DCHAR_T * const rp = tmp;
+                              DCHAR_T * const rp = tmp;
 # endif
-                             DCHAR_T *p = rp + count;
-                             DCHAR_T *end = p + pad;
-                             DCHAR_T *pad_ptr;
+                              DCHAR_T *p = rp + count;
+                              DCHAR_T *end = p + pad;
+                              DCHAR_T *pad_ptr;
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
-                             if (dp->conversion == 'c'
-                                 || dp->conversion == 's')
-                               /* No zero-padding for string directives.  */
-                               pad_ptr = NULL;
-                             else
+                              if (dp->conversion == 'c'
+                                  || dp->conversion == 's')
+                                /* No zero-padding for string directives.  */
+                                pad_ptr = NULL;
+                              else
 # endif
-                               {
-                                 pad_ptr = (*rp == '-' ? rp + 1 : rp);
-                                 /* No zero-padding of "inf" and "nan".  */
-                                 if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
-                                     || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
-                                   pad_ptr = NULL;
-                               }
-                             /* The generated string now extends from rp to p,
-                                with the zero padding insertion point being at
-                                pad_ptr.  */
-
-                             count = count + pad; /* = end - rp */
-
-                             if (flags & FLAG_LEFT)
-                               {
-                                 /* Pad with spaces on the right.  */
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                             else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
-                               {
-                                 /* Pad with zeroes.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > pad_ptr)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = '0';
-                               }
-                             else
-                               {
-                                 /* Pad with spaces on the left.  */
-                                 DCHAR_T *q = end;
-
-                                 while (p > rp)
-                                   *--q = *--p;
-                                 for (; pad > 0; pad--)
-                                   *p++ = ' ';
-                               }
-                           }
-                         }
-                     }
+                                {
+                                  pad_ptr = (*rp == '-' ? rp + 1 : rp);
+                                  /* No zero-padding of "inf" and "nan".  */
+                                  if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z')
+                                      || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
+                                    pad_ptr = NULL;
+                                }
+                              /* The generated string now extends from rp to p,
+                                 with the zero padding insertion point being at
+                                 pad_ptr.  */
+
+                              count = count + pad; /* = end - rp */
+
+                              if (flags & FLAG_LEFT)
+                                {
+                                  /* Pad with spaces on the right.  */
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                              else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
+                                {
+                                  /* Pad with zeroes.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > pad_ptr)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = '0';
+                                }
+                              else
+                                {
+                                  /* Pad with spaces on the left.  */
+                                  DCHAR_T *q = end;
+
+                                  while (p > rp)
+                                    *--q = *--p;
+                                  for (; pad > 0; pad--)
+                                    *p++ = ' ';
+                                }
+                            }
+                          }
+                      }
 #endif
 
-                   /* Here still count <= allocated - length.  */
+                    /* Here still count <= allocated - length.  */
 
 #if !DCHAR_IS_TCHAR || USE_SNPRINTF
-                   /* The snprintf() result did fit.  */
+                    /* The snprintf() result did fit.  */
 #else
-                   /* Append the sprintf() result.  */
-                   memcpy (result + length, tmp, count * sizeof (DCHAR_T));
+                    /* Append the sprintf() result.  */
+                    memcpy (result + length, tmp, count * sizeof (DCHAR_T));
 #endif
 #if !USE_SNPRINTF
-                   if (tmp != tmpbuf)
-                     free (tmp);
+                    if (tmp != tmpbuf)
+                      free (tmp);
 #endif
 
 #if NEED_PRINTF_DIRECTIVE_F
-                   if (dp->conversion == 'F')
-                     {
-                       /* Convert the %f result to upper case for %F.  */
-                       DCHAR_T *rp = result + length;
-                       size_t rc;
-                       for (rc = count; rc > 0; rc--, rp++)
-                         if (*rp >= 'a' && *rp <= 'z')
-                           *rp = *rp - 'a' + 'A';
-                     }
+                    if (dp->conversion == 'F')
+                      {
+                        /* Convert the %f result to upper case for %F.  */
+                        DCHAR_T *rp = result + length;
+                        size_t rc;
+                        for (rc = count; rc > 0; rc--, rp++)
+                          if (*rp >= 'a' && *rp <= 'z')
+                            *rp = *rp - 'a' + 'A';
+                      }
 #endif
 
-                   length += count;
-                   break;
-                 }
-             }
-         }
+                    length += count;
+                    break;
+                  }
+              }
+          }
       }
 
     /* Add the final NUL.  */
@@ -5432,12 +5432,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
     if (result != resultbuf && length + 1 < allocated)
       {
-       /* Shrink the allocated memory if possible.  */
-       DCHAR_T *memory;
+        /* Shrink the allocated memory if possible.  */
+        DCHAR_T *memory;
 
-       memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
-       if (memory != NULL)
-         result = memory;
+        memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
+        if (memory != NULL)
+          result = memory;
       }
 
     if (buf_malloced != NULL)
index 7f5770aaf4ade306dc8269d71828f0361d3c5a6b..6bf9c59cd99bb8203f0705cb4fbe90c6c87fb329 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2010 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
 #include <stddef.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
index c74dc76e4f0a3342a0054e25a1689be28a36e3b4..b8c52a9ec8110c0e4d64a4b854b606a45e39b0d8 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006-2010 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
index d487be89967083b0b3d6c2507009c5f85762e780..2ec3cae9d704b2ea9dfcac55c6783265db5e9e11 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 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
@@ -52,11 +52,11 @@ vsnprintf (char *str, size_t size, const char *format, va_list args)
   if (output != str)
     {
       if (size)
-       {
-         size_t pruned_len = (len < size ? len : size - 1);
-         memcpy (str, output, pruned_len);
-         str[pruned_len] = '\0';
-       }
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
 
       free (output);
     }
index 12977f7caba46b67aa5cc4efed015526c4e75814..1bcee466d61bb5fd4d9ff721761be36740fd3c2e 100644 (file)
@@ -1,6 +1,6 @@
 /* w32sock.h --- internal auxilliary functions for Windows socket functions
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 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
@@ -32,7 +32,6 @@ static inline void
 set_winsock_errno (void)
 {
   int err = WSAGetLastError ();
-  WSASetLastError (0);
 
   /* Map some WSAE* errors to the runtime library's error codes.  */
   switch (err)
index 9f5b963823b7356ba39e84775d2e477f7421fea2..c492dd60ef725565b93a9a39131cb6c0693c46a8 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 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
@@ -30,9 +30,9 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined __need_mbstate_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
 /* Special invocation convention:
-   - Inside uClibc header files.
+   - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
+   included before <wchar.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
 
 /* Include the original <wchar.h> if it exists.
    Some builds of uClibc lack it.  */
@@ -72,7 +75,9 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -110,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -129,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -147,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -165,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -183,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -197,14 +202,15 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
 #  define mbsrtowcs rpl_mbsrtowcs
 # endif
 # if !@HAVE_MBSRTOWCS@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps);
+extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -215,14 +221,15 @@ extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t
 #  define mbsnrtowcs rpl_mbsnrtowcs
 # endif
 # if !@HAVE_MBSNRTOWCS@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -237,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -251,14 +258,15 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
 #  define wcsrtombs rpl_wcsrtombs
 # endif
 # if !@HAVE_WCSRTOMBS@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps);
+extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -269,14 +277,15 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t
 #  define wcsnrtombs rpl_wcsnrtombs
 # endif
 # if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
+extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps)
+     _GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -294,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
index 42db052f8fe3fb6e382e62506b577af6efb0bd20..1d43dfe4c2f2cb4014360193b7577fa439c3e92c 100644 (file)
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008, 2009, 2010 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
index 85c2f209beb72edebf886ca1de25f29f02c09aec..17298f2348bf0c5ce90917bf19abfb75a92ae179 100755 (executable)
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2008 Free Software Foundation, Inc.
+#   Copyright 1996-2010 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
index 5cca8e8274fd0e9db704b9dd55753d521b945c09..110246fd42c960863f637aba815e0cd929b7d50d 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
index a6811c275cd08b2d6bcfa941efec56c7ed13998b..5e457ece104fcf163fcc4ae8dca3c58414d4fec1 100644 (file)
@@ -1,5 +1,5 @@
 /* hmac-md5.c -- hashed message authentication codes
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2009, 2010 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
@@ -31,7 +31,7 @@
 
 int
 hmac_md5 (const void *key, size_t keylen,
-         const void *in, size_t inlen, void *resbuf)
+          const void *in, size_t inlen, void *resbuf)
 {
   struct md5_ctx inner;
   struct md5_ctx outer;
index 90dae1c32aed38fdf0c543730587aa3b2da774bb..1ee9c4a78a5ede007773e486ebc8f7c4699dfe84 100644 (file)
@@ -1,5 +1,5 @@
 /* hmac.h -- hashed message authentication codes
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009, 2010 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
@@ -28,7 +28,7 @@
    RESBUF buffer.  Return 0 on success.  */
 int
 hmac_md5 (const void *key, size_t keylen,
-         const void *buffer, size_t buflen, void *resbuf);
+          const void *buffer, size_t buflen, void *resbuf);
 
 /* Compute Hashed Message Authentication Code with SHA-1, over BUFFER
    data of BUFLEN bytes using the KEY of KEYLEN bytes, writing the
@@ -36,6 +36,6 @@ hmac_md5 (const void *key, size_t keylen,
    success.  */
 int
 hmac_sha1 (const void *key, size_t keylen,
-          const void *in, size_t inlen, void *resbuf);
+           const void *in, size_t inlen, void *resbuf);
 
 #endif /* HMAC_H */
index d4d04d1530a27c0921a542c6978da037107b9ee0..301469b31cef0ba55efc7c41e701ae5fa715834d 100644 (file)
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2010 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.
index ba6d5e190f9f2df6ae1b080fc8f2d16490b5e3b2..7d9458a8d65a0b085d93b695beaaa6685b824c18 100644 (file)
@@ -1,7 +1,7 @@
-# serial 8  -*- Autoconf -*-
+# serial 9  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 # enough in this area it's likely we'll need to redefine
 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
 
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
 # AC_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
@@ -74,8 +88,8 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([[
-#        define __EXTENSIONS__ 1
-         ]AC_INCLUDES_DEFAULT])],
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
        [ac_cv_safe_to_define___extensions__=yes],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
index 613ab92e77359cbdeb48c528adfbf91c45210120..221da5c6ac81cd98314e4737c4c761983c12dbc4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
index c8fda2033045d38975415f240bd9a72a14a2c949..b7812a896217a250e8298125c6a087a588994340 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 11
-dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 12
+dnl Copyright (C) 2007-2010 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.
@@ -23,14 +23,17 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define __GNUC_STDC_INLINE__ 1
 #endif])
   AH_VERBATIM([unused_parameter],
-[/* Define as a marker that can be attached to function parameter declarations
-   for parameters that are not used.  This helps to reduce warnings, such as
-   from GCC -Wunused-parameter.  */
+[/* Define as a marker that can be attached to declarations that might not
+    be used.  This helps to reduce warnings, such as from
+    GCC -Wunused-parameter.  */
 #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
+# define _GL_UNUSED __attribute__ ((__unused__))
 #else
-# define _UNUSED_PARAMETER_
+# define _GL_UNUSED
 #endif
+/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
+   is a misnomer outside of parameter lists.  */
+#define _UNUSED_PARAMETER_ _GL_UNUSED
 ])
 ])
 
@@ -49,6 +52,14 @@ m4_ifndef([m4_foreach_w],
   [m4_define([m4_foreach_w],
     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
+# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
+# ----------------------------------------------------
+# Backport of autoconf-2.63b's macro.
+# Remove this macro when we can assume autoconf >= 2.64.
+m4_ifndef([AS_VAR_IF],
+[m4_define([AS_VAR_IF],
+[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
+
 # AC_PROG_MKDIR_P
 # is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
 # Remove this macro when we can assume autoconf >= 2.60.
@@ -70,13 +81,13 @@ AC_DEFUN([AC_C_RESTRICT],
    for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
+        int foo (int_ptr $ac_kw ip) {
+        return ip[0];
        }]],
       [[int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)]])],
+        int * $ac_kw t = s;
+        t[0] = 0;
+        return foo(t)]])],
       [ac_cv_c_restrict=$ac_kw])
      test "$ac_cv_c_restrict" != no && break
    done
index 432b3e0d76a9074d5d90cb2aaf30dec97a2270f4..172ade4df4efd896c74e93570e3dab74cc86adee 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -68,7 +68,7 @@ AC_DEFUN([xgl_INIT],
     if test -n "$xgl_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $xgl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $xgl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         xgl_libobjs="$xgl_libobjs $i.$ac_objext"
         xgl_ltlibobjs="$xgl_ltlibobjs $i.lo"
       done
@@ -107,7 +107,7 @@ AC_DEFUN([xgl_INIT],
     if test -n "$xgltests_LIBOBJS"; then
       # Remove the extension.
       sed_drop_objext='s/\.o$//;s/\.obj$//'
-      for i in `for i in $xgltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+      for i in `for i in $xgltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
         xgltests_libobjs="$xgltests_libobjs $i.$ac_objext"
         xgltests_ltlibobjs="$xgltests_ltlibobjs $i.lo"
       done
index 4438d488698b2e25a911a6741d8903cb9fd35ebf..69e7733b990a0aac8afb62c14813b417bb371891 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2010 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.
index 729c6bf827b79c806c6141ea1692b68a1b694743..417b3e36f4ff95492600fe792c502d5e3f541c4f 100644 (file)
@@ -1,5 +1,5 @@
 # hmac-md5.m4 serial 2
-dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2009, 2010 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.
index 1aa6a6fbbf43cd47d261ca26894add37f5ee4180..2dc6bf52057463d2ec9a368029290a63bcded385 100644 (file)
@@ -1,5 +1,5 @@
 # ld-output-def.m4 serial 2
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
index a97888f2493a363c4e597eb7f1fe78575b7d4e60..43c1ef12f94aa001057ee293c3bf3cdff2efcbc7 100644 (file)
@@ -1,5 +1,5 @@
 # ld-version-script.m4 serial 1
-dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2009, 2010 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.
@@ -27,7 +27,7 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT],
     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
     cat > conftest.map <<EOF
 VERS_1 {
-       global: sym;
+        global: sym;
 };
 
 VERS_2 {
index e4863f2c9b76a6cc8a3979bb41244a615d194c84..ebb30528bd5abfdfcc2126175cbe1de99d902457 100644 (file)
@@ -1,5 +1,5 @@
 # lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2010 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.
@@ -59,7 +59,7 @@ if test "$GCC" = yes; then
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -89,9 +89,9 @@ AC_CACHE_VAL([acl_cv_path_LD],
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-       test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-       test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
index 2f8b7ff38f59356b30df8a0d627ea0a809e1bdf0..90e1ac9170d3418035f0c6a299d16ae8aadcebee 100644 (file)
@@ -1,5 +1,5 @@
 # lib-link.m4 serial 20 (gettext-0.18)
-dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2010 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.
index 4b7ee3358debcbd4991f12831aba90601bb4d361..1601ceaefd3c2b447b569f991813be12b0e06e2d 100644 (file)
@@ -1,5 +1,5 @@
 # lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2010 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.
index 57b193fdf22bd6eb11e7edb1ac9d039efecd0aa5..52f9c1b8738882a54386d8c19d0e180f952331da 100644 (file)
@@ -1,5 +1,6 @@
 # md5.m4 serial 11
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software
+dnl 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.
index e14ffbb0f182ca3370feb41e3b37d2c3d6c1ec66..3093cdc320bf9b525510c844b4d0240948faf7d5 100644 (file)
@@ -1,5 +1,5 @@
 # memxor.m4 serial 3
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009, 2010 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.
index 0905367bdd7f48b0d8896de98f53e0d54208701c..912738a50046f7e64f83fcc5e785cf67f5029a66 100644 (file)
@@ -1,7 +1,7 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006,2008
-       Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005, 2006, 2008, 2009,
+   2010 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
@@ -50,7 +50,7 @@
 #endif
 
 #ifdef WORDS_BIGENDIAN
-# define SWAP(n)                                                       \
+# define SWAP(n)                                                        \
     (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
 # define SWAP(n) (n)
@@ -158,33 +158,33 @@ md5_stream (FILE *stream, void *resblock)
 
       /* Read block.  Take care for partial reads.  */
       while (1)
-       {
-         n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-
-         sum += n;
-
-         if (sum == BLOCKSIZE)
-           break;
-
-         if (n == 0)
-           {
-             /* Check for the error flag IFF N == 0, so that we don't
-                exit the loop after a partial read due to e.g., EAGAIN
-                or EWOULDBLOCK.  */
-             if (ferror (stream))
-               {
-                 free (buffer);
-                 return 1;
-               }
-             goto process_partial_block;
-           }
-
-         /* We've read at least one byte, so ignore errors.  But always
-            check for EOF, since feof may be true even though N > 0.
-            Otherwise, we could end up calling fread after EOF.  */
-         if (feof (stream))
-           goto process_partial_block;
-       }
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+          sum += n;
+
+          if (sum == BLOCKSIZE)
+            break;
+
+          if (n == 0)
+            {
+              /* Check for the error flag IFF N == 0, so that we don't
+                 exit the loop after a partial read due to e.g., EAGAIN
+                 or EWOULDBLOCK.  */
+              if (ferror (stream))
+                {
+                  free (buffer);
+                  return 1;
+                }
+              goto process_partial_block;
+            }
+
+          /* We've read at least one byte, so ignore errors.  But always
+             check for EOF, since feof may be true even though N > 0.
+             Otherwise, we could end up calling fread after EOF.  */
+          if (feof (stream))
+            goto process_partial_block;
+        }
 
       /* Process buffer with BLOCKSIZE bytes.  Note that
          BLOCKSIZE % 64 == 0
@@ -239,15 +239,15 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
       ctx->buflen += add;
 
       if (ctx->buflen > 64)
-       {
-         md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+        {
+          md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
 
-         ctx->buflen &= 63;
-         /* The regions in the following copy operation cannot overlap.  */
-         memcpy (ctx->buffer,
-                 &((char *) ctx->buffer)[(left_over + add) & ~63],
-                 ctx->buflen);
-       }
+          ctx->buflen &= 63;
+          /* The regions in the following copy operation cannot overlap.  */
+          memcpy (ctx->buffer,
+                  &((char *) ctx->buffer)[(left_over + add) & ~63],
+                  ctx->buflen);
+        }
 
       buffer = (const char *) buffer + add;
       len -= add;
@@ -260,19 +260,19 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
 # define alignof(type) offsetof (struct { char c; type x; }, x)
 # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
-       while (len > 64)
-         {
-           md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-           buffer = (const char *) buffer + 64;
-           len -= 64;
-         }
+        while (len > 64)
+          {
+            md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+            buffer = (const char *) buffer + 64;
+            len -= 64;
+          }
       else
 #endif
-       {
-         md5_process_block (buffer, len & ~63, ctx);
-         buffer = (const char *) buffer + (len & ~63);
-         len &= 63;
-       }
+        {
+          md5_process_block (buffer, len & ~63, ctx);
+          buffer = (const char *) buffer + (len & ~63);
+          len &= 63;
+        }
     }
 
   /* Move remaining bytes in internal buffer.  */
@@ -283,11 +283,11 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
       memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
       left_over += len;
       if (left_over >= 64)
-       {
-         md5_process_block (ctx->buffer, 64, ctx);
-         left_over -= 64;
-         memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-       }
+        {
+          md5_process_block (ctx->buffer, 64, ctx);
+          left_over -= 64;
+          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
       ctx->buflen = left_over;
     }
 }
@@ -341,14 +341,14 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
          before the computation.  To reduce the work for the next steps
          we store the swapped words in the array CORRECT_WORDS.  */
 
-#define OP(a, b, c, d, s, T)                                           \
-      do                                                               \
-        {                                                              \
-         a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
-         ++words;                                                      \
-         CYCLIC (a, s);                                                \
-         a += b;                                                       \
-        }                                                              \
+#define OP(a, b, c, d, s, T)                                            \
+      do                                                                \
+        {                                                               \
+          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
+          ++words;                                                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
       while (0)
 
       /* It is unfortunate that C does not provide an operator for
@@ -387,13 +387,13 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
          in CORRECT_WORDS.  Redefine the macro to take an additional first
          argument specifying the function to use.  */
 #undef OP
-#define OP(f, a, b, c, d, k, s, T)                                     \
-      do                                                               \
-       {                                                               \
-         a += f (b, c, d) + correct_words[k] + T;                      \
-         CYCLIC (a, s);                                                \
-         a += b;                                                       \
-       }                                                               \
+#define OP(f, a, b, c, d, k, s, T)                                      \
+      do                                                                \
+        {                                                               \
+          a += f (b, c, d) + correct_words[k] + T;                      \
+          CYCLIC (a, s);                                                \
+          a += b;                                                       \
+        }                                                               \
       while (0)
 
       /* Round 2.  */
index 3999b9a50cf6c96a8a59babc1c8c196bbcedcb68..1247d786e5df26b0db10d45b1b614730a2fb1c7f 100644 (file)
@@ -1,7 +1,7 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008,2009
-      Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2010 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
@@ -29,7 +29,7 @@
 
 #ifndef __GNUC_PREREQ
 # if defined __GNUC__ && defined __GNUC_MINOR__
-#  define __GNUC_PREREQ(maj, min)                                      \
+#  define __GNUC_PREREQ(maj, min)                                       \
   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 # else
 #  define __GNUC_PREREQ(maj, min) 0
@@ -38,7 +38,7 @@
 
 #ifndef __THROW
 # if defined __cplusplus && __GNUC_PREREQ (2,8)
-#  define __THROW      throw ()
+#  define __THROW       throw ()
 # else
 #  define __THROW
 # endif
@@ -85,14 +85,14 @@ extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW;
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void __md5_process_block (const void *buffer, size_t len,
-                                struct md5_ctx *ctx) __THROW;
+                                 struct md5_ctx *ctx) __THROW;
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void __md5_process_bytes (const void *buffer, size_t len,
-                                struct md5_ctx *ctx) __THROW;
+                                 struct md5_ctx *ctx) __THROW;
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
@@ -117,7 +117,7 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
    output yields to the wanted ASCII representation of the message
    digest.  */
 extern void *__md5_buffer (const char *buffer, size_t len,
-                          void *resblock) __THROW;
+                           void *resblock) __THROW;
 
 # ifdef __cplusplus
 }
index 2d8a2a27a750ac10d4bebd1e225d0995f906875b..da0ef91b509f3581a547091e1696397645967e41 100644 (file)
@@ -1,5 +1,5 @@
 /* memxor.c -- perform binary exclusive OR operation of two memory blocks.
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2009, 2010 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
index 70e914669e2cc1aa0fed618c05fa1997c756ac7e..e8eba8ba26dd978f0bac8574221e49db3a8c3411 100644 (file)
@@ -1,5 +1,5 @@
 /* memxor.h -- perform binary exclusive OR operation on memory blocks.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009, 2010 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
index 34d66e1d14d9b370272bb70c41588454935e6604..d384ca62b25c4c278561c323b3876f73b1abf1bc 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -2,7 +2,7 @@
 # This Makefile fragment tries to be general-purpose enough to be
 # used by many projects via the gnulib maintainer-makefile module.
 
-## Copyright (C) 2001-2009 Free Software Foundation, Inc.
+## Copyright (C) 2001-2010 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
@@ -30,16 +30,38 @@ gzip_rsyncable := \
   $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable)
 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 
-# cfg.mk must define the gpg_key_ID used by this package.
 GIT = git
 VC = $(GIT)
 VC-tag = git tag -s -m '$(VERSION)' -u '$(gpg_key_ID)'
 
 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 
+# You can override this variable in cfg.mk to set your own regexp
+# matching files to ignore.
+VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
+
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
+
+# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
+# when $(srcdir) is not ".".
+ifeq ($(srcdir),.)
+_prepend_srcdir_prefix =
+else
+_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|'
+endif
+
+# In order to be able to consistently filter "."-relative names,
+# (i.e., with no $(srcdir) prefix), this definition is careful to
+# remove any $(srcdir) prefix, and to restore what it removes.
 VC_LIST_EXCEPT = \
-  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
-              else grep -Ev "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi
+  $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
+       | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
+         else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
+       | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
+       $(_prepend_srcdir_prefix)
 
 ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version
@@ -63,6 +85,25 @@ my_distdir = $(PACKAGE)-$(VERSION)
 # Old releases are stored here.
 release_archive_dir ?= ../release
 
+# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for stable releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-stable = ftp.gnu.org
+gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
+
+ifeq ($(gnu_rel_host),ftp.gnu.org)
+url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
+else
+url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
+endif
+
+# Override this in cfg.mk if you are using a different format in your
+# NEWS file.
+today = $(shell date +%Y-%m-%d)
+news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
+
 # Prevent programs like 'sort' from considering distinct strings to be equal.
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C
@@ -157,8 +198,17 @@ sc_prohibit_strcmp:
                1>&2; exit 1; } || :
 
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)
+# Convert all uses automatically, via these two commands:
+# git grep -l '\<exit *(1)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/'
+# git grep -l '\<exit *(0)' \
+#  | grep -vEf .x-sc_prohibit_magic_number_exit \
+#  | xargs --no-run-if-empty \
+#      perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
 sc_prohibit_magic_number_exit:
-       @re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'           \
+       @re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,'   \
        msg='use EXIT_* values rather than magic number'                \
          $(_prohibit_regexp)
 
@@ -297,9 +347,15 @@ sc_prohibit_error_without_use:
 # | sort | perl -MRegexp::Assemble -le \
 #  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g'
 # Note this was produced by the above:
-# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
-# But we can do better:
-_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+# _xa1 = \
+#x(((2n?)?re|c(har)?|n(re|m)|z)alloc|alloc_(oversized|die)|m(alloc|emdup)|strdup)
+# But we can do better, in at least two ways:
+# 1) take advantage of two "dup"-suffixed strings:
+# x(((2n?)?re|c(har)?|n(re|m)|[mz])alloc|alloc_(oversized|die)|(mem|str)dup)
+# 2) notice that "c(har)?|[mz]" is equivalent to the shorter and more readable
+# "char|[cmz]"
+# x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup)
+_xa1 = x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup)
 _xa2 = X([CZ]|N?M)ALLOC
 sc_prohibit_xalloc_without_use:
        @h='"xalloc.h"' \
@@ -462,6 +518,13 @@ sc_GPL_version:
        @re='either ''version [^3]' msg='GPL vN, N!=3'                  \
          $(_prohibit_regexp)
 
+# Require the latest GFDL.  Two regexp, since some .texi files end up
+# line wrapping between 'Free Documentation License,' and 'Version'.
+_GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any)
+sc_GFDL_version:
+       @re='$(_GFDL_regexp)' msg='GFDL vN, N!=3'                       \
+         $(_prohibit_regexp)
+
 cvs_keywords = \
   Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
 
@@ -484,14 +547,20 @@ sc_prohibit_S_IS_definition:
        msg='do not define S_IS* macros; include <sys/stat.h>'          \
          $(_prohibit_regexp)
 
-# Each program that uses proper_name_utf8 must link with
-# one of the ICONV libraries.
+# Each program that uses proper_name_utf8 must link with one of the
+# ICONV libraries.  Otherwise, some ICONV library must appear in LDADD.
+# The perl -0777 invocation below extracts the possibly-multi-line
+# definition of LDADD from the appropriate Makefile.am and exits 0
+# when it contains "ICONV".
 sc_proper_name_utf8_requires_ICONV:
        @progs=$$(grep -l 'proper_name_utf8 ''("' $$($(VC_LIST_EXCEPT)));\
        if test "x$$progs" != x; then                                   \
          fail=0;                                                       \
          for p in $$progs; do                                          \
            dir=$$(dirname "$$p");                                      \
+           perl -0777                                                  \
+             -ne 'exit !(/^LDADD =(.+?[^\\]\n)/ms && $$1 =~ /ICONV/)'  \
+             $$dir/Makefile.am && continue;                            \
            base=$$(basename "$$p" .c);                                 \
            grep "$${base}_LDADD.*ICONV)" $$dir/Makefile.am > /dev/null \
              || { fail=1; echo 1>&2 "$(ME): $$p uses proper_name_utf8"; }; \
@@ -517,7 +586,8 @@ sc_const_long_option:
 NEWS_hash =                                                            \
   $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p'             \
        $(srcdir)/NEWS                                                  \
-     | grep -v '^Copyright .*Free Software'                            \
+     | perl -0777 -pe                                                  \
+       's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms'       \
      | md5sum -                                                                \
      | sed 's/ .*//')
 
@@ -539,19 +609,22 @@ update-NEWS-hash: NEWS
 # to emit a definition for each substituted variable.
 # We use perl rather than "grep -nE ..." to exempt a single
 # use of an @...@-delimited variable name in src/Makefile.am.
-sc_makefile_check:
-       @perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/'        \
+# Allow the package to add exceptions via a hook in cfg.mk;
+# for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by
+# setting this to ' && !/PRAGMA_SYSTEM_HEADER/'.
+_makefile_at_at_check_exceptions ?=
+sc_makefile_at_at_check:
+       @perl -ne '/\@[A-Z_0-9]+\@/'$(_makefile_at_at_check_exceptions) \
          -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'    \
            $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$')       \
          && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
 
-news-date-check: NEWS
-       today=`date +%Y-%m-%d`;                                         \
-       if head $(srcdir)/NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
+news-check: NEWS
+       if head $(srcdir)/NEWS | grep -E $(news-check-regexp)           \
            >/dev/null; then                                            \
          :;                                                            \
        else                                                            \
-         echo "version or today's date is not in NEWS" 1>&2;           \
+         echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2;      \
          exit 1;                                                       \
        fi
 
@@ -645,6 +718,14 @@ sc_copyright_check:
               exit 1; };                                               \
        fi
 
+# #if HAVE_... will evaluate to false for any non numeric string.
+# That would be flagged by using -Wundef, however gnulib currently
+# tests many undefined macros, and so we can't enable that option.
+# So at least preclude common boolean strings as macro values.
+sc_Wundef_boolean:
+       @grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
+         { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
+
 vc-diff-check:
        (unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
        if test -s vc-diffs; then                               \
@@ -655,23 +736,19 @@ vc-diff-check:
          rm vc-diffs;                                          \
        fi
 
-# Use this to make sure we don't run these programs when building
-# from a virgin tgz file, below.
-null_AM_MAKEFLAGS = \
-  ACLOCAL=false \
-  AUTOCONF=false \
-  AUTOMAKE=false \
-  AUTOHEADER=false \
-  MAKEINFO=false
-
-built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list)
-
 rel-files = $(DIST_ARCHIVES)
 
 gnulib_dir ?= $(srcdir)/gnulib
 gnulib-version = $$(cd $(gnulib_dir) && git describe)
 bootstrap-tools ?= autoconf,automake,gnulib
 
+# If it's not already specified, derive the GPG key ID from
+# the signed tag we've just applied to mark this release.
+gpg_key_ID ?= \
+  $$(git cat-file tag v$(VERSION) > .ann-sig \
+     && gpgv .ann-sig - < /dev/null 2>&1 \
+         | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
+
 announcement: NEWS ChangeLog $(rel-files)
        @$(build_aux)/announce-gen                                      \
            --release-type=$(RELEASE_TYPE)                              \
@@ -679,7 +756,7 @@ announcement: NEWS ChangeLog $(rel-files)
            --prev=$(PREV_VERSION)                                      \
            --curr=$(VERSION)                                           \
            --gpg-key-id=$(gpg_key_ID)                                  \
-           --news=NEWS                                                 \
+           --news=$(srcdir)/NEWS                                       \
            --bootstrap-tools=$(bootstrap-tools)                        \
            --gnulib-version=$(gnulib-version)                          \
            --no-print-checksums                                        \
@@ -698,7 +775,7 @@ emit_upload_commands:
        @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
        @echo "    --to $(gnu_rel_host):$(PACKAGE) \\"
        @echo "  $(rel-files)"
-       @echo '# send the /tmp/announcement e-mail'
+       @echo '# send the ~/announce-$(my_distdir) e-mail'
        @echo =====================================
        @echo =====================================
 
@@ -731,20 +808,30 @@ alpha beta stable: $(local-check) writable-files no-submodule-changes
               || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
          || :
        $(MAKE) vc-diff-check
-       $(MAKE) news-date-check
+       $(MAKE) news-check
        $(MAKE) distcheck
        $(MAKE) dist XZ_OPT=-9ev
-       $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
+       $(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
+       $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
+
+# Override this in cfg.mk if you follow different procedures.
+release-prep-hook ?= release-prep
+
+.PHONY: release-prep
+release-prep:
+       case $$RELEASE_TYPE in alpha|beta|stable) ;; \
+         *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac
+       $(MAKE) -s announcement > ~/announce-$(my_distdir)
        if test -d $(release_archive_dir); then                 \
          ln $(rel-files) $(release_archive_dir);               \
          chmod a-w $(rel-files);                               \
        fi
-       $(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
        echo $(VERSION) > $(prev_version_file)
        $(MAKE) update-NEWS-hash
        perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS
        $(emit-commit-log) > .ci-msg
        $(VC) commit -F .ci-msg -a
+       rm .ci-msg
 
 .PHONY: web-manual
 web-manual: