summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-12-02 15:59:17 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-12-04 19:17:50 +0100
commit8f0bf2fc4bfa06a8f44300f57bb40f143687cb5b (patch)
tree36fe4cda28b96549778e9a86623f9f7f7f382cd3
parentf6baeef550af8a4ba4805eef342b0f7327ec0554 (diff)
downloadgnutls-8f0bf2fc4bfa06a8f44300f57bb40f143687cb5b.tar.gz
gl: removed iconv module
It is no longer used by the library.
-rw-r--r--GNUmakefile2
-rwxr-xr-xbuild-aux/gendocs.sh44
-rw-r--r--build-aux/pmccabe2html8
-rw-r--r--build-aux/snippet/arg-nonnull.h2
-rw-r--r--build-aux/snippet/c++defs.h89
-rw-r--r--build-aux/snippet/warn-on-use.h2
-rwxr-xr-xbuild-aux/useless-if-before-free11
-rwxr-xr-xbuild-aux/vc-list-files6
-rw-r--r--doc/gendocs_template2
-rw-r--r--gl/Makefile.am33
-rw-r--r--gl/alloca.in.h2
-rw-r--r--gl/getdelim.c12
-rw-r--r--gl/iconv_open-aix.h256
-rw-r--r--gl/iconv_open-hpux.h299
-rw-r--r--gl/iconv_open-irix.h199
-rw-r--r--gl/iconv_open-osf.h278
-rw-r--r--gl/iconv_open-solaris.h190
-rw-r--r--gl/intprops.h98
-rw-r--r--gl/limits.in.h63
-rw-r--r--gl/m4/extensions.m444
-rw-r--r--gl/m4/gnulib-cache.m43
-rw-r--r--gl/m4/gnulib-comp.m413
-rw-r--r--gl/m4/iconv.m4271
-rw-r--r--gl/m4/limits-h.m431
-rw-r--r--gl/m4/manywarnings.m44
-rw-r--r--gl/m4/printf.m42
-rw-r--r--gl/m4/secure_getenv.m41
-rw-r--r--gl/m4/stdbool.m458
-rw-r--r--gl/m4/stdint.m461
-rw-r--r--gl/m4/stdio_h.m412
-rw-r--r--gl/m4/stdlib_h.m45
-rw-r--r--gl/m4/sys_types_h.m427
-rw-r--r--gl/m4/wchar_h.m414
-rw-r--r--gl/secure_getenv.c33
-rw-r--r--gl/stdint.in.h747
-rw-r--r--gl/stdlib.in.h15
-rw-r--r--gl/string.in.h16
-rw-r--r--gl/strverscmp.c102
-rw-r--r--gl/sys_socket.in.h5
-rw-r--r--gl/sys_time.in.h7
-rw-r--r--gl/tests/Makefile.am18
-rw-r--r--gl/tests/init.sh60
-rw-r--r--gl/tests/test-iconv.c148
-rwxr-xr-xgl/tests/test-init.sh3
-rw-r--r--gl/tests/test-intprops.c9
-rw-r--r--gl/tests/test-limits-h.c50
-rw-r--r--gl/tests/test-stdint.c67
-rw-r--r--gl/tests/test-strverscmp.c14
-rw-r--r--gl/vasnprintf.c4
-rw-r--r--gl/verify.h2
-rw-r--r--gl/wchar.in.h3
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/gnutls.pc.in2
-rw-r--r--maint.mk93
54 files changed, 1217 insertions, 2325 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 6617eec2e8..a869da5bff 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -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-2015 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2016 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/gendocs.sh b/build-aux/gendocs.sh
index c8ca1bbc4f..fef6280a21 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,9 +2,9 @@
# 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=2015-05-05.16
+scriptversion=2016-05-20.09
-# Copyright 2003-2015 Free Software Foundation, Inc.
+# Copyright 2003-2016 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
@@ -52,9 +52,27 @@ templateurl="http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_templ
unset CDPATH
unset use_texi2html
+MANUAL_TITLE=
+PACKAGE=
+EMAIL=webmasters@gnu.org # please override with --email
+commonarg= # passed to all makeinfo/texi2html invcations.
+dirargs= # passed to all tools (-I dir).
+dirs= # -I directories.
+htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
+infoarg=--no-split
+generate_ascii=true
+generate_html=true
+generate_info=true
+generate_tex=true
+outdir=manual
+source_extra=
+split=node
+srcfile=
+texarg="-t @finalout"
+
version="gendocs.sh $scriptversion
-Copyright 2015 Free Software Foundation, Inc.
+Copyright 2016 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
@@ -74,7 +92,7 @@ Options:
-I DIR append DIR to the Texinfo search path.
--common ARG pass ARG in all invocations.
--html ARG pass ARG to makeinfo or texi2html for HTML targets,
- instead of --css-ref=/software/gnulib/manual.css.
+ instead of '$htmlarg'.
--info ARG pass ARG to makeinfo for Info, instead of --no-split.
--no-ascii skip generating the plain text output.
--no-html skip generating the html output.
@@ -137,24 +155,6 @@ SETLANG setting in the source.
Email bug reports or enhancement requests to bug-gnulib@gnu.org.
"
-MANUAL_TITLE=
-PACKAGE=
-EMAIL=webmasters@gnu.org # please override with --email
-commonarg= # passed to all makeinfo/texi2html invcations.
-dirargs= # passed to all tools (-I dir).
-dirs= # -I directories.
-htmlarg=--css-ref=/software/gnulib/manual.css
-infoarg=--no-split
-generate_ascii=true
-generate_html=true
-generate_info=true
-generate_tex=true
-outdir=manual
-source_extra=
-split=node
-srcfile=
-texarg="-t @finalout"
-
while test $# -gt 0; do
case $1 in
-s) shift; srcfile=$1;;
diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
index 18984321f8..ca4d0b1f4d 100644
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -1,6 +1,6 @@
# pmccabe2html - AWK script to convert pmccabe output to html -*- awk -*-
-# Copyright (C) 2007-2015 Free Software Foundation, Inc.
+# Copyright (C) 2007-2016 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
@@ -422,9 +422,9 @@ function html_fnc (nfun,
while ((getline codeline < (fname nfun "_fn.txt")) > 0)
{
- gsub(/&/, "\&amp;", codeline) # Must come first.
- gsub(/</, "\&lt;", codeline)
- gsub(/>/, "\&gt;", codeline)
+ gsub(/&/, "\\&amp;", codeline) # Must come first.
+ gsub(/</, "\\&lt;", codeline)
+ gsub(/>/, "\\&gt;", codeline)
print codeline
}
diff --git a/build-aux/snippet/arg-nonnull.h b/build-aux/snippet/arg-nonnull.h
index 0d55e2bced..584649f694 100644
--- a/build-aux/snippet/arg-nonnull.h
+++ b/build-aux/snippet/arg-nonnull.h
@@ -1,5 +1,5 @@
/* A C macro for declaring that specific arguments must not be NULL.
- Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Copyright (C) 2009-2016 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
diff --git a/build-aux/snippet/c++defs.h b/build-aux/snippet/c++defs.h
index 585b38ab39..2b819da5e0 100644
--- a/build-aux/snippet/c++defs.h
+++ b/build-aux/snippet/c++defs.h
@@ -1,5 +1,5 @@
/* C++ compatible function declaration macros.
- Copyright (C) 2010-2015 Free Software Foundation, Inc.
+ Copyright (C) 2010-2016 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
@@ -17,6 +17,15 @@
#ifndef _GL_CXXDEFS_H
#define _GL_CXXDEFS_H
+/* Begin/end the GNULIB_NAMESPACE namespace. */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
+# define _GL_END_NAMESPACE }
+#else
+# define _GL_BEGIN_NAMESPACE
+# define _GL_END_NAMESPACE
+#endif
+
/* The three most frequent use cases of these macros are:
* For providing a substitute for a function that is missing on some
@@ -111,14 +120,25 @@
that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
Example:
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
- */
+
+ Wrapping rpl_func in an object with an inline conversion operator
+ avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
+ actually used in the program. */
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
#if defined __cplusplus && defined GNULIB_NAMESPACE
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- rettype (*const func) parameters = ::rpl_func; \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline operator type () const \
+ { \
+ return ::rpl_func; \
+ } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -135,8 +155,15 @@
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- rettype (*const func) parameters = \
- reinterpret_cast<rettype(*)parameters>(::rpl_func); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline operator type () const \
+ { \
+ return reinterpret_cast<type>(::rpl_func); \
+ } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -150,19 +177,24 @@
is defined.
Example:
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
- */
+
+ Wrapping func in an object with an inline conversion operator
+ avoids a reference to func unless GNULIB_NAMESPACE::func is
+ actually used in the program. */
#if defined __cplusplus && defined GNULIB_NAMESPACE
- /* If we were to write
- rettype (*const func) parameters = ::func;
- like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
- better (remove an indirection through a 'static' pointer variable),
- but then the _GL_CXXALIASWARN macro below would cause a warning not only
- for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
-# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
- namespace GNULIB_NAMESPACE \
- { \
- static rettype (*func) parameters = ::func; \
- } \
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+ namespace GNULIB_NAMESPACE \
+ { \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline operator type () const \
+ { \
+ return ::func; \
+ } \
+ } func = {}; \
+ } \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
@@ -178,8 +210,15 @@
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- static rettype (*func) parameters = \
- reinterpret_cast<rettype(*)parameters>(::func); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline operator type () const \
+ { \
+ return reinterpret_cast<type>(::func); \
+ } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -202,9 +241,15 @@
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
namespace GNULIB_NAMESPACE \
{ \
- static rettype (*func) parameters = \
- reinterpret_cast<rettype(*)parameters>( \
- (rettype2(*)parameters2)(::func)); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline operator type () const \
+ { \
+ return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
+ } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
diff --git a/build-aux/snippet/warn-on-use.h b/build-aux/snippet/warn-on-use.h
index 90f4985ce1..2948b47882 100644
--- a/build-aux/snippet/warn-on-use.h
+++ b/build-aux/snippet/warn-on-use.h
@@ -1,5 +1,5 @@
/* A C macro for emitting warnings if a function is used.
- Copyright (C) 2010-2015 Free Software Foundation, Inc.
+ Copyright (C) 2010-2016 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
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 82a09b39e5..d7a8c0dc61 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -1,16 +1,16 @@
-eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
+eval '(exit $?0)' && eval 'exec perl -wST "$0" "$@"'
& eval 'exec perl -wST "$0" $argv:q'
if 0;
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
-my $VERSION = '2012-01-06 07:23'; # UTC
+my $VERSION = '2016-08-01 17:47'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2008-2015 Free Software Foundation, Inc.
+# Copyright (C) 2008-2016 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
@@ -129,6 +129,9 @@ sub is_NULL ($)
$err = EXIT_ERROR, next;
while (defined (my $line = <FH>))
{
+ # Skip non-matching lines early to save time
+ $line =~ /\bif\b/
+ or next;
while ($line =~
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
# 1 2 3
@@ -202,6 +205,6 @@ EOF
## eval: (add-hook 'write-file-hooks 'time-stamp)
## time-stamp-start: "my $VERSION = '"
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
-## time-stamp-time-zone: "UTC"
+## time-stamp-time-zone: "UTC0"
## time-stamp-end: "'; # UTC"
## End:
diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
index 3bf93c3c03..c5c420a4bb 100755
--- a/build-aux/vc-list-files
+++ b/build-aux/vc-list-files
@@ -2,9 +2,9 @@
# List version-controlled file names.
# Print a version string.
-scriptversion=2011-05-16.22; # UTC
+scriptversion=2016-01-11.22; # UTC
-# Copyright (C) 2006-2015 Free Software Foundation, Inc.
+# Copyright (C) 2006-2016 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
@@ -108,6 +108,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
diff --git a/doc/gendocs_template b/doc/gendocs_template
index 86a5459f7b..3613c58fe0 100644
--- a/doc/gendocs_template
+++ b/doc/gendocs_template
@@ -84,7 +84,7 @@ the FSF. Broken links and other corrections or suggestions can be sent
to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
</div>
-<p>Copyright &copy; 2015 Free Software Foundation, Inc.</p>
+<p>Copyright &copy; 2016 Free Software Foundation, Inc.</p>
<p>This page is licensed under a <a rel="license"
href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 13eed87cdf..70708d5b80 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files --lgpl=2 alloca byteswap c-ctype extensions func gendocs getline gettext-h gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype extensions func gendocs getline gettext-h gettimeofday hash-pjw-bare havelib intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.9.6 gnits
@@ -51,7 +51,6 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
EXTRA_libgnu_la_SOURCES =
libgnu_la_LDFLAGS = $(AM_LDFLAGS)
libgnu_la_LDFLAGS += -no-undefined
-libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
## begin gnulib module absolute-header
@@ -288,6 +287,34 @@ EXTRA_DIST += intprops.h
## end gnulib module intprops
+## begin gnulib module limits-h
+
+BUILT_SOURCES += $(LIMITS_H)
+
+# We need the following in order to create <limits.h> when the system
+# doesn't have one that is compatible with GNU.
+if GL_GENERATE_LIMITS_H
+limits.h: limits.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \
+ < $(srcdir)/limits.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+limits.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += limits.h limits.h-t
+
+EXTRA_DIST += limits.in.h
+
+## end gnulib module limits-h
+
## begin gnulib module lseek
@@ -641,6 +668,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
+ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
@@ -866,6 +894,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
diff --git a/gl/alloca.in.h b/gl/alloca.in.h
index a87da81818..aa45ff06e4 100644
--- a/gl/alloca.in.h
+++ b/gl/alloca.in.h
@@ -51,6 +51,8 @@ extern "C"
void *_alloca (unsigned short);
# pragma intrinsic (_alloca)
# define alloca _alloca
+# elif defined __MVS__
+# include <stdlib.h>
# else
# include <stddef.h>
# ifdef __cplusplus
diff --git a/gl/getdelim.c b/gl/getdelim.c
index 46f145aba4..18167cb772 100644
--- a/gl/getdelim.c
+++ b/gl/getdelim.c
@@ -47,6 +47,16 @@
# define getc_maybe_unlocked(fp) getc_unlocked(fp)
#endif
+static void
+alloc_failed (void)
+{
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* Avoid errno problem without using the realloc module; see:
+ http://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00025.html */
+ errno = ENOMEM;
+#endif
+}
+
/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
NULL), pointing to *N characters of space. It is realloc'ed as
@@ -74,6 +84,7 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
new_lineptr = (char *) realloc (*lineptr, *n);
if (new_lineptr == NULL)
{
+ alloc_failed ();
result = -1;
goto unlock_return;
}
@@ -111,6 +122,7 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL)
{
+ alloc_failed ();
result = -1;
goto unlock_return;
}
diff --git a/gl/iconv_open-aix.h b/gl/iconv_open-aix.h
deleted file mode 100644
index 0ffc3fef16..0000000000
--- a/gl/iconv_open-aix.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -m 10 ./iconv_open-aix.gperf */
-/* Computed positions: -k'4,$' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "./iconv_open-aix.gperf"
-struct mapping { int standard_name; const char vendor_name[10 + 1]; };
-
-#define TOTAL_KEYWORDS 32
-#define MIN_WORD_LENGTH 4
-#define MAX_WORD_LENGTH 11
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 44
-/* maximum key range = 39, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-mapping_hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 0, 4, 25,
- 0, 11, 24, 9, 17, 3, 14, 21, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 3, 45, 1, 45, 45, 45, 45, 0, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45
- };
- return len + asso_values[(unsigned char)str[3]+2] + asso_values[(unsigned char)str[len - 1]];
-}
-
-struct stringpool_t
- {
- char stringpool_str6[sizeof("EUC-TW")];
- char stringpool_str7[sizeof("EUC-KR")];
- char stringpool_str8[sizeof("CP852")];
- char stringpool_str9[sizeof("EUC-JP")];
- char stringpool_str10[sizeof("ISO-8859-2")];
- char stringpool_str11[sizeof("CP857")];
- char stringpool_str12[sizeof("CP850")];
- char stringpool_str13[sizeof("ISO-8859-7")];
- char stringpool_str14[sizeof("CP932")];
- char stringpool_str15[sizeof("GB2312")];
- char stringpool_str16[sizeof("BIG5")];
- char stringpool_str17[sizeof("CP437")];
- char stringpool_str19[sizeof("ISO-8859-5")];
- char stringpool_str20[sizeof("ISO-8859-15")];
- char stringpool_str21[sizeof("ISO-8859-3")];
- char stringpool_str22[sizeof("ISO-8859-13")];
- char stringpool_str23[sizeof("CP1046")];
- char stringpool_str24[sizeof("ISO-8859-8")];
- char stringpool_str25[sizeof("CP856")];
- char stringpool_str26[sizeof("CP1125")];
- char stringpool_str27[sizeof("ISO-8859-6")];
- char stringpool_str28[sizeof("CP865")];
- char stringpool_str29[sizeof("CP922")];
- char stringpool_str30[sizeof("CP1252")];
- char stringpool_str31[sizeof("ISO-8859-9")];
- char stringpool_str33[sizeof("CP943")];
- char stringpool_str34[sizeof("ISO-8859-4")];
- char stringpool_str35[sizeof("ISO-8859-1")];
- char stringpool_str38[sizeof("CP1129")];
- char stringpool_str40[sizeof("CP869")];
- char stringpool_str41[sizeof("CP1124")];
- char stringpool_str44[sizeof("CP861")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "EUC-TW",
- "EUC-KR",
- "CP852",
- "EUC-JP",
- "ISO-8859-2",
- "CP857",
- "CP850",
- "ISO-8859-7",
- "CP932",
- "GB2312",
- "BIG5",
- "CP437",
- "ISO-8859-5",
- "ISO-8859-15",
- "ISO-8859-3",
- "ISO-8859-13",
- "CP1046",
- "ISO-8859-8",
- "CP856",
- "CP1125",
- "ISO-8859-6",
- "CP865",
- "CP922",
- "CP1252",
- "ISO-8859-9",
- "CP943",
- "ISO-8859-4",
- "ISO-8859-1",
- "CP1129",
- "CP869",
- "CP1124",
- "CP861"
- };
-#define stringpool ((const char *) &stringpool_contents)
-
-static const struct mapping mappings[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 43 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "IBM-eucTW"},
-#line 42 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str7, "IBM-eucKR"},
-#line 25 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str8, "IBM-852"},
-#line 41 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str9, "IBM-eucJP"},
-#line 14 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-2"},
-#line 27 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "IBM-857"},
-#line 24 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "IBM-850"},
-#line 19 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-7"},
-#line 33 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "IBM-932"},
-#line 40 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "IBM-eucCN"},
-#line 44 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "big5"},
-#line 23 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "IBM-437"},
- {-1},
-#line 17 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-5"},
-#line 22 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-15"},
-#line 15 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-3"},
-#line 31 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str22, "IBM-921"},
-#line 35 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str23, "IBM-1046"},
-#line 20 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str24, "ISO8859-8"},
-#line 26 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str25, "IBM-856"},
-#line 37 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str26, "IBM-1125"},
-#line 18 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"},
-#line 29 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str28, "IBM-865"},
-#line 32 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str29, "IBM-922"},
-#line 39 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str30, "IBM-1252"},
-#line 21 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str31, "ISO8859-9"},
- {-1},
-#line 34 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str33, "IBM-943"},
-#line 16 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str34, "ISO8859-4"},
-#line 13 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str35, "ISO8859-1"},
- {-1}, {-1},
-#line 38 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str38, "IBM-1129"},
- {-1},
-#line 30 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str40, "IBM-869"},
-#line 36 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str41, "IBM-1124"},
- {-1}, {-1},
-#line 28 "./iconv_open-aix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str44, "IBM-861"}
- };
-
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct mapping *
-mapping_lookup (register const char *str, register unsigned int len)
-{
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = mapping_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = mappings[key].standard_name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &mappings[key];
- }
- }
- }
- return 0;
-}
diff --git a/gl/iconv_open-hpux.h b/gl/iconv_open-hpux.h
deleted file mode 100644
index 8f9f0a9ad4..0000000000
--- a/gl/iconv_open-hpux.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -m 10 ./iconv_open-hpux.gperf */
-/* Computed positions: -k'4,$' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "./iconv_open-hpux.gperf"
-struct mapping { int standard_name; const char vendor_name[9 + 1]; };
-
-#define TOTAL_KEYWORDS 44
-#define MIN_WORD_LENGTH 4
-#define MAX_WORD_LENGTH 11
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 49
-/* maximum key range = 44, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-mapping_hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 1, 2,
- 24, 43, 5, 10, 0, 13, 32, 3, 19, 18,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 5,
- 50, 50, 50, 50, 14, 5, 0, 50, 50, 0,
- 27, 50, 12, 14, 50, 50, 0, 5, 2, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 50
- };
- return len + asso_values[(unsigned char)str[3]+4] + asso_values[(unsigned char)str[len - 1]];
-}
-
-struct stringpool_t
- {
- char stringpool_str6[sizeof("CP1256")];
- char stringpool_str7[sizeof("CP1250")];
- char stringpool_str8[sizeof("CP1251")];
- char stringpool_str9[sizeof("CP850")];
- char stringpool_str10[sizeof("TIS-620")];
- char stringpool_str11[sizeof("CP1254")];
- char stringpool_str12[sizeof("ISO-8859-6")];
- char stringpool_str13[sizeof("EUC-TW")];
- char stringpool_str14[sizeof("ISO-8859-1")];
- char stringpool_str15[sizeof("ISO-8859-9")];
- char stringpool_str16[sizeof("CP1255")];
- char stringpool_str17[sizeof("BIG5")];
- char stringpool_str18[sizeof("CP855")];
- char stringpool_str19[sizeof("CP1257")];
- char stringpool_str20[sizeof("EUC-KR")];
- char stringpool_str21[sizeof("CP857")];
- char stringpool_str22[sizeof("ISO-8859-5")];
- char stringpool_str23[sizeof("ISO-8859-15")];
- char stringpool_str24[sizeof("CP866")];
- char stringpool_str25[sizeof("ISO-8859-7")];
- char stringpool_str26[sizeof("CP861")];
- char stringpool_str27[sizeof("CP869")];
- char stringpool_str28[sizeof("CP874")];
- char stringpool_str29[sizeof("CP864")];
- char stringpool_str30[sizeof("CP1252")];
- char stringpool_str31[sizeof("CP437")];
- char stringpool_str32[sizeof("CP852")];
- char stringpool_str33[sizeof("CP775")];
- char stringpool_str34[sizeof("CP865")];
- char stringpool_str35[sizeof("EUC-JP")];
- char stringpool_str36[sizeof("ISO-8859-2")];
- char stringpool_str37[sizeof("SHIFT_JIS")];
- char stringpool_str38[sizeof("CP1258")];
- char stringpool_str39[sizeof("UTF-8")];
- char stringpool_str40[sizeof("HP-KANA8")];
- char stringpool_str41[sizeof("HP-ROMAN8")];
- char stringpool_str42[sizeof("HP-HEBREW8")];
- char stringpool_str43[sizeof("GB2312")];
- char stringpool_str44[sizeof("ISO-8859-8")];
- char stringpool_str45[sizeof("HP-TURKISH8")];
- char stringpool_str46[sizeof("HP-GREEK8")];
- char stringpool_str47[sizeof("HP-ARABIC8")];
- char stringpool_str48[sizeof("CP862")];
- char stringpool_str49[sizeof("CP1253")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "CP1256",
- "CP1250",
- "CP1251",
- "CP850",
- "TIS-620",
- "CP1254",
- "ISO-8859-6",
- "EUC-TW",
- "ISO-8859-1",
- "ISO-8859-9",
- "CP1255",
- "BIG5",
- "CP855",
- "CP1257",
- "EUC-KR",
- "CP857",
- "ISO-8859-5",
- "ISO-8859-15",
- "CP866",
- "ISO-8859-7",
- "CP861",
- "CP869",
- "CP874",
- "CP864",
- "CP1252",
- "CP437",
- "CP852",
- "CP775",
- "CP865",
- "EUC-JP",
- "ISO-8859-2",
- "SHIFT_JIS",
- "CP1258",
- "UTF-8",
- "HP-KANA8",
- "HP-ROMAN8",
- "HP-HEBREW8",
- "GB2312",
- "ISO-8859-8",
- "HP-TURKISH8",
- "HP-GREEK8",
- "HP-ARABIC8",
- "CP862",
- "CP1253"
- };
-#define stringpool ((const char *) &stringpool_contents)
-
-static const struct mapping mappings[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 40 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "cp1256"},
-#line 34 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str7, "cp1250"},
-#line 35 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str8, "cp1251"},
-#line 23 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str9, "cp850"},
-#line 49 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "tis620"},
-#line 38 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "cp1254"},
-#line 16 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "iso88596"},
-#line 53 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "eucTW"},
-#line 13 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "iso88591"},
-#line 19 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "iso88599"},
-#line 39 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "cp1255"},
-#line 54 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "big5"},
-#line 25 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str18, "cp855"},
-#line 41 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "cp1257"},
-#line 52 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str20, "eucKR"},
-#line 26 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str21, "cp857"},
-#line 15 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str22, "iso88595"},
-#line 20 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str23, "iso885915"},
-#line 31 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str24, "cp866"},
-#line 17 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str25, "iso88597"},
-#line 27 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str26, "cp861"},
-#line 32 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str27, "cp869"},
-#line 33 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str28, "cp874"},
-#line 29 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str29, "cp864"},
-#line 36 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"},
-#line 21 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str31, "cp437"},
-#line 24 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str32, "cp852"},
-#line 22 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str33, "cp775"},
-#line 30 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str34, "cp865"},
-#line 51 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str35, "eucJP"},
-#line 14 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str36, "iso88592"},
-#line 55 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str37, "sjis"},
-#line 42 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str38, "cp1258"},
-#line 56 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str39, "utf8"},
-#line 48 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str40, "kana8"},
-#line 43 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str41, "roman8"},
-#line 46 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str42, "hebrew8"},
-#line 50 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str43, "hp15CN"},
-#line 18 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str44, "iso88598"},
-#line 47 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str45, "turkish8"},
-#line 45 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str46, "greek8"},
-#line 44 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str47, "arabic8"},
-#line 28 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str48, "cp862"},
-#line 37 "./iconv_open-hpux.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str49, "cp1253"}
- };
-
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct mapping *
-mapping_lookup (register const char *str, register unsigned int len)
-{
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = mapping_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = mappings[key].standard_name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &mappings[key];
- }
- }
- }
- return 0;
-}
diff --git a/gl/iconv_open-irix.h b/gl/iconv_open-irix.h
deleted file mode 100644
index 520582e52e..0000000000
--- a/gl/iconv_open-irix.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -m 10 ./iconv_open-irix.gperf */
-/* Computed positions: -k'1,$' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "./iconv_open-irix.gperf"
-struct mapping { int standard_name; const char vendor_name[10 + 1]; };
-
-#define TOTAL_KEYWORDS 19
-#define MIN_WORD_LENGTH 5
-#define MAX_WORD_LENGTH 11
-#define MIN_HASH_VALUE 5
-#define MAX_HASH_VALUE 23
-/* maximum key range = 19, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-mapping_hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 8, 2,
- 5, 12, 11, 0, 10, 9, 8, 7, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 0, 24, 0,
- 24, 5, 24, 0, 24, 7, 24, 24, 24, 24,
- 7, 24, 1, 0, 8, 24, 24, 0, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24
- };
- return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
-}
-
-struct stringpool_t
- {
- char stringpool_str5[sizeof("CP855")];
- char stringpool_str6[sizeof("EUC-TW")];
- char stringpool_str7[sizeof("EUC-KR")];
- char stringpool_str8[sizeof("CP1251")];
- char stringpool_str9[sizeof("SHIFT_JIS")];
- char stringpool_str10[sizeof("ISO-8859-5")];
- char stringpool_str11[sizeof("ISO-8859-15")];
- char stringpool_str12[sizeof("ISO-8859-1")];
- char stringpool_str13[sizeof("EUC-JP")];
- char stringpool_str14[sizeof("KOI8-R")];
- char stringpool_str15[sizeof("ISO-8859-2")];
- char stringpool_str16[sizeof("GB2312")];
- char stringpool_str17[sizeof("ISO-8859-9")];
- char stringpool_str18[sizeof("ISO-8859-8")];
- char stringpool_str19[sizeof("ISO-8859-7")];
- char stringpool_str20[sizeof("ISO-8859-6")];
- char stringpool_str21[sizeof("ISO-8859-4")];
- char stringpool_str22[sizeof("ISO-8859-3")];
- char stringpool_str23[sizeof("TIS-620")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "CP855",
- "EUC-TW",
- "EUC-KR",
- "CP1251",
- "SHIFT_JIS",
- "ISO-8859-5",
- "ISO-8859-15",
- "ISO-8859-1",
- "EUC-JP",
- "KOI8-R",
- "ISO-8859-2",
- "GB2312",
- "ISO-8859-9",
- "ISO-8859-8",
- "ISO-8859-7",
- "ISO-8859-6",
- "ISO-8859-4",
- "ISO-8859-3",
- "TIS-620"
- };
-#define stringpool ((const char *) &stringpool_contents)
-
-static const struct mapping mappings[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 24 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str5, "DOS855"},
-#line 29 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "eucTW"},
-#line 28 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str7, "eucKR"},
-#line 25 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str8, "WIN1251"},
-#line 30 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str9, "sjis"},
-#line 17 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-5"},
-#line 22 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"},
-#line 13 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-1"},
-#line 27 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "eucJP"},
-#line 23 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "KOI8"},
-#line 14 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-2"},
-#line 26 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "eucCN"},
-#line 21 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-9"},
-#line 20 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-8"},
-#line 19 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-7"},
-#line 18 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-6"},
-#line 16 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-4"},
-#line 15 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-3"},
-#line 31 "./iconv_open-irix.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str23, "TIS620"}
- };
-
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct mapping *
-mapping_lookup (register const char *str, register unsigned int len)
-{
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = mapping_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = mappings[key].standard_name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &mappings[key];
- }
- }
- }
- return 0;
-}
diff --git a/gl/iconv_open-osf.h b/gl/iconv_open-osf.h
deleted file mode 100644
index 85e4c0f8fd..0000000000
--- a/gl/iconv_open-osf.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -m 10 ./iconv_open-osf.gperf */
-/* Computed positions: -k'4,$' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "./iconv_open-osf.gperf"
-struct mapping { int standard_name; const char vendor_name[10 + 1]; };
-
-#define TOTAL_KEYWORDS 38
-#define MIN_WORD_LENGTH 4
-#define MAX_WORD_LENGTH 11
-#define MIN_HASH_VALUE 6
-#define MAX_HASH_VALUE 47
-/* maximum key range = 42, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-mapping_hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 2, 29,
- 24, 34, 31, 0, 15, 14, 10, 13, 2, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 7, 48, 48, 48, 48, 48, 48,
- 11, 48, 2, 7, 48, 48, 48, 1, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48
- };
- return len + asso_values[(unsigned char)str[3]+3] + asso_values[(unsigned char)str[len - 1]];
-}
-
-struct stringpool_t
- {
- char stringpool_str6[sizeof("CP1255")];
- char stringpool_str7[sizeof("CP775")];
- char stringpool_str8[sizeof("CP1250")];
- char stringpool_str9[sizeof("EUC-TW")];
- char stringpool_str10[sizeof("EUC-KR")];
- char stringpool_str11[sizeof("TIS-620")];
- char stringpool_str12[sizeof("ISO-8859-5")];
- char stringpool_str13[sizeof("ISO-8859-15")];
- char stringpool_str14[sizeof("BIG5")];
- char stringpool_str15[sizeof("CP855")];
- char stringpool_str16[sizeof("CP1258")];
- char stringpool_str17[sizeof("CP850")];
- char stringpool_str18[sizeof("CP865")];
- char stringpool_str19[sizeof("EUC-JP")];
- char stringpool_str20[sizeof("CP1257")];
- char stringpool_str21[sizeof("CP1256")];
- char stringpool_str22[sizeof("ISO-8859-8")];
- char stringpool_str23[sizeof("SHIFT_JIS")];
- char stringpool_str25[sizeof("ISO-8859-9")];
- char stringpool_str26[sizeof("ISO-8859-7")];
- char stringpool_str27[sizeof("ISO-8859-6")];
- char stringpool_str29[sizeof("CP857")];
- char stringpool_str30[sizeof("CP1252")];
- char stringpool_str31[sizeof("CP869")];
- char stringpool_str32[sizeof("CP949")];
- char stringpool_str33[sizeof("CP866")];
- char stringpool_str34[sizeof("CP437")];
- char stringpool_str35[sizeof("CP1251")];
- char stringpool_str36[sizeof("ISO-8859-2")];
- char stringpool_str37[sizeof("CP1254")];
- char stringpool_str38[sizeof("CP874")];
- char stringpool_str39[sizeof("CP852")];
- char stringpool_str40[sizeof("CP1253")];
- char stringpool_str41[sizeof("ISO-8859-1")];
- char stringpool_str42[sizeof("CP862")];
- char stringpool_str43[sizeof("ISO-8859-4")];
- char stringpool_str46[sizeof("ISO-8859-3")];
- char stringpool_str47[sizeof("CP861")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "CP1255",
- "CP775",
- "CP1250",
- "EUC-TW",
- "EUC-KR",
- "TIS-620",
- "ISO-8859-5",
- "ISO-8859-15",
- "BIG5",
- "CP855",
- "CP1258",
- "CP850",
- "CP865",
- "EUC-JP",
- "CP1257",
- "CP1256",
- "ISO-8859-8",
- "SHIFT_JIS",
- "ISO-8859-9",
- "ISO-8859-7",
- "ISO-8859-6",
- "CP857",
- "CP1252",
- "CP869",
- "CP949",
- "CP866",
- "CP437",
- "CP1251",
- "ISO-8859-2",
- "CP1254",
- "CP874",
- "CP852",
- "CP1253",
- "ISO-8859-1",
- "CP862",
- "ISO-8859-4",
- "ISO-8859-3",
- "CP861"
- };
-#define stringpool ((const char *) &stringpool_contents)
-
-static const struct mapping mappings[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 41 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "cp1255"},
-#line 24 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str7, "cp775"},
-#line 36 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str8, "cp1250"},
-#line 47 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str9, "eucTW"},
-#line 46 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "eucKR"},
-#line 50 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "TACTIS"},
-#line 17 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-5"},
-#line 22 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-15"},
-#line 48 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "big5"},
-#line 27 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "cp855"},
-#line 44 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "cp1258"},
-#line 25 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "cp850"},
-#line 31 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str18, "cp865"},
-#line 45 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "eucJP"},
-#line 43 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str20, "cp1257"},
-#line 42 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str21, "cp1256"},
-#line 20 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-8"},
-#line 49 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str23, "SJIS"},
- {-1},
-#line 21 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str25, "ISO8859-9"},
-#line 19 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str26, "ISO8859-7"},
-#line 18 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"},
- {-1},
-#line 28 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str29, "cp857"},
-#line 38 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"},
-#line 33 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str31, "cp869"},
-#line 35 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str32, "KSC5601"},
-#line 32 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str33, "cp866"},
-#line 23 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str34, "cp437"},
-#line 37 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str35, "cp1251"},
-#line 14 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str36, "ISO8859-2"},
-#line 40 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str37, "cp1254"},
-#line 34 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str38, "cp874"},
-#line 26 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str39, "cp852"},
-#line 39 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str40, "cp1253"},
-#line 13 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str41, "ISO8859-1"},
-#line 30 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str42, "cp862"},
-#line 16 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str43, "ISO8859-4"},
- {-1}, {-1},
-#line 15 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str46, "ISO8859-3"},
-#line 29 "./iconv_open-osf.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str47, "cp861"}
- };
-
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct mapping *
-mapping_lookup (register const char *str, register unsigned int len)
-{
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = mapping_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = mappings[key].standard_name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &mappings[key];
- }
- }
- }
- return 0;
-}
diff --git a/gl/iconv_open-solaris.h b/gl/iconv_open-solaris.h
deleted file mode 100644
index 2963145be8..0000000000
--- a/gl/iconv_open-solaris.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -m 10 ./iconv_open-solaris.gperf */
-/* Computed positions: -k'10' */
-
-#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
- && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
- && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
- && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
- && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
- && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
- && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
- && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
- && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
- && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
- && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
- && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
- && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
- && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
- && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
- && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
- && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
- && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
- && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
- && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
- && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
- && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
-/* The character set is not based on ISO-646. */
-#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
-#endif
-
-#line 1 "./iconv_open-solaris.gperf"
-struct mapping { int standard_name; const char vendor_name[10 + 1]; };
-
-#define TOTAL_KEYWORDS 13
-#define MIN_WORD_LENGTH 5
-#define MAX_WORD_LENGTH 11
-#define MIN_HASH_VALUE 5
-#define MAX_HASH_VALUE 19
-/* maximum key range = 15, duplicates = 0 */
-
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-mapping_hash (register const char *str, register unsigned int len)
-{
- static const unsigned char asso_values[] =
- {
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 0,
- 9, 8, 7, 6, 5, 4, 3, 2, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20
- };
- register int hval = len;
-
- switch (hval)
- {
- default:
- hval += asso_values[(unsigned char)str[9]];
- /*FALLTHROUGH*/
- case 9:
- case 8:
- case 7:
- case 6:
- case 5:
- break;
- }
- return hval;
-}
-
-struct stringpool_t
- {
- char stringpool_str5[sizeof("ASCII")];
- char stringpool_str6[sizeof("CP1251")];
- char stringpool_str7[sizeof("$ abc")];
- char stringpool_str10[sizeof("ISO-8859-1")];
- char stringpool_str11[sizeof("ISO-8859-15")];
- char stringpool_str12[sizeof("ISO-8859-9")];
- char stringpool_str13[sizeof("ISO-8859-8")];
- char stringpool_str14[sizeof("ISO-8859-7")];
- char stringpool_str15[sizeof("ISO-8859-6")];
- char stringpool_str16[sizeof("ISO-8859-5")];
- char stringpool_str17[sizeof("ISO-8859-4")];
- char stringpool_str18[sizeof("ISO-8859-3")];
- char stringpool_str19[sizeof("ISO-8859-2")];
- };
-static const struct stringpool_t stringpool_contents =
- {
- "ASCII",
- "CP1251",
- "$ abc",
- "ISO-8859-1",
- "ISO-8859-15",
- "ISO-8859-9",
- "ISO-8859-8",
- "ISO-8859-7",
- "ISO-8859-6",
- "ISO-8859-5",
- "ISO-8859-4",
- "ISO-8859-3",
- "ISO-8859-2"
- };
-#define stringpool ((const char *) &stringpool_contents)
-
-static const struct mapping mappings[] =
- {
- {-1}, {-1}, {-1}, {-1}, {-1},
-#line 19 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str5, "646"},
-#line 30 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str6, "ansi-1251"},
-#line 18 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str7},
- {-1}, {-1},
-#line 20 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-1"},
-#line 29 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"},
-#line 28 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-9"},
-#line 27 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-8"},
-#line 26 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"},
-#line 25 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-6"},
-#line 24 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str16, "ISO8859-5"},
-#line 23 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-4"},
-#line 22 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-3"},
-#line 21 "./iconv_open-solaris.gperf"
- {(int)(long)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-2"}
- };
-
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
-const struct mapping *
-mapping_lookup (register const char *str, register unsigned int len)
-{
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = mapping_hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int o = mappings[key].standard_name;
- if (o >= 0)
- {
- register const char *s = o + stringpool;
-
- if (*str == *s && !strcmp (str + 1, s + 1))
- return &mappings[key];
- }
- }
- }
- return 0;
-}
diff --git a/gl/intprops.h b/gl/intprops.h
index 0be799dfe3..716741adc5 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -23,6 +23,10 @@
#include <limits.h>
#include <verify.h>
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
/* Return a value with the common real type of E and V and the value of V. */
#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
@@ -47,12 +51,16 @@
/* Minimum and maximum values for integer types and expressions. */
+/* The width in bits of the integer type or expression T.
+ Padding bits are not supported; this is checked at compile-time below. */
+#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
+
/* The maximum and minimum values for the integer type T. */
#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t))
#define TYPE_MAXIMUM(t) \
((t) (! TYPE_SIGNED (t) \
? (t) -1 \
- : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+ : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
/* The maximum and minimum values for the type of the expression E,
after integer promotion. E should not have side effects. */
@@ -65,7 +73,13 @@
? _GL_SIGNED_INT_MAXIMUM (e) \
: _GL_INT_NEGATE_CONVERT (e, 1))
#define _GL_SIGNED_INT_MAXIMUM(e) \
- (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
+ (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
+
+/* Work around OpenVMS incompatibility with C99. */
+#if !defined LLONG_MAX && defined __INT64_MAX
+# define LLONG_MAX __INT64_MAX
+# define LLONG_MIN __INT64_MIN
+#endif
/* This include file assumes that signed types are two's complement without
padding bits; the above macros have undefined behavior otherwise.
@@ -84,10 +98,15 @@ verify (TYPE_MAXIMUM (long int) == LONG_MAX);
verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
#endif
+/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */
+#ifdef UINT_WIDTH
+verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
+#endif
/* Does the __typeof__ keyword work? This could be done by
'configure', but for now it's easier to do it by hand. */
-#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+#if (2 <= __GNUC__ \
+ || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
|| (0x5110 <= __SUNPRO_C && !__STDC__))
# define _GL_HAVE___TYPEOF__ 1
#else
@@ -116,8 +135,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
signed, this macro may overestimate the true bound by one byte when
applied to unsigned types of size 2, 4, 16, ... bytes. */
#define INT_STRLEN_BOUND(t) \
- (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \
- - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+ (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
+ _GL_SIGNED_TYPE_OR_EXPR (t))
/* Bound on buffer size needed to represent an integer type or expression T,
@@ -222,24 +240,40 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
? (a) < (min) >> (b) \
: (max) >> (b) < (a))
+/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
+#define _GL_HAS_BUILTIN_OVERFLOW \
+ (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow))
+
+/* True if __builtin_add_overflow_p (A, B, C) works. */
+#define _GL_HAS_BUILTIN_OVERFLOW_P \
+ (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p))
/* The _GL*_OVERFLOW macros have the same restrictions as the
*_RANGE_OVERFLOW macros, except that they do not assume that operands
(e.g., A and B) have the same type as MIN and MAX. Instead, they assume
that the result (e.g., A + B) has that type. */
-#define _GL_ADD_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? (b) <= (a) + (b) \
- : (b) < 0 ? (a) <= (a) + (b) \
- : (a) + (b) < (b))
-#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
- ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
- : (a) < 0 ? 1 \
- : (b) < 0 ? (a) - (b) <= (a) \
- : (a) < (b))
-#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
- (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
- || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define _GL_ADD_OVERFLOW(a, b, min, max) \
+ __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
+ __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
+ __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
+#else
+# define _GL_ADD_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? (b) <= (a) + (b) \
+ : (b) < 0 ? (a) <= (a) + (b) \
+ : (a) + (b) < (b))
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \
+ ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
+ : (a) < 0 ? 1 \
+ : (b) < 0 ? (a) - (b) <= (a) \
+ : (a) < (b))
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \
+ (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
+ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#endif
#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
: (a) < 0 ? (b) <= (a) + (b) - 1 \
@@ -304,8 +338,12 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
_GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
#define INT_SUBTRACT_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
-#define INT_NEGATE_OVERFLOW(a) \
- INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#if _GL_HAS_BUILTIN_OVERFLOW_P
+# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a)
+#else
+# define INT_NEGATE_OVERFLOW(a) \
+ INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#endif
#define INT_MULTIPLY_OVERFLOW(a, b) \
_GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
#define INT_DIVIDE_OVERFLOW(a, b) \
@@ -325,7 +363,7 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
_GL_INT_MINIMUM (0 * (b) + (a)), \
_GL_INT_MAXIMUM (0 * (b) + (a)))
-/* Compute A + B, A - B, A * B, respectively, storing the result into *R.
+/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
Return 1 if the result overflows. See above for restrictions. */
#define INT_ADD_WRAPV(a, b, r) \
_GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
@@ -334,10 +372,6 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
#define INT_MULTIPLY_WRAPV(a, b, r) \
_GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
https://llvm.org/bugs/show_bug.cgi?id=25390
@@ -350,10 +384,11 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
# define _GL__GENERIC_BOGUS 0
#endif
-/* Store A <op> B into *R, where OP specifies the operation.
- BUILTIN is the builtin operation, and OVERFLOW the overflow predicate.
- See above for restrictions. */
-#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)
+/* Store the low-order bits of A <op> B into *R, where OP specifies
+ the operation. BUILTIN is the builtin operation, and OVERFLOW the
+ overflow predicate. Return 1 if the result overflows. See above
+ for restrictions. */
+#if _GL_HAS_BUILTIN_OVERFLOW
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
@@ -396,14 +431,15 @@ verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
# else
# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
_GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
- long int, LONG_MIN, LONG_MAX))
+ long int, LONG_MIN, LONG_MAX)
# endif
#endif
/* Store the low-order bits of A <op> B into *R, where the operation
is given by OP. Use the unsigned type UT for calculation to avoid
overflow problems. *R's type is T, with extremal values TMIN and
- TMAX. T must be a signed integer type. */
+ TMAX. T must be a signed integer type. Return 1 if the result
+ overflows. */
#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
(sizeof ((a) op (b)) < sizeof (t) \
? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
diff --git a/gl/limits.in.h b/gl/limits.in.h
new file mode 100644
index 0000000000..353084a133
--- /dev/null
+++ b/gl/limits.in.h
@@ -0,0 +1,63 @@
+/* A GNU-like <limits.h>.
+
+ Copyright 2016 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard. */
+#@INCLUDE_NEXT@ @NEXT_LIMITS_H@
+
+#ifndef _@GUARD_PREFIX@_LIMITS_H
+#define _@GUARD_PREFIX@_LIMITS_H
+
+/* The number of usable bits in an unsigned or signed integer type
+ with minimum value MIN and maximum value MAX, as an int expression
+ suitable in #if. Cover all known practical hosts. This
+ implementation exploits the fact that MAX is 1 less than a power of
+ 2, and merely counts the number of 1 bits in MAX; "COBn" means
+ "count the number of 1 bits in the low-order n bits"). */
+#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max))
+#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n))
+#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n))
+#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n))
+#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n))
+#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n))
+#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1))
+
+/* Macros specified by ISO/IEC TS 18661-1:2014. */
+
+#if (! defined ULLONG_WIDTH \
+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
+# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
+# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
+# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
+# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX)
+# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX)
+# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX)
+# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX)
+# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX)
+# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
+# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
+# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
+#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
+
+#endif /* _@GUARD_PREFIX@_LIMITS_H */
+#endif /* _@GUARD_PREFIX@_LIMITS_H */
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 6d378ec41c..e114a6f729 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 13 -*- Autoconf -*-
+# serial 15 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc.
@@ -60,7 +60,7 @@ dnl configure.ac when using autoheader 2.62.
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
-/* Enable general extensions on OS X. */
+/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
@@ -68,14 +68,38 @@ dnl configure.ac when using autoheader 2.62.
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
-/* Use GNU style printf and scanf. */
-#ifndef __USE_MINGW_ANSI_STDIO
-# undef __USE_MINGW_ANSI_STDIO
-#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# undef __STDC_WANT_IEC_60559_DFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# undef __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009. */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# undef __STDC_WANT_MATH_SPEC_FUNCS__
+#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
@@ -104,8 +128,14 @@ dnl configure.ac when using autoheader 2.62.
AC_DEFINE([_ALL_SOURCE])
AC_DEFINE([_DARWIN_C_SOURCE])
AC_DEFINE([_GNU_SOURCE])
- AC_DEFINE([__USE_MINGW_ANSI_STDIO])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+ AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
+ AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
+ AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
+ AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
+ AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
+ AC_DEFINE([__STDC_WANT_LIB_EXT2__])
+ AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
AC_DEFINE([_TANDEM_SOURCE])
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
[ac_cv_should_define__xopen_source],
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 0b811d22e8..74d8a1562e 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype extensions func gendocs getline gettext-h gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings
+# gnulib-tool --import --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype extensions func gendocs getline gettext-h gettimeofday hash-pjw-bare havelib intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
@@ -43,7 +43,6 @@ gl_MODULES([
gettimeofday
hash-pjw-bare
havelib
- iconv
intprops
lib-msvc-compat
lib-symbol-versions
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index b4d6dff739..27af5dfa68 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -92,8 +92,6 @@ AC_DEFUN([gl_EARLY],
# Code from module gnumakefile:
# Code from module hash-pjw-bare:
# Code from module havelib:
- # Code from module iconv:
- # Code from module iconv-tests:
# Code from module include_next:
# Code from module intprops:
# Code from module intprops-tests:
@@ -104,6 +102,8 @@ AC_DEFUN([gl_EARLY],
AC_REQUIRE([AC_SYS_LARGEFILE])
# Code from module lib-msvc-compat:
# Code from module lib-symbol-versions:
+ # Code from module limits-h:
+ # Code from module limits-h-tests:
# Code from module lseek:
# Code from module maintainer-makefile:
# Code from module malloc-posix:
@@ -268,12 +268,10 @@ AC_SUBST([LTALLOCA])
m4_defn([m4_PACKAGE_VERSION])), [1], [],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
- AM_ICONV
- m4_ifdef([gl_ICONV_MODULE_INDICATOR],
- [gl_ICONV_MODULE_INDICATOR([iconv])])
AC_REQUIRE([gl_LARGEFILE])
gl_LD_OUTPUT_DEF
gl_LD_VERSION_SCRIPT
+ gl_LIMITS_H
gl_FUNC_LSEEK
if test $REPLACE_LSEEK = 1; then
AC_LIBOBJ([lseek])
@@ -602,6 +600,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/hash-pjw-bare.h
lib/intprops.h
lib/itold.c
+ lib/limits.in.h
lib/lseek.c
lib/malloc.c
lib/memchr.c
@@ -682,7 +681,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/getpagesize.m4
m4/gettimeofday.m4
m4/gnulib-common.m4
- m4/iconv.m4
m4/include_next.m4
m4/intmax_t.m4
m4/inttypes-pri.m4
@@ -694,6 +692,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
+ m4/limits-h.m4
m4/longlong.m4
m4/lseek.m4
m4/malloc.m4
@@ -783,10 +782,10 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-getdelim.c
tests/test-getline.c
tests/test-gettimeofday.c
- tests/test-iconv.c
tests/test-init.sh
tests/test-intprops.c
tests/test-inttypes.c
+ tests/test-limits-h.c
tests/test-memchr.c
tests/test-netdb.c
tests/test-netinet_in.c
diff --git a/gl/m4/iconv.m4 b/gl/m4/iconv.m4
deleted file mode 100644
index 4e37363156..0000000000
--- a/gl/m4/iconv.m4
+++ /dev/null
@@ -1,271 +0,0 @@
-# iconv.m4 serial 19 (gettext-0.18.2)
-dnl Copyright (C) 2000-2002, 2007-2014 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 Bruno Haible.
-
-AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
-[
- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([iconv])
-])
-
-AC_DEFUN([AM_ICONV_LINK],
-[
- dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
- dnl those with the standalone portable GNU libiconv installed).
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-
- dnl Add $INCICONV to CPPFLAGS before performing the following checks,
- dnl because if the user has installed libiconv and not disabled its use
- dnl via --without-libiconv-prefix, he wants to use it. The first
- dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
- am_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
-
- AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
- am_cv_func_iconv="no, consider installing GNU libiconv"
- am_cv_lib_iconv=no
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stdlib.h>
-#include <iconv.h>
- ]],
- [[iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);]])],
- [am_cv_func_iconv=yes])
- if test "$am_cv_func_iconv" != yes; then
- am_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBICONV"
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stdlib.h>
-#include <iconv.h>
- ]],
- [[iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);]])],
- [am_cv_lib_iconv=yes]
- [am_cv_func_iconv=yes])
- LIBS="$am_save_LIBS"
- fi
- ])
- 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, AIX 6.1..7.1, HP-UX 11.11,
- dnl Solaris 10.
- am_save_LIBS="$LIBS"
- if test $am_cv_lib_iconv = yes; then
- LIBS="$LIBS $LIBICONV"
- fi
- am_cv_func_iconv_works=no
- for ac_iconv_const in '' 'const'; do
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <iconv.h>
-#include <string.h>
-
-#ifndef ICONV_CONST
-# define ICONV_CONST $ac_iconv_const
-#endif
- ]],
- [[int result = 0;
- /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
- returns. */
- {
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
- if (cd_utf8_to_88591 != (iconv_t)(-1))
- {
- static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
- char buf[10];
- ICONV_CONST char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_utf8_to_88591,
- &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- result |= 1;
- iconv_close (cd_utf8_to_88591);
- }
- }
- /* 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 ICONV_CONST char input[] = "\263";
- char buf[10];
- ICONV_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,
- &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- result |= 2;
- iconv_close (cd_ascii_to_88591);
- }
- }
- /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
- {
- iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
- if (cd_88591_to_utf8 != (iconv_t)(-1))
- {
- static ICONV_CONST char input[] = "\304";
- static char buf[2] = { (char)0xDE, (char)0xAD };
- ICONV_CONST char *inptr = input;
- size_t inbytesleft = 1;
- char *outptr = buf;
- size_t outbytesleft = 1;
- size_t res = iconv (cd_88591_to_utf8,
- &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
- result |= 4;
- iconv_close (cd_88591_to_utf8);
- }
- }
-#if 0 /* This bug could be worked around by the caller. */
- /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
- {
- iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
- if (cd_88591_to_utf8 != (iconv_t)(-1))
- {
- static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
- char buf[50];
- ICONV_CONST char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_88591_to_utf8,
- &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if ((int)res > 0)
- result |= 8;
- iconv_close (cd_88591_to_utf8);
- }
- }
-#endif
- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
- provided. */
- if (/* Try standardized names. */
- iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
- /* Try IRIX, OSF/1 names. */
- && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
- /* Try AIX names. */
- && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
- /* Try HP-UX names. */
- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
- result |= 16;
- return result;
-]])],
- [am_cv_func_iconv_works=yes], ,
- [case "$host_os" in
- aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
- *) am_cv_func_iconv_works="guessing yes" ;;
- esac])
- test "$am_cv_func_iconv_works" = no || break
- done
- LIBS="$am_save_LIBS"
- ])
- case "$am_cv_func_iconv_works" in
- *no) am_func_iconv=no am_cv_lib_iconv=no ;;
- *) am_func_iconv=yes ;;
- esac
- else
- am_func_iconv=no am_cv_lib_iconv=no
- fi
- if test "$am_func_iconv" = yes; then
- AC_DEFINE([HAVE_ICONV], [1],
- [Define if you have the iconv() function and it works.])
- fi
- if test "$am_cv_lib_iconv" = yes; then
- AC_MSG_CHECKING([how to link with libiconv])
- AC_MSG_RESULT([$LIBICONV])
- else
- dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
- dnl either.
- CPPFLAGS="$am_save_CPPFLAGS"
- LIBICONV=
- LTLIBICONV=
- fi
- AC_SUBST([LIBICONV])
- AC_SUBST([LTLIBICONV])
-])
-
-dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
-dnl avoid warnings like
-dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
-dnl This is tricky because of the way 'aclocal' is implemented:
-dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
-dnl Otherwise aclocal's initial scan pass would miss the macro definition.
-dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
-dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
-dnl warnings.
-m4_define([gl_iconv_AC_DEFUN],
- m4_version_prereq([2.64],
- [[AC_DEFUN_ONCE(
- [$1], [$2])]],
- [m4_ifdef([gl_00GNULIB],
- [[AC_DEFUN_ONCE(
- [$1], [$2])]],
- [[AC_DEFUN(
- [$1], [$2])]])]))
-gl_iconv_AC_DEFUN([AM_ICONV],
-[
- AM_ICONV_LINK
- if test "$am_cv_func_iconv" = yes; then
- AC_MSG_CHECKING([for iconv declaration])
- AC_CACHE_VAL([am_cv_proto_iconv], [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
- ]],
- [[]])],
- [am_cv_proto_iconv_arg1=""],
- [am_cv_proto_iconv_arg1="const"])
- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
- AC_MSG_RESULT([
- $am_cv_proto_iconv])
- AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
- [Define as const if the declaration of iconv() needs const.])
- dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
- m4_ifdef([gl_ICONV_H_DEFAULTS],
- [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
- if test -n "$am_cv_proto_iconv_arg1"; then
- ICONV_CONST="const"
- fi
- ])
- fi
-])
diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4
new file mode 100644
index 0000000000..31fdf0a779
--- /dev/null
+++ b/gl/m4/limits-h.m4
@@ -0,0 +1,31 @@
+dnl Check whether limits.h has needed features.
+
+dnl Copyright 2016 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 Paul Eggert.
+
+AC_DEFUN_ONCE([gl_LIMITS_H],
+[
+ gl_CHECK_NEXT_HEADERS([limits.h])
+
+ AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.],
+ [gl_cv_header_limits_width],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+ #endif
+ #include <limits.h>
+ int ullw = ULLONG_WIDTH;]])],
+ [gl_cv_header_limits_width=yes],
+ [gl_cv_header_limits_width=no])])
+ if test "$gl_cv_header_limits_width" = yes; then
+ LIMITS_H=
+ else
+ LIMITS_H=limits.h
+ fi
+ AC_SUBST([LIMITS_H])
+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
+])
diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4
index 90823b0acf..4f701f4eac 100644
--- a/gl/m4/manywarnings.m4
+++ b/gl/m4/manywarnings.m4
@@ -62,10 +62,11 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
CFLAGS="$CFLAGS -W -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- [[void f (void)
+ [[int f (void)
{
typedef struct { int a; int b; } s_t;
s_t s1 = { 0, };
+ return s1.b;
}
]],
[[]])],
@@ -103,6 +104,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
gl_manywarn_set=
for gl_manywarn_item in \
+ -fno-common \
-W \
-Wabi \
-Waddress \
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index e495e0cbc5..c7a14b20e0 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -38,6 +38,8 @@ int main ()
if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
|| strcmp (buf, "12345671 33") != 0)
result |= 1;
+#else
+ result |= 1;
#endif
buf[0] = '\0';
if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
diff --git a/gl/m4/secure_getenv.m4 b/gl/m4/secure_getenv.m4
index 00194c8497..3983173603 100644
--- a/gl/m4/secure_getenv.m4
+++ b/gl/m4/secure_getenv.m4
@@ -22,4 +22,5 @@ AC_DEFUN([gl_PREREQ_SECURE_GETENV], [
if test $ac_cv_func___secure_getenv = no; then
AC_CHECK_FUNCS([issetugid])
fi
+ AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid])
])
diff --git a/gl/m4/stdbool.m4 b/gl/m4/stdbool.m4
index 625520ff07..2a9b1db86f 100644
--- a/gl/m4/stdbool.m4
+++ b/gl/m4/stdbool.m4
@@ -5,7 +5,7 @@ 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.
-#serial 5
+#serial 7
# Prepare for substituting <stdbool.h> if it is not supported.
@@ -43,56 +43,64 @@ AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
[AC_LANG_PROGRAM(
[[
#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"
+
+ #ifdef __cplusplus
+ typedef bool Bool;
+ #else
+ typedef _Bool Bool;
+ #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
#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; bool u: 1; bool v; } 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];
/* See body of main program for 'e'. */
- char f[(_Bool) 0.0 == false ? 1 : -1];
+ char f[(Bool) 0.0 == false ? 1 : -1];
char g[true];
- char h[sizeof (_Bool)];
+ char h[sizeof (Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
/* The following fails for
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
- _Bool n[m];
+ 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];
+ char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
/* 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;
+ Bool q = true;
+ Bool *pq = &q;
+ bool *qq = &q;
]],
[[
bool e = &s;
- *pq |= q;
- *pq |= ! q;
+ *pq |= q; *pq |= ! q;
+ *qq |= q; *qq |= ! 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);
+ + !m + !n + !o + !p + !q + !pq + !qq);
]])],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index 0b4b9060db..05b6ab7846 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 44
+# stdint.m4 serial 48
dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,8 @@ AC_DEFUN_ONCE([gl_STDINT_H],
[
AC_PREREQ([2.59])dnl
+ AC_REQUIRE([gl_LIMITS_H])
+
dnl Check for long long int and unsigned long long int.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
if test $ac_cv_type_long_long_int = yes; then
@@ -152,6 +154,15 @@ uintptr_t h = UINTPTR_MAX;
intmax_t i = INTMAX_MAX;
uintmax_t j = UINTMAX_MAX;
+/* Check that SIZE_MAX has the correct type, if possible. */
+#if 201112 <= __STDC_VERSION__
+int k = _Generic (SIZE_MAX, size_t: 0);
+#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+ || (0x5110 <= __SUNPRO_C && !__STDC__))
+extern size_t k;
+extern __typeof__ (SIZE_MAX) k;
+#endif
+
#include <limits.h> /* for CHAR_BIT */
#define TYPE_MINIMUM(t) \
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
@@ -282,14 +293,20 @@ static const char *macro_values[] =
])
])
fi
+
+ HAVE_C99_STDINT_H=0
+ HAVE_SYS_BITYPES_H=0
+ HAVE_SYS_INTTYPES_H=0
+ STDINT_H=stdint.h
if test "$gl_cv_header_working_stdint_h" = yes; then
+ HAVE_C99_STDINT_H=1
dnl Now see whether the system <stdint.h> works without
dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
AC_CACHE_CHECK([whether stdint.h predates C++11],
[gl_cv_header_stdint_predates_cxx11_h],
[gl_cv_header_stdint_predates_cxx11_h=yes
AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
+ AC_LANG_PROGRAM([[
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
#include <stdint.h>
]
@@ -306,27 +323,44 @@ int32_t i32 = INT32_C (0x7fffffff);
AC_DEFINE([__STDC_LIMIT_MACROS], [1],
[Define to 1 if the system <stdint.h> predates C++11.])
fi
- STDINT_H=
+ AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.],
+ [gl_cv_header_stdint_width],
+ [gl_cv_header_stdint_width=no
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ /* Work if build is not clean. */
+ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1
+ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+ #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
+ #endif
+ #include <stdint.h>
+ ]gl_STDINT_INCLUDES[
+ int iw = UINTMAX_WIDTH;
+ ]])],
+ [gl_cv_header_stdint_width=yes])])
+ if test "$gl_cv_header_stdint_width" = yes; then
+ STDINT_H=
+ fi
else
dnl Check for <sys/inttypes.h>, and for
dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
if test $ac_cv_header_sys_inttypes_h = yes; then
HAVE_SYS_INTTYPES_H=1
- else
- HAVE_SYS_INTTYPES_H=0
fi
- AC_SUBST([HAVE_SYS_INTTYPES_H])
if test $ac_cv_header_sys_bitypes_h = yes; then
HAVE_SYS_BITYPES_H=1
- else
- HAVE_SYS_BITYPES_H=0
fi
- AC_SUBST([HAVE_SYS_BITYPES_H])
-
gl_STDINT_TYPE_PROPERTIES
- STDINT_H=stdint.h
fi
+
+ # The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
+ LIMITS_H=limits.h
+ AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
+
+ AC_SUBST([HAVE_C99_STDINT_H])
+ AC_SUBST([HAVE_SYS_BITYPES_H])
+ AC_SUBST([HAVE_SYS_INTTYPES_H])
AC_SUBST([STDINT_H])
AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
])
@@ -504,8 +538,3 @@ dnl Remove this when we can assume autoconf >= 2.61.
m4_ifdef([AC_COMPUTE_INT], [], [
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
])
-
-# Hey Emacs!
-# Local Variables:
-# indent-tabs-mode: nil
-# End:
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index 0e387585d2..eaa25a01d4 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 46
+# stdio_h.m4 serial 48
dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,9 +6,13 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_STDIO_H],
[
- dnl For __USE_MINGW_ANSI_STDIO
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
+ AH_VERBATIM([MINGW_ANSI_STDIO],
+[/* Use GNU style printf and scanf. */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
+])
+ AC_DEFINE([__USE_MINGW_ANSI_STDIO])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_NEXT_HEADERS([stdio.h])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index 19107c4199..3999068153 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 42
+# stdlib_h.m4 serial 43
dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,7 @@ AC_DEFUN([gl_STDLIB_H],
#endif
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
- posix_openpt ptsname ptsname_r random random_r realpath rpmatch
+ posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch
secure_getenv setenv setstate setstate_r srandom srandom_r
strtod strtoll strtoull unlockpt unsetenv])
])
@@ -85,6 +85,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
+ HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index b0aabb4786..159b005b3d 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,4 +1,4 @@
-# sys_types_h.m4 serial 5
+# sys_types_h.m4 serial 6
dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -22,3 +22,28 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
[
])
+
+# This works around a buggy version in autoconf <= 2.69.
+# See <https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html>
+
+m4_version_prereq([2.70], [], [
+
+# This is taken from the following Autoconf patch:
+# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98
+
+m4_undefine([AC_HEADER_MAJOR])
+AC_DEFUN([AC_HEADER_MAJOR],
+[AC_CHECK_HEADERS_ONCE([sys/types.h])
+AC_CHECK_HEADER([sys/mkdev.h],
+ [AC_DEFINE([MAJOR_IN_MKDEV], [1],
+ [Define to 1 if `major', `minor', and `makedev' are declared in
+ <mkdev.h>.])])
+if test $ac_cv_header_sys_mkdev_h = no; then
+ AC_CHECK_HEADER([sys/sysmacros.h],
+ [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
+ [Define to 1 if `major', `minor', and `makedev' are declared in
+ <sysmacros.h>.])])
+fi
+])
+
+])
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4
index b40b73237d..16017a59fb 100644
--- a/gl/m4/wchar_h.m4
+++ b/gl/m4/wchar_h.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar_h.m4 serial 39
+# wchar_h.m4 serial 40
AC_DEFUN([gl_WCHAR_H],
[
@@ -81,8 +81,14 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
extern int zero (void);
int main () { return zero(); }
]])])
+ dnl Do not rename the object file from conftest.$ac_objext to
+ dnl conftest1.$ac_objext, as this will cause the link to fail on
+ dnl z/OS when using the XPLINK object format (due to duplicate
+ dnl CSECT names). Instead, temporarily redefine $ac_compile so
+ dnl that the object file has the latter name from the start.
+ save_ac_compile="$ac_compile"
+ ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/`
if AC_TRY_EVAL([ac_compile]); then
- mv conftest.$ac_objext conftest1.$ac_objext
AC_LANG_CONFTEST([
AC_LANG_SOURCE([[#define wcstod renamed_wcstod
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
@@ -95,8 +101,9 @@ int main () { return zero(); }
#include <wchar.h>
int zero (void) { return 0; }
]])])
+ dnl See note above about renaming object files.
+ ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/`
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
@@ -104,6 +111,7 @@ int zero (void) { return 0; }
fi
fi
fi
+ ac_compile="$save_ac_compile"
rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
])
if test $gl_cv_header_wchar_h_correct_inline = no; then
diff --git a/gl/secure_getenv.c b/gl/secure_getenv.c
index 029441ed06..167d50b807 100644
--- a/gl/secure_getenv.c
+++ b/gl/secure_getenv.c
@@ -1,4 +1,4 @@
-/* Look up an environment variable more securely.
+/* Look up an environment variable, returning NULL in insecure situations.
Copyright 2013-2016 Free Software Foundation, Inc.
@@ -20,26 +20,35 @@
#include <stdlib.h>
#if !HAVE___SECURE_GETENV
-# if HAVE_ISSETUGID
+# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID)
# include <unistd.h>
-# else
-# undef issetugid
-# ifdef _WIN32
-# define issetugid() 0
-# else
-# define issetugid() 1
-# endif
# endif
#endif
char *
secure_getenv (char const *name)
{
-#if HAVE___SECURE_GETENV
+#if HAVE___SECURE_GETENV /* glibc */
return __secure_getenv (name);
-#else
+#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */
if (issetugid ())
- return 0;
+ return NULL;
+ return getenv (name);
+#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */
+ if (geteuid () != getuid () || getegid () != getgid ())
+ return NULL;
return getenv (name);
+#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */
+ /* On native Windows, there is no such concept as setuid or setgid binaries.
+ - Programs launched as system services have high privileges, but they don't
+ inherit environment variables from a user.
+ - Programs launched by a user with "Run as Administrator" have high
+ privileges and use the environment variables, but the user has been asked
+ whether he agrees.
+ - Programs launched by a user without "Run as Administrator" cannot gain
+ high privileges, therefore there is no risk. */
+ return getenv (name);
+#else
+ return NULL;
#endif
}
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index 35a41bb7d7..225970503f 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -79,49 +79,51 @@
#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
#define _@GUARD_PREFIX@_STDINT_H
+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
+ LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */
+#include <limits.h>
+
+#if ! @HAVE_C99_STDINT_H@
+
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after @NEXT_STDINT_H@. */
-#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
-# include <sys/types.h>
-#endif
-
-/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
- LONG_MIN, LONG_MAX, ULONG_MAX. */
-#include <limits.h>
+# if @HAVE_SYS_TYPES_H@ && ! defined _AIX
+# include <sys/types.h>
+# endif
-#if @HAVE_INTTYPES_H@
+# if @HAVE_INTTYPES_H@
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
<inttypes.h> also defines intptr_t and uintptr_t. */
-# include <inttypes.h>
-#elif @HAVE_SYS_INTTYPES_H@
+# include <inttypes.h>
+# elif @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
-# include <sys/inttypes.h>
-#endif
+# include <sys/inttypes.h>
+# endif
-#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
+# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
included by <sys/types.h>. */
-# include <sys/bitypes.h>
-#endif
+# include <sys/bitypes.h>
+# endif
-#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Minimum and maximum values for an integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */
-#define _STDINT_MIN(signed, bits, zero) \
- ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
+# define _STDINT_MIN(signed, bits, zero) \
+ ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
-#define _STDINT_MAX(signed, bits, zero) \
- (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+# define _STDINT_MAX(signed, bits, zero) \
+ (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
#if !GNULIB_defined_stdint_types
@@ -130,26 +132,26 @@
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
-#undef int8_t
-#undef uint8_t
+# undef int8_t
+# undef uint8_t
typedef signed char gl_int8_t;
typedef unsigned char gl_uint8_t;
-#define int8_t gl_int8_t
-#define uint8_t gl_uint8_t
+# define int8_t gl_int8_t
+# define uint8_t gl_uint8_t
-#undef int16_t
-#undef uint16_t
+# undef int16_t
+# undef uint16_t
typedef short int gl_int16_t;
typedef unsigned short int gl_uint16_t;
-#define int16_t gl_int16_t
-#define uint16_t gl_uint16_t
+# define int16_t gl_int16_t
+# define uint16_t gl_uint16_t
-#undef int32_t
-#undef uint32_t
+# undef int32_t
+# undef uint32_t
typedef int gl_int32_t;
typedef unsigned int gl_uint32_t;
-#define int32_t gl_int32_t
-#define uint32_t gl_uint32_t
+# define int32_t gl_int32_t
+# define uint32_t gl_uint32_t
/* If the system defines INT64_MAX, assume int64_t works. That way,
if the underlying platform defines int64_t to be a 64-bit long long
@@ -157,54 +159,54 @@ typedef unsigned int gl_uint32_t;
int, which would mess up C++ name mangling. We must use #ifdef
rather than #if, to avoid an error with HP-UX 10.20 cc. */
-#ifdef INT64_MAX
-# define GL_INT64_T
-#else
+# ifdef INT64_MAX
+# define GL_INT64_T
+# else
/* Do not undefine int64_t if gnulib is not being used with 64-bit
types, since otherwise it breaks platforms like Tandem/NSK. */
-# if LONG_MAX >> 31 >> 31 == 1
-# undef int64_t
+# if LONG_MAX >> 31 >> 31 == 1
+# undef int64_t
typedef long int gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
-# elif defined _MSC_VER
-# undef int64_t
+# define int64_t gl_int64_t
+# define GL_INT64_T
+# elif defined _MSC_VER
+# undef int64_t
typedef __int64 gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
-# elif @HAVE_LONG_LONG_INT@
-# undef int64_t
+# define int64_t gl_int64_t
+# define GL_INT64_T
+# elif @HAVE_LONG_LONG_INT@
+# undef int64_t
typedef long long int gl_int64_t;
-# define int64_t gl_int64_t
-# define GL_INT64_T
+# define int64_t gl_int64_t
+# define GL_INT64_T
+# endif
# endif
-#endif
-#ifdef UINT64_MAX
-# define GL_UINT64_T
-#else
-# if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# undef uint64_t
-typedef unsigned long int gl_uint64_t;
-# define uint64_t gl_uint64_t
+# ifdef UINT64_MAX
# define GL_UINT64_T
-# elif defined _MSC_VER
-# undef uint64_t
+# else
+# if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# undef uint64_t
+typedef unsigned long int gl_uint64_t;
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+# elif defined _MSC_VER
+# undef uint64_t
typedef unsigned __int64 gl_uint64_t;
-# define uint64_t gl_uint64_t
-# define GL_UINT64_T
-# elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# undef uint64_t
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# undef uint64_t
typedef unsigned long long int gl_uint64_t;
-# define uint64_t gl_uint64_t
-# define GL_UINT64_T
+# define uint64_t gl_uint64_t
+# define GL_UINT64_T
+# endif
# endif
-#endif
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
-#define _UINT8_T
-#define _UINT32_T
-#define _UINT64_T
+# define _UINT8_T
+# define _UINT32_T
+# define _UINT64_T
/* 7.18.1.2. Minimum-width integer types */
@@ -213,26 +215,26 @@ typedef unsigned long long int gl_uint64_t;
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
-#undef int_least8_t
-#undef uint_least8_t
-#undef int_least16_t
-#undef uint_least16_t
-#undef int_least32_t
-#undef uint_least32_t
-#undef int_least64_t
-#undef uint_least64_t
-#define int_least8_t int8_t
-#define uint_least8_t uint8_t
-#define int_least16_t int16_t
-#define uint_least16_t uint16_t
-#define int_least32_t int32_t
-#define uint_least32_t uint32_t
-#ifdef GL_INT64_T
-# define int_least64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_least64_t uint64_t
-#endif
+# undef int_least8_t
+# undef uint_least8_t
+# undef int_least16_t
+# undef uint_least16_t
+# undef int_least32_t
+# undef uint_least32_t
+# undef int_least64_t
+# undef uint_least64_t
+# define int_least8_t int8_t
+# define uint_least8_t uint8_t
+# define int_least16_t int16_t
+# define uint_least16_t uint16_t
+# define int_least32_t int32_t
+# define uint_least32_t uint32_t
+# ifdef GL_INT64_T
+# define int_least64_t int64_t
+# endif
+# ifdef GL_UINT64_T
+# define uint_least64_t uint64_t
+# endif
/* 7.18.1.3. Fastest minimum-width integer types */
@@ -245,55 +247,55 @@ typedef unsigned long long int gl_uint64_t;
uses types consistent with glibc, as that lessens the chance of
incompatibility with older GNU hosts. */
-#undef int_fast8_t
-#undef uint_fast8_t
-#undef int_fast16_t
-#undef uint_fast16_t
-#undef int_fast32_t
-#undef uint_fast32_t
-#undef int_fast64_t
-#undef uint_fast64_t
+# undef int_fast8_t
+# undef uint_fast8_t
+# undef int_fast16_t
+# undef uint_fast16_t
+# undef int_fast32_t
+# undef uint_fast32_t
+# undef int_fast64_t
+# undef uint_fast64_t
typedef signed char gl_int_fast8_t;
typedef unsigned char gl_uint_fast8_t;
-#ifdef __sun
+# ifdef __sun
/* Define types compatible with SunOS 5.10, so that code compiled under
earlier SunOS versions works with code compiled under SunOS 5.10. */
typedef int gl_int_fast32_t;
typedef unsigned int gl_uint_fast32_t;
-#else
+# else
typedef long int gl_int_fast32_t;
typedef unsigned long int gl_uint_fast32_t;
-#endif
+# endif
typedef gl_int_fast32_t gl_int_fast16_t;
typedef gl_uint_fast32_t gl_uint_fast16_t;
-#define int_fast8_t gl_int_fast8_t
-#define uint_fast8_t gl_uint_fast8_t
-#define int_fast16_t gl_int_fast16_t
-#define uint_fast16_t gl_uint_fast16_t
-#define int_fast32_t gl_int_fast32_t
-#define uint_fast32_t gl_uint_fast32_t
-#ifdef GL_INT64_T
-# define int_fast64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_fast64_t uint64_t
-#endif
+# define int_fast8_t gl_int_fast8_t
+# define uint_fast8_t gl_uint_fast8_t
+# define int_fast16_t gl_int_fast16_t
+# define uint_fast16_t gl_uint_fast16_t
+# define int_fast32_t gl_int_fast32_t
+# define uint_fast32_t gl_uint_fast32_t
+# ifdef GL_INT64_T
+# define int_fast64_t int64_t
+# endif
+# ifdef GL_UINT64_T
+# define uint_fast64_t uint64_t
+# endif
/* 7.18.1.4. Integer types capable of holding object pointers */
/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
definitions of intptr_t and uintptr_t (which use int and unsigned)
to avoid clashes with declarations of system functions like sbrk. */
-#ifndef _INTPTR_T_DECLARED
-#undef intptr_t
-#undef uintptr_t
+# ifndef _INTPTR_T_DECLARED
+# undef intptr_t
+# undef uintptr_t
typedef long int gl_intptr_t;
typedef unsigned long int gl_uintptr_t;
-#define intptr_t gl_intptr_t
-#define uintptr_t gl_uintptr_t
-#endif
+# define intptr_t gl_intptr_t
+# define uintptr_t gl_uintptr_t
+# endif
/* 7.18.1.5. Greatest-width integer types */
@@ -304,33 +306,33 @@ typedef unsigned long int gl_uintptr_t;
similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
assuming one type where another is used by the system. */
-#ifndef INTMAX_MAX
-# undef INTMAX_C
-# undef intmax_t
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# ifndef INTMAX_MAX
+# undef INTMAX_C
+# undef intmax_t
+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
typedef long long int gl_intmax_t;
-# define intmax_t gl_intmax_t
-# elif defined GL_INT64_T
-# define intmax_t int64_t
-# else
+# define intmax_t gl_intmax_t
+# elif defined GL_INT64_T
+# define intmax_t int64_t
+# else
typedef long int gl_intmax_t;
-# define intmax_t gl_intmax_t
+# define intmax_t gl_intmax_t
+# endif
# endif
-#endif
-#ifndef UINTMAX_MAX
-# undef UINTMAX_C
-# undef uintmax_t
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# ifndef UINTMAX_MAX
+# undef UINTMAX_C
+# undef uintmax_t
+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
typedef unsigned long long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
-# elif defined GL_UINT64_T
-# define uintmax_t uint64_t
-# else
+# define uintmax_t gl_uintmax_t
+# elif defined GL_UINT64_T
+# define uintmax_t uint64_t
+# else
typedef unsigned long int gl_uintmax_t;
-# define uintmax_t gl_uintmax_t
+# define uintmax_t gl_uintmax_t
+# endif
# endif
-#endif
/* Verify that intmax_t and uintmax_t have the same size. Too much code
breaks if this is not the case. If this check fails, the reason is likely
@@ -338,8 +340,8 @@ typedef unsigned long int gl_uintmax_t;
typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
? 1 : -1];
-#define GNULIB_defined_stdint_types 1
-#endif /* !GNULIB_defined_stdint_types */
+# define GNULIB_defined_stdint_types 1
+# endif /* !GNULIB_defined_stdint_types */
/* 7.18.2. Limits of specified-width integer types */
@@ -348,37 +350,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
-#undef INT8_MIN
-#undef INT8_MAX
-#undef UINT8_MAX
-#define INT8_MIN (~ INT8_MAX)
-#define INT8_MAX 127
-#define UINT8_MAX 255
-
-#undef INT16_MIN
-#undef INT16_MAX
-#undef UINT16_MAX
-#define INT16_MIN (~ INT16_MAX)
-#define INT16_MAX 32767
-#define UINT16_MAX 65535
-
-#undef INT32_MIN
-#undef INT32_MAX
-#undef UINT32_MAX
-#define INT32_MIN (~ INT32_MAX)
-#define INT32_MAX 2147483647
-#define UINT32_MAX 4294967295U
-
-#if defined GL_INT64_T && ! defined INT64_MAX
+# undef INT8_MIN
+# undef INT8_MAX
+# undef UINT8_MAX
+# define INT8_MIN (~ INT8_MAX)
+# define INT8_MAX 127
+# define UINT8_MAX 255
+
+# undef INT16_MIN
+# undef INT16_MAX
+# undef UINT16_MAX
+# define INT16_MIN (~ INT16_MAX)
+# define INT16_MAX 32767
+# define UINT16_MAX 65535
+
+# undef INT32_MIN
+# undef INT32_MAX
+# undef UINT32_MAX
+# define INT32_MIN (~ INT32_MAX)
+# define INT32_MAX 2147483647
+# define UINT32_MAX 4294967295U
+
+# if defined GL_INT64_T && ! defined INT64_MAX
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
evaluates the latter incorrectly in preprocessor expressions. */
-# define INT64_MIN (- INTMAX_C (1) << 63)
-# define INT64_MAX INTMAX_C (9223372036854775807)
-#endif
+# define INT64_MIN (- INTMAX_C (1) << 63)
+# define INT64_MAX INTMAX_C (9223372036854775807)
+# endif
-#if defined GL_UINT64_T && ! defined UINT64_MAX
-# define UINT64_MAX UINTMAX_C (18446744073709551615)
-#endif
+# if defined GL_UINT64_T && ! defined UINT64_MAX
+# define UINT64_MAX UINTMAX_C (18446744073709551615)
+# endif
/* 7.18.2.2. Limits of minimum-width integer types */
@@ -386,38 +388,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
-#undef INT_LEAST8_MIN
-#undef INT_LEAST8_MAX
-#undef UINT_LEAST8_MAX
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#undef INT_LEAST16_MIN
-#undef INT_LEAST16_MAX
-#undef UINT_LEAST16_MAX
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#undef INT_LEAST32_MIN
-#undef INT_LEAST32_MAX
-#undef UINT_LEAST32_MAX
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#undef INT_LEAST64_MIN
-#undef INT_LEAST64_MAX
-#ifdef GL_INT64_T
-# define INT_LEAST64_MIN INT64_MIN
-# define INT_LEAST64_MAX INT64_MAX
-#endif
+# undef INT_LEAST8_MIN
+# undef INT_LEAST8_MAX
+# undef UINT_LEAST8_MAX
+# define INT_LEAST8_MIN INT8_MIN
+# define INT_LEAST8_MAX INT8_MAX
+# define UINT_LEAST8_MAX UINT8_MAX
+
+# undef INT_LEAST16_MIN
+# undef INT_LEAST16_MAX
+# undef UINT_LEAST16_MAX
+# define INT_LEAST16_MIN INT16_MIN
+# define INT_LEAST16_MAX INT16_MAX
+# define UINT_LEAST16_MAX UINT16_MAX
+
+# undef INT_LEAST32_MIN
+# undef INT_LEAST32_MAX
+# undef UINT_LEAST32_MAX
+# define INT_LEAST32_MIN INT32_MIN
+# define INT_LEAST32_MAX INT32_MAX
+# define UINT_LEAST32_MAX UINT32_MAX
+
+# undef INT_LEAST64_MIN
+# undef INT_LEAST64_MAX
+# ifdef GL_INT64_T
+# define INT_LEAST64_MIN INT64_MIN
+# define INT_LEAST64_MAX INT64_MAX
+# endif
-#undef UINT_LEAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_LEAST64_MAX UINT64_MAX
-#endif
+# undef UINT_LEAST64_MAX
+# ifdef GL_UINT64_T
+# define UINT_LEAST64_MAX UINT64_MAX
+# endif
/* 7.18.2.3. Limits of fastest minimum-width integer types */
@@ -425,117 +427,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. */
-#undef INT_FAST8_MIN
-#undef INT_FAST8_MAX
-#undef UINT_FAST8_MAX
-#define INT_FAST8_MIN SCHAR_MIN
-#define INT_FAST8_MAX SCHAR_MAX
-#define UINT_FAST8_MAX UCHAR_MAX
-
-#undef INT_FAST16_MIN
-#undef INT_FAST16_MAX
-#undef UINT_FAST16_MAX
-#define INT_FAST16_MIN INT_FAST32_MIN
-#define INT_FAST16_MAX INT_FAST32_MAX
-#define UINT_FAST16_MAX UINT_FAST32_MAX
-
-#undef INT_FAST32_MIN
-#undef INT_FAST32_MAX
-#undef UINT_FAST32_MAX
-#ifdef __sun
-# define INT_FAST32_MIN INT_MIN
-# define INT_FAST32_MAX INT_MAX
-# define UINT_FAST32_MAX UINT_MAX
-#else
-# define INT_FAST32_MIN LONG_MIN
-# define INT_FAST32_MAX LONG_MAX
-# define UINT_FAST32_MAX ULONG_MAX
-#endif
+# undef INT_FAST8_MIN
+# undef INT_FAST8_MAX
+# undef UINT_FAST8_MAX
+# define INT_FAST8_MIN SCHAR_MIN
+# define INT_FAST8_MAX SCHAR_MAX
+# define UINT_FAST8_MAX UCHAR_MAX
+
+# undef INT_FAST16_MIN
+# undef INT_FAST16_MAX
+# undef UINT_FAST16_MAX
+# define INT_FAST16_MIN INT_FAST32_MIN
+# define INT_FAST16_MAX INT_FAST32_MAX
+# define UINT_FAST16_MAX UINT_FAST32_MAX
+
+# undef INT_FAST32_MIN
+# undef INT_FAST32_MAX
+# undef UINT_FAST32_MAX
+# ifdef __sun
+# define INT_FAST32_MIN INT_MIN
+# define INT_FAST32_MAX INT_MAX
+# define UINT_FAST32_MAX UINT_MAX
+# else
+# define INT_FAST32_MIN LONG_MIN
+# define INT_FAST32_MAX LONG_MAX
+# define UINT_FAST32_MAX ULONG_MAX
+# endif
-#undef INT_FAST64_MIN
-#undef INT_FAST64_MAX
-#ifdef GL_INT64_T
-# define INT_FAST64_MIN INT64_MIN
-# define INT_FAST64_MAX INT64_MAX
-#endif
+# undef INT_FAST64_MIN
+# undef INT_FAST64_MAX
+# ifdef GL_INT64_T
+# define INT_FAST64_MIN INT64_MIN
+# define INT_FAST64_MAX INT64_MAX
+# endif
-#undef UINT_FAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_FAST64_MAX UINT64_MAX
-#endif
+# undef UINT_FAST64_MAX
+# ifdef GL_UINT64_T
+# define UINT_FAST64_MAX UINT64_MAX
+# endif
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
-#undef INTPTR_MIN
-#undef INTPTR_MAX
-#undef UINTPTR_MAX
-#define INTPTR_MIN LONG_MIN
-#define INTPTR_MAX LONG_MAX
-#define UINTPTR_MAX ULONG_MAX
+# undef INTPTR_MIN
+# undef INTPTR_MAX
+# undef UINTPTR_MAX
+# define INTPTR_MIN LONG_MIN
+# define INTPTR_MAX LONG_MAX
+# define UINTPTR_MAX ULONG_MAX
/* 7.18.2.5. Limits of greatest-width integer types */
-#ifndef INTMAX_MAX
-# undef INTMAX_MIN
-# ifdef INT64_MAX
-# define INTMAX_MIN INT64_MIN
-# define INTMAX_MAX INT64_MAX
-# else
-# define INTMAX_MIN INT32_MIN
-# define INTMAX_MAX INT32_MAX
+# ifndef INTMAX_MAX
+# undef INTMAX_MIN
+# ifdef INT64_MAX
+# define INTMAX_MIN INT64_MIN
+# define INTMAX_MAX INT64_MAX
+# else
+# define INTMAX_MIN INT32_MIN
+# define INTMAX_MAX INT32_MAX
+# endif
# endif
-#endif
-#ifndef UINTMAX_MAX
-# ifdef UINT64_MAX
-# define UINTMAX_MAX UINT64_MAX
-# else
-# define UINTMAX_MAX UINT32_MAX
+# ifndef UINTMAX_MAX
+# ifdef UINT64_MAX
+# define UINTMAX_MAX UINT64_MAX
+# else
+# define UINTMAX_MAX UINT32_MAX
+# endif
# endif
-#endif
/* 7.18.3. Limits of other integer types */
/* ptrdiff_t limits */
-#undef PTRDIFF_MIN
-#undef PTRDIFF_MAX
-#if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
-# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
+# undef PTRDIFF_MIN
+# undef PTRDIFF_MAX
+# if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
+# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
+# else
+# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
+# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
+# endif
# else
-# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
-# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
-# endif
-#else
-# define PTRDIFF_MIN \
+# define PTRDIFF_MIN \
_STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-# define PTRDIFF_MAX \
+# define PTRDIFF_MAX \
_STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-#endif
+# endif
/* sig_atomic_t limits */
-#undef SIG_ATOMIC_MIN
-#undef SIG_ATOMIC_MAX
-#define SIG_ATOMIC_MIN \
+# undef SIG_ATOMIC_MIN
+# undef SIG_ATOMIC_MAX
+# define SIG_ATOMIC_MIN \
_STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
-#define SIG_ATOMIC_MAX \
+# define SIG_ATOMIC_MAX \
_STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
/* size_t limit */
-#undef SIZE_MAX
-#if @APPLE_UNIVERSAL_BUILD@
-# ifdef _LP64
-# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
+# undef SIZE_MAX
+# if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+# define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
+# else
+# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
+# endif
# else
-# define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
+# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
# endif
-#else
-# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
-#endif
/* wchar_t limits */
/* Get WCHAR_MIN, WCHAR_MAX.
@@ -543,29 +545,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
sequence of nested includes
<wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
<stdint.h> and assumes its types are already defined. */
-#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
/* 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>
-# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-# include <wchar.h>
-# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
-#endif
-#undef WCHAR_MIN
-#undef WCHAR_MAX
-#define WCHAR_MIN \
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# include <wchar.h>
+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# endif
+# undef WCHAR_MIN
+# undef WCHAR_MAX
+# define WCHAR_MIN \
_STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-#define WCHAR_MAX \
+# define WCHAR_MAX \
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
/* wint_t limits */
-#undef WINT_MIN
-#undef WINT_MAX
-#define WINT_MIN \
+# undef WINT_MIN
+# undef WINT_MAX
+# define WINT_MIN \
_STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-#define WINT_MAX \
+# define WINT_MAX \
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
/* 7.18.4. Macros for integer constants */
@@ -576,59 +578,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
-#undef INT8_C
-#undef UINT8_C
-#define INT8_C(x) x
-#define UINT8_C(x) x
-
-#undef INT16_C
-#undef UINT16_C
-#define INT16_C(x) x
-#define UINT16_C(x) x
-
-#undef INT32_C
-#undef UINT32_C
-#define INT32_C(x) x
-#define UINT32_C(x) x ## U
-
-#undef INT64_C
-#undef UINT64_C
-#if LONG_MAX >> 31 >> 31 == 1
-# define INT64_C(x) x##L
-#elif defined _MSC_VER
-# define INT64_C(x) x##i64
-#elif @HAVE_LONG_LONG_INT@
-# define INT64_C(x) x##LL
-#endif
-#if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# define UINT64_C(x) x##UL
-#elif defined _MSC_VER
-# define UINT64_C(x) x##ui64
-#elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# define UINT64_C(x) x##ULL
-#endif
+# undef INT8_C
+# undef UINT8_C
+# define INT8_C(x) x
+# define UINT8_C(x) x
+
+# undef INT16_C
+# undef UINT16_C
+# define INT16_C(x) x
+# define UINT16_C(x) x
+
+# undef INT32_C
+# undef UINT32_C
+# define INT32_C(x) x
+# define UINT32_C(x) x ## U
+
+# undef INT64_C
+# undef UINT64_C
+# if LONG_MAX >> 31 >> 31 == 1
+# define INT64_C(x) x##L
+# elif defined _MSC_VER
+# define INT64_C(x) x##i64
+# elif @HAVE_LONG_LONG_INT@
+# define INT64_C(x) x##LL
+# endif
+# if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+# elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# define UINT64_C(x) x##ULL
+# endif
/* 7.18.4.2. Macros for greatest-width integer constants */
-#ifndef INTMAX_C
-# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define INTMAX_C(x) x##LL
-# elif defined GL_INT64_T
-# define INTMAX_C(x) INT64_C(x)
-# else
-# define INTMAX_C(x) x##L
+# ifndef INTMAX_C
+# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# define INTMAX_C(x) x##LL
+# elif defined GL_INT64_T
+# define INTMAX_C(x) INT64_C(x)
+# else
+# define INTMAX_C(x) x##L
+# endif
# endif
-#endif
-#ifndef UINTMAX_C
-# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define UINTMAX_C(x) x##ULL
-# elif defined GL_UINT64_T
-# define UINTMAX_C(x) UINT64_C(x)
-# else
-# define UINTMAX_C(x) x##UL
+# ifndef UINTMAX_C
+# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x) x##ULL
+# elif defined GL_UINT64_T
+# define UINTMAX_C(x) UINT64_C(x)
+# else
+# define UINTMAX_C(x) x##UL
+# endif
# endif
-#endif
+
+#endif /* !@HAVE_C99_STDINT_H@ */
+
+/* Macros specified by ISO/IEC TS 18661-1:2014. */
+
+#if (!defined UINTMAX_WIDTH \
+ && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
+# ifdef INT8_MAX
+# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
+# endif
+# ifdef UINT8_MAX
+# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
+# endif
+# ifdef INT16_MAX
+# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
+# endif
+# ifdef UINT16_MAX
+# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
+# endif
+# ifdef INT32_MAX
+# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
+# endif
+# ifdef UINT32_MAX
+# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
+# endif
+# ifdef INT64_MAX
+# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
+# endif
+# ifdef UINT64_MAX
+# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
+# endif
+# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
+# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
+# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
+# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
+# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
+# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
+# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
+# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
+# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
+# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
+# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
+# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
+# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
+# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
+# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
+# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
+# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
+# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
+# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
+# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
+# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
+# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
+# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
+# ifdef WINT_MAX
+# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
+# endif
+# ifdef SIG_ATOMIC_MAX
+# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
+# endif
+#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
#endif /* _@GUARD_PREFIX@_STDINT_H */
#endif /* !(defined __ANDROID__ && ...) */
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index ab0b614f6c..c275683906 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -521,6 +521,9 @@ _GL_CXXALIASWARN (putenv);
#endif
#if @GNULIB_QSORT_R@
+/* Sort an array of NMEMB elements, starting at address BASE, each element
+ occupying SIZE bytes, in ascending order according to the comparison
+ function COMPARE. */
# if @REPLACE_QSORT_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef qsort_r
@@ -535,12 +538,24 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
void *),
void *arg));
# else
+# if !@HAVE_QSORT_R@
+_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg) _GL_ARG_NONNULL ((1, 4)));
+# endif
_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
int (*compare) (void const *, void const *,
void *),
void *arg));
# endif
_GL_CXXALIASWARN (qsort_r);
+#elif defined GNULIB_POSIXCHECK
+# undef qsort_r
+# if HAVE_RAW_DECL_QSORT_R
+_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
+ "use gnulib module qsort_r for portability");
+# endif
#endif
diff --git a/gl/string.in.h b/gl/string.in.h
index c6f610d207..21ecaf9f4c 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -416,15 +416,15 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
# undef strndup
# define strndup rpl_strndup
# endif
-_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
+_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n)
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
+_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
# else
# if ! @HAVE_DECL_STRNDUP@
-_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
+_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n)
_GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
+_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
# endif
_GL_CXXALIASWARN (strndup);
#elif defined GNULIB_POSIXCHECK
@@ -444,17 +444,17 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
# undef strnlen
# define strnlen rpl_strnlen
# endif
-_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
+_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
+_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
# else
# if ! @HAVE_DECL_STRNLEN@
-_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
+_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
-_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
+_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
# endif
_GL_CXXALIASWARN (strnlen);
#elif defined GNULIB_POSIXCHECK
diff --git a/gl/strverscmp.c b/gl/strverscmp.c
index f1e3594d1d..d0f9644773 100644
--- a/gl/strverscmp.c
+++ b/gl/strverscmp.c
@@ -1,21 +1,21 @@
-/* Compare strings while treating digits numerically. -*- coding: utf-8 -*-
- Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2016 Free Software
- Foundation, Inc.
+/* Compare strings while treating digits characters numerically.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#if !_LIBC
# include <config.h>
@@ -26,27 +26,14 @@
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
fractional parts, S_Z: idem but with leading Zeroes only */
-#define S_N 0x0
-#define S_I 0x4
-#define S_F 0x8
-#define S_Z 0xC
+#define S_N 0x0
+#define S_I 0x3
+#define S_F 0x6
+#define S_Z 0x9
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
-#define CMP 2
-#define LEN 3
-
-
-/* ISDIGIT differs from isdigit, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char
- or EOF.
- - It's typically faster.
- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
- isdigit unless it's important to use the locale's definition
- of "digit" even when the host does not conform to POSIX. */
-#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
-
-#undef __strverscmp
-#undef strverscmp
+#define CMP 2
+#define LEN 3
#ifndef weak_alias
# define __strverscmp strverscmp
@@ -66,30 +53,25 @@ __strverscmp (const char *s1, const char *s2)
int state;
int diff;
- /* Symbol(s) 0 [1-9] others (padding)
- Transition (10) 0 (01) d (00) x (11) - */
- static const unsigned int next_state[] =
+ /* Symbol(s) 0 [1-9] others
+ Transition (10) 0 (01) d (00) x */
+ static const unsigned char next_state[] =
{
- /* state x d 0 - */
- /* S_N */ S_N, S_I, S_Z, S_N,
- /* S_I */ S_N, S_I, S_I, S_I,
- /* S_F */ S_N, S_F, S_F, S_F,
- /* S_Z */ S_N, S_F, S_Z, S_Z
+ /* state x d 0 */
+ /* S_N */ S_N, S_I, S_Z,
+ /* S_I */ S_N, S_I, S_I,
+ /* S_F */ S_N, S_F, S_F,
+ /* S_Z */ S_N, S_F, S_Z
};
- static const int result_type[] =
+ static const signed char result_type[] =
{
- /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
-
- /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
- 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
- /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
- -1, CMP, CMP, CMP
+ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */
+
+ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP,
+ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN,
+ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP
};
if (p1 == p2)
@@ -98,17 +80,20 @@ __strverscmp (const char *s1, const char *s2)
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
- state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
+ state = S_N + ((c1 == '0') + (isdigit (c1) != 0));
- while ((diff = c1 - c2) == 0 && c1 != '\0')
+ while ((diff = c1 - c2) == 0)
{
+ if (c1 == '\0')
+ return diff;
+
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
- state |= (c1 == '0') + (ISDIGIT (c1) != 0);
+ state += (c1 == '0') + (isdigit (c1) != 0);
}
- state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
+ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
switch (state)
{
@@ -116,16 +101,17 @@ __strverscmp (const char *s1, const char *s2)
return diff;
case LEN:
- while (ISDIGIT (*p1++))
- if (!ISDIGIT (*p2++))
+ while (isdigit (*p1++))
+ if (!isdigit (*p2++))
return 1;
- return ISDIGIT (*p2) ? -1 : diff;
+ return isdigit (*p2) ? -1 : diff;
default:
return state;
}
}
#ifdef weak_alias
+libc_hidden_def (__strverscmp)
weak_alias (__strverscmp, strverscmp)
#endif
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index d99d831d48..aae931ac57 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -79,7 +79,12 @@ _GL_INLINE_HEADER_BEGIN
#if !@HAVE_SA_FAMILY_T@
# if !GNULIB_defined_sa_family_t
+/* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
+# if !defined __KLIBC__ || defined TCPV40HDRS
typedef unsigned short sa_family_t;
+# else
+typedef unsigned char sa_family_t;
+# endif
# define GNULIB_defined_sa_family_t 1
# endif
#endif
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index a005712a27..5a8caf3c5e 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -109,6 +109,13 @@ _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
(struct timeval *restrict, void *restrict));
# endif
_GL_CXXALIASWARN (gettimeofday);
+# if defined __cplusplus && defined GNULIB_NAMESPACE
+namespace GNULIB_NAMESPACE {
+ typedef ::timeval
+#undef timeval
+ timeval;
+}
+# endif
#elif defined GNULIB_POSIXCHECK
# undef gettimeofday
# if HAVE_RAW_DECL_GETTIMEOFDAY
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index fc5fd048fc..66a9eacb7e 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -319,16 +319,6 @@ EXTRA_DIST += signature.h test-gettimeofday.c
## end gnulib module gettimeofday-tests
-## begin gnulib module iconv-tests
-
-TESTS += test-iconv
-check_PROGRAMS += test-iconv
-test_iconv_LDADD = $(LDADD) @LIBICONV@
-
-EXTRA_DIST += test-iconv.c signature.h macros.h
-
-## end gnulib module iconv-tests
-
## begin gnulib module intprops-tests
TESTS += test-intprops
@@ -390,6 +380,14 @@ EXTRA_DIST += test-inttypes.c
## end gnulib module inttypes-tests
+## begin gnulib module limits-h-tests
+
+TESTS += test-limits-h
+check_PROGRAMS += test-limits-h
+EXTRA_DIST += test-limits-h.c
+
+## end gnulib module limits-h-tests
+
## begin gnulib module memchr-tests
TESTS += test-memchr
diff --git a/gl/tests/init.sh b/gl/tests/init.sh
index 97e4e4ba5e..da743c2ab0 100644
--- a/gl/tests/init.sh
+++ b/gl/tests/init.sh
@@ -128,6 +128,13 @@ else
fi
# We require $(...) support unconditionally.
+# We require non-surprising "local" semantics (this eliminates dash).
+# This takes the admittedly draconian step of eliminating dash, because the
+# assignment tab=$(printf '\t') works fine, yet preceding it with "local "
+# transforms it into an assignment that sets the variable to the empty string.
+# That is too counter-intuitive, and can lead to subtle run-time malfunction.
+# The example below is less subtle in that with dash, it evokes the run-time
+# exception "dash: 1: local: 1: bad variable name".
# We require a few additional shell features only when $EXEEXT is nonempty,
# in order to support automatic $EXEEXT emulation:
# - hyphen-containing alias names
@@ -151,6 +158,7 @@ fi
gl_shell_test_script_='
test $(echo y) = y || exit 1
f_local_() { local v=1; }; f_local_ || exit 1
+f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_
score_=10
if test "$VERBOSE" = yes; then
test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
@@ -287,50 +295,24 @@ compare_dev_null_ ()
return 2
}
-if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null` \
- && diff -u Makefile "$0" 2>/dev/null | grep '^[+]#!' >/dev/null; then
- # diff accepts the -u option and does not (like AIX 7 'diff') produce an
- # extra space on column 1 of every content line.
- if test -z "$diff_out_"; then
- compare_ () { diff -u "$@"; }
- else
- compare_ ()
- {
- if diff -u "$@" > diff.out; then
- # No differences were found, but Solaris 'diff' produces output
- # "No differences encountered". Hide this output.
- rm -f diff.out
- true
- else
- cat diff.out
- rm -f diff.out
- false
- fi
- }
- fi
-elif
- for diff_opt_ in -U3 -c '' no; do
- test "$diff_opt_" = no && break
- diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" </dev/null` && break
- done
- test "$diff_opt_" != no
-then
+for diff_opt_ in -u -U3 -c '' no; do
+ test "$diff_opt_" != no &&
+ diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` &&
+ break
+done
+if test "$diff_opt_" != no; then
if test -z "$diff_out_"; then
compare_ () { diff $diff_opt_ "$@"; }
else
compare_ ()
{
- if diff $diff_opt_ "$@" > diff.out; then
- # No differences were found, but AIX and HP-UX 'diff' produce output
- # "No differences encountered" or "There are no differences between the
- # files.". Hide this output.
- rm -f diff.out
- true
- else
- cat diff.out
- rm -f diff.out
- false
- fi
+ # If no differences were found, AIX and HP-UX 'diff' produce output
+ # like "No differences encountered". Hide this output.
+ diff $diff_opt_ "$@" > diff.out
+ diff_status_=$?
+ test $diff_status_ -eq 0 || cat diff.out || diff_status_=2
+ rm -f diff.out || diff_status_=2
+ return $diff_status_
}
fi
elif cmp -s /dev/null /dev/null 2>/dev/null; then
diff --git a/gl/tests/test-iconv.c b/gl/tests/test-iconv.c
deleted file mode 100644
index 3e4c4ff0a7..0000000000
--- a/gl/tests/test-iconv.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Test of character set conversion.
- Copyright (C) 2007-2016 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 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/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#if HAVE_ICONV
-# include <iconv.h>
-
-# ifndef ICONV_CONST
-# define ICONV_CONST /* empty */
-# endif
-
-#include "signature.h"
-SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *,
- char **, size_t *));
-SIGNATURE_CHECK (iconv_close, int, (iconv_t x));
-SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *));
-
-#endif
-
-#include <errno.h>
-#include <string.h>
-
-#include "macros.h"
-
-int
-main ()
-{
-#if HAVE_ICONV
- /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
- and UTF-8. */
- iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8");
-
- ASSERT (cd_88591_to_utf8 != (iconv_t)(-1));
- ASSERT (cd_utf8_to_88591 != (iconv_t)(-1));
-
- /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */
- {
- static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
- static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
- char buf[50];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_88591_to_utf8,
- (ICONV_CONST char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- ASSERT (res == 0 && inbytesleft == 0);
- ASSERT (outptr == buf + strlen (expected));
- ASSERT (memcmp (buf, expected, strlen (expected)) == 0);
- }
-
- /* Test conversion from ISO-8859-1 to UTF-8 with E2BIG. */
- {
- static const char input[] = "\304";
- static char buf[2] = { (char)0xDE, (char)0xAD };
- const char *inptr = input;
- size_t inbytesleft = 1;
- char *outptr = buf;
- size_t outbytesleft = 1;
- size_t res = iconv (cd_88591_to_utf8,
- (ICONV_CONST char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- ASSERT (res == (size_t)(-1) && errno == E2BIG);
- ASSERT (inbytesleft == 1);
- ASSERT (outbytesleft == 1);
- ASSERT ((unsigned char) buf[1] == 0xAD);
- ASSERT ((unsigned char) buf[0] == 0xDE);
- }
-
- /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */
- {
- static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
- static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
- char buf[50];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_utf8_to_88591,
- (ICONV_CONST char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- ASSERT (res == 0 && inbytesleft == 0);
- ASSERT (outptr == buf + strlen (expected));
- ASSERT (memcmp (buf, expected, strlen (expected)) == 0);
- }
-
- /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */
- {
- static const char input[] = "\342\202\254"; /* EURO SIGN */
- 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_utf8_to_88591,
- (ICONV_CONST char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == (size_t)(-1))
- {
- ASSERT (errno == EILSEQ);
- ASSERT (inbytesleft == strlen (input) && outptr == buf);
- }
- else
- {
- ASSERT (res == 1);
- ASSERT (inbytesleft == 0);
- }
- }
-
- /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */
- {
- static const char input[] = "\342";
- char buf[10];
- const char *inptr = input;
- size_t inbytesleft = 1;
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_utf8_to_88591,
- (ICONV_CONST char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- ASSERT (res == (size_t)(-1) && errno == EINVAL);
- ASSERT (inbytesleft == 1 && outptr == buf);
- }
-
- iconv_close (cd_88591_to_utf8);
- iconv_close (cd_utf8_to_88591);
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-init.sh b/gl/tests/test-init.sh
index 1dd05f4504..a6278599ad 100755
--- a/gl/tests/test-init.sh
+++ b/gl/tests/test-init.sh
@@ -57,7 +57,8 @@ EOF
# Also remove the @@ line, since Solaris 5.10 and GNU diff formats differ:
# -@@ -0,0 +1 @@
# +@@ -1,0 +1,1 @@
- sed 's/ .*//;/^@@/d' out > k && mv k out
+ # Also, remove space after leading '+', since AIX 7.1 diff outputs a space.
+ sed 's/ .*//;/^@@/d;s/^+ /+/' out > k && mv k out
cat <<\EOF > exp
--- empty
+++ in
diff --git a/gl/tests/test-intprops.c b/gl/tests/test-intprops.c
index 51fe09638e..0a8ddcd748 100644
--- a/gl/tests/test-intprops.c
+++ b/gl/tests/test-intprops.c
@@ -22,12 +22,9 @@
# pragma GCC diagnostic ignored "-Woverlength-strings"
# pragma GCC diagnostic ignored "-Wtype-limits"
-/* Work around a bug in GCC 5.3.1 and earlier; see:
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971
- Hope it will be fixed by the time GCC 6 comes out. */
-# if __GNUC__ < 6
-# pragma GCC diagnostic ignored "-Woverflow"
-# endif
+/* Work around a bug in GCC 6.1 and earlier; see:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68971 */
+# pragma GCC diagnostic ignored "-Woverflow"
#endif
diff --git a/gl/tests/test-limits-h.c b/gl/tests/test-limits-h.c
new file mode 100644
index 0000000000..f5576bff01
--- /dev/null
+++ b/gl/tests/test-limits-h.c
@@ -0,0 +1,50 @@
+/* Test of <limits.h> substitute.
+ Copyright 2016 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 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/>. */
+
+/* Written by Paul Eggert. */
+
+#include <config.h>
+
+#include <limits.h>
+
+#include "verify.h"
+
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Woverlength-strings"
+#endif
+
+/* Macros specified by ISO/IEC TS 18661-1:2014. */
+
+#define verify_width(width, min, max) \
+ verify ((max) >> ((width) - 1 - ((min) < 0)) == 1)
+
+verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX);
+verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX);
+verify_width (UCHAR_WIDTH, 0, UCHAR_MAX);
+verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX);
+verify_width (USHRT_WIDTH, 0, USHRT_MAX);
+verify_width (INT_WIDTH, INT_MIN, INT_MAX);
+verify_width (UINT_WIDTH, 0, UINT_MAX);
+verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX);
+verify_width (ULONG_WIDTH, 0, ULONG_MAX);
+verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX);
+verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
+
+int
+main (void)
+{
+ return 0;
+}
diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c
index 7705fc706e..6eb1d2edab 100644
--- a/gl/tests/test-stdint.c
+++ b/gl/tests/test-stdint.c
@@ -351,6 +351,73 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
verify (UINTMAX_C (17) == 17);
verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
+/* Use _GL_VERIFY (with a fixed-length diagnostic string) rather than verify,
+ because the latter would require forming each stringified expression, and
+ many of these would be so long as to trigger a warning/error like this:
+
+ test-stdint.c:407:1: error: string length '6980' is greater than the \
+ length '4095' ISO C99 compilers are required to support \
+ [-Werror=overlength-strings]
+ */
+#define verify_width(width, min, max) \
+ _GL_VERIFY ((max) >> ((width) - 1 - ((min) < 0)) == 1, \
+ "verify_width check")
+
+/* Macros specified by ISO/IEC TS 18661-1:2014. */
+
+#ifdef INT8_MAX
+verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX);
+#endif
+#ifdef UINT8_MAX
+verify_width (UINT8_WIDTH, 0, UINT8_MAX);
+#endif
+#ifdef INT16_MAX
+verify_width (INT16_WIDTH, INT16_MIN, INT16_MAX);
+#endif
+#ifdef UINT16_MAX
+verify_width (UINT16_WIDTH, 0, UINT16_MAX);
+#endif
+#ifdef INT32_MAX
+verify_width (INT32_WIDTH, INT32_MIN, INT32_MAX);
+#endif
+#ifdef UINT32_MAX
+verify_width (UINT32_WIDTH, 0, UINT32_MAX);
+#endif
+#ifdef INT64_MAX
+verify_width (INT64_WIDTH, INT64_MIN, INT64_MAX);
+#endif
+#ifdef UINT64_MAX
+verify_width (UINT64_WIDTH, 0, UINT64_MAX);
+#endif
+verify_width (INT_LEAST8_WIDTH, INT_LEAST8_MIN, INT_LEAST8_MAX);
+verify_width (UINT_LEAST8_WIDTH, 0, UINT_LEAST8_MAX);
+verify_width (INT_LEAST16_WIDTH, INT_LEAST16_MIN, INT_LEAST16_MAX);
+verify_width (UINT_LEAST16_WIDTH, 0, UINT_LEAST16_MAX);
+verify_width (INT_LEAST32_WIDTH, INT_LEAST32_MIN, INT_LEAST32_MAX);
+verify_width (UINT_LEAST32_WIDTH, 0, UINT_LEAST32_MAX);
+verify_width (INT_LEAST64_WIDTH, INT_LEAST64_MIN, INT_LEAST64_MAX);
+verify_width (UINT_LEAST64_WIDTH, 0, UINT_LEAST64_MAX);
+verify_width (INT_FAST8_WIDTH, INT_FAST8_MIN, INT_FAST8_MAX);
+verify_width (UINT_FAST8_WIDTH, 0, UINT_FAST8_MAX);
+verify_width (INT_FAST16_WIDTH, INT_FAST16_MIN, INT_FAST16_MAX);
+verify_width (UINT_FAST16_WIDTH, 0, UINT_FAST16_MAX);
+verify_width (INT_FAST32_WIDTH, INT_FAST32_MIN, INT_FAST32_MAX);
+verify_width (UINT_FAST32_WIDTH, 0, UINT_FAST32_MAX);
+verify_width (INT_FAST64_WIDTH, INT_FAST64_MIN, INT_FAST64_MAX);
+verify_width (UINT_FAST64_WIDTH, 0, UINT_FAST64_MAX);
+verify_width (INTPTR_WIDTH, INTPTR_MIN, INTPTR_MAX);
+verify_width (UINTPTR_WIDTH, 0, UINTPTR_MAX);
+verify_width (INTMAX_WIDTH, INTMAX_MIN, INTMAX_MAX);
+verify_width (UINTMAX_WIDTH, 0, UINTMAX_MAX);
+verify_width (PTRDIFF_WIDTH, PTRDIFF_MIN, PTRDIFF_MAX);
+verify_width (SIZE_WIDTH, 0, SIZE_MAX);
+verify_width (WCHAR_WIDTH, WCHAR_MIN, WCHAR_MAX);
+#ifdef WINT_MAX
+verify_width (WINT_WIDTH, WINT_MIN, WINT_MAX);
+#endif
+#ifdef SIG_ATOMIC_MAX
+verify_width (SIG_ATOMIC_WIDTH, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX);
+#endif
int
main (void)
diff --git a/gl/tests/test-strverscmp.c b/gl/tests/test-strverscmp.c
index e5a6bb10f8..0cafe08fb1 100644
--- a/gl/tests/test-strverscmp.c
+++ b/gl/tests/test-strverscmp.c
@@ -41,5 +41,19 @@ main (void)
ASSERT (strverscmp ("09", "0") < 0);
ASSERT (strverscmp ("9", "10") < 0);
ASSERT (strverscmp ("0a", "0") > 0);
+
+ /* From glibc bug 9913. */
+ {
+ static char const a[] = "B0075022800016.gbp.corp.com";
+ static char const b[] = "B007502280067.gbp.corp.com";
+ static char const c[] = "B007502357019.GBP.CORP.COM";
+ ASSERT (strverscmp (a, b) < 0);
+ ASSERT (strverscmp (b, c) < 0);
+ ASSERT (strverscmp (a, c) < 0);
+ ASSERT (strverscmp (b, a) > 0);
+ ASSERT (strverscmp (c, b) > 0);
+ ASSERT (strverscmp (c, a) > 0);
+ }
+
return 0;
}
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index 2edb70c41f..7f75b9d556 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -195,7 +195,7 @@
/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
warnings in this file. Use -Dlint to suppress them. */
-#ifdef lint
+#if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
@@ -4832,9 +4832,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
break;
# else
*fbp++ = 'l';
- /*FALLTHROUGH*/
# endif
#endif
+ /*FALLTHROUGH*/
case TYPE_LONGINT:
case TYPE_ULONGINT:
#if HAVE_WINT_T
diff --git a/gl/verify.h b/gl/verify.h
index 267de29591..40846ec794 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -263,7 +263,7 @@ template <int w>
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER
# define assume(R) __assume (R)
-#elif (defined lint \
+#elif ((defined GCC_LINT || defined lint) \
&& (__has_builtin (__builtin_trap) \
|| 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
/* Doing it this way helps various packages when configured with
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index cf27441065..2468c96464 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -35,6 +35,7 @@
|| (defined __hpux \
&& ((defined _INTTYPES_INCLUDED && !defined strtoimax) \
|| defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
+ || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \
|| defined _GL_ALREADY_INCLUDING_WCHAR_H)
/* Special invocation convention:
- Inside glibc and uClibc header files, but not MinGW.
@@ -44,6 +45,8 @@
and once directly. In both situations 'wint_t' is not yet defined,
therefore we cannot provide the function overrides; instead include only
the system's <wchar.h>.
+ - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
+ <wchar.h> is actually processed, and that doesn't include 'mbstate_t'.
- On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
the latter includes <wchar.h>. But here, we have no way to detect whether
<wctype.h> is completely included or is still being included. */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 4f6daf095f..9c7425a91d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -136,7 +136,7 @@ libgnutls_la_LIBADD = ../gl/libgnu.la x509/libgnutls_x509.la \
auth/libgnutls_auth.la algorithms/libgnutls_alg.la \
extras/libgnutls_extras.la
thirdparty_libadd = $(LTLIBZ) $(LTLIBINTL) $(LIBSOCKET) $(LTLIBNSL) \
- $(LTLIBICONV) $(P11_KIT_LIBS) $(LIB_SELECT)
+ $(P11_KIT_LIBS) $(LIB_SELECT)
if HAVE_LIBIDN
thirdparty_libadd += $(LIBIDN_LIBS)
diff --git a/lib/gnutls.pc.in b/lib/gnutls.pc.in
index ed9de731ca..441b45db01 100644
--- a/lib/gnutls.pc.in
+++ b/lib/gnutls.pc.in
@@ -19,6 +19,6 @@ Description: Transport Security Layer implementation for the GNU system
URL: http://www.gnutls.org/
Version: @VERSION@
Libs: -L${libdir} -lgnutls
-Libs.private: @LTLIBZ@ @LTLIBINTL@ @LIBSOCKET@ @LTLIBNSL@ @LTLIBPTHREAD@ @LTLIBICONV@ @P11_KIT_LIBS@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @LTLIBUNISTRING@
+Libs.private: @LTLIBZ@ @LTLIBINTL@ @LIBSOCKET@ @LTLIBNSL@ @LTLIBPTHREAD@ @P11_KIT_LIBS@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @LTLIBUNISTRING@
@GNUTLS_REQUIRES_PRIVATE@
Cflags: -I${includedir}
diff --git a/maint.mk b/maint.mk
index b6ec1b5e16..c32f8b6d0e 100644
--- 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-2015 Free Software Foundation, Inc.
+## Copyright (C) 2001-2016 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
@@ -437,17 +437,26 @@ sc_require_config_h:
halt='the above files do not include <config.h>' \
$(_sc_search_regexp)
+# Print each file name for which the first #include does not match
+# $(config_h_header). Like grep -m 1, this only looks at the first match.
+perl_config_h_first_ = \
+ -e 'BEGIN {$$ret = 0}' \
+ -e 'if (/^\# *include\b/) {' \
+ -e ' if (not m{^\# *include $(config_h_header)}) {' \
+ -e ' print "$$ARGV\n";' \
+ -e ' $$ret = 1;' \
+ -e ' }' \
+ -e ' \# Move on to next file after first include' \
+ -e ' close ARGV;' \
+ -e '}' \
+ -e 'END {exit $$ret}'
+
# You must include <config.h> before including any other header file.
# This can possibly be via a package-specific header, if given by cfg.mk.
sc_require_config_h_first:
@if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
- fail=0; \
- for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \
- grep '^# *include\>' $$i | $(SED) 1q \
- | grep -E '^# *include $(config_h_header)' > /dev/null \
- || { echo $$i; fail=1; }; \
- done; \
- test $$fail = 1 && \
+ files=$$($(VC_LIST_EXCEPT) | grep '\.c$$') && \
+ perl -n $(perl_config_h_first_) $$files || \
{ echo '$(ME): the above files include some other header' \
'before <config.h>' 1>&2; exit 1; } || :; \
else :; \
@@ -651,8 +660,7 @@ sc_prohibit_strings_without_use:
# Get the list of symbol names with this:
# perl -lne '/^# *define ([A-Z]\w+)\(/ and print $1' lib/intprops.h|fmt
_intprops_names = \
- TYPE_IS_INTEGER TYPE_TWOS_COMPLEMENT TYPE_ONES_COMPLEMENT \
- TYPE_SIGNED_MAGNITUDE TYPE_SIGNED TYPE_MINIMUM TYPE_MAXIMUM \
+ TYPE_IS_INTEGER TYPE_SIGNED TYPE_MINIMUM TYPE_MAXIMUM \
INT_BITS_STRLEN_BOUND INT_STRLEN_BOUND INT_BUFSIZE_BOUND \
INT_ADD_RANGE_OVERFLOW INT_SUBTRACT_RANGE_OVERFLOW \
INT_NEGATE_RANGE_OVERFLOW INT_MULTIPLY_RANGE_OVERFLOW \
@@ -709,15 +717,6 @@ sc_changelog:
$(_sc_search_regexp)
# Ensure that each .c file containing a "main" function also
-# calls set_program_name.
-sc_program_name:
- @require='set_program_name *\(.*\);' \
- in_vc_files='\.c$$' \
- containing='\<main *(' \
- halt='the above files do not call set_program_name' \
- $(_sc_search_regexp)
-
-# Ensure that each .c file containing a "main" function also
# calls bindtextdomain.
sc_bindtextdomain:
@require='bindtextdomain *\(' \
@@ -954,8 +953,13 @@ perl_filename_lineno_text_ = \
-e ' print "$$ARGV:$$n:$$v\n";' \
-e ' }'
+prohibit_doubled_words_ = \
+ the then in an on if is it but for or at and do to
+# expand the regex before running the check to avoid using expensive captures
+prohibit_doubled_word_expanded_ = \
+ $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_)))
prohibit_doubled_word_RE_ ?= \
- /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims
+ /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims
prohibit_doubled_word_ = \
-e 'while ($(prohibit_doubled_word_RE_))' \
$(perl_filename_lineno_text_)
@@ -1124,6 +1128,21 @@ fix_po_file_diag = \
'you have changed the set of files with translatable diagnostics;\n\
apply the above patch\n'
+# Generate a list of files in which to search for translatable strings.
+perl_translatable_files_list_ = \
+ -e 'foreach $$file (@ARGV) {' \
+ -e ' \# Consider only file extensions with one or two letters' \
+ -e ' $$file =~ /\...?$$/ or next;' \
+ -e ' \# Ignore m4 and mk files' \
+ -e ' $$file =~ /\.m[4k]$$/ and next;' \
+ -e ' \# Ignore a .c or .h file with a corresponding .l or .y file' \
+ -e ' $$file =~ /(.+)\.[ch]$$/ && (-e "$${1}.l" || -e "$${1}.y")' \
+ -e ' and next;' \
+ -e ' \# Skip unreadable files' \
+ -e ' -r $$file or next;' \
+ -e ' print "$$file ";' \
+ -e '}'
+
# Verify that all source files using _() (more specifically, files that
# match $(_gl_translatable_string_re)) are listed in po/POTFILES.in.
po_file ?= $(srcdir)/po/POTFILES.in
@@ -1133,21 +1152,8 @@ sc_po_check:
@if test -f $(po_file); then \
grep -E -v '^(#|$$)' $(po_file) \
| grep -v '^src/false\.c$$' | sort > $@-1; \
- files=; \
- for file in $$($(VC_LIST_EXCEPT)) $(generated_files); do \
- test -r $$file || continue; \
- case $$file in \
- *.m4|*.mk) continue ;; \
- *.?|*.??) ;; \
- *) continue;; \
- esac; \
- case $$file in \
- *.[ch]) \
- base=`expr " $$file" : ' \(.*\)\..'`; \
- { test -f $$base.l || test -f $$base.y; } && continue;; \
- esac; \
- files="$$files $$file"; \
- done; \
+ files=$$(perl $(perl_translatable_files_list_) \
+ $$($(VC_LIST_EXCEPT)) $(generated_files)); \
grep -E -l '$(_gl_translatable_string_re)' $$files \
| $(SED) 's|^$(_dot_escaped_srcdir)/||' | sort -u > $@-2; \
diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \
@@ -1600,7 +1606,7 @@ ifeq (a,b)
# do not need to be marked. Symbols matching '__.*' are
# reserved by the compiler, so are automatically excluded below.
_gl_TS_unmarked_extern_functions ?= main usage
-_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) *\(/
+_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\w+) *\(/
# If your project uses a macro like "XTERN", then put
# the following in cfg.mk to override this default:
@@ -1633,6 +1639,7 @@ _gl_TS_other_headers ?= *.h
.PHONY: _gl_tight_scope
_gl_tight_scope: $(bin_PROGRAMS)
+ sed_wrap='s/^/^_?/;s/$$/$$/'; \
t=exceptions-$$$$; \
trap 's=$$?; rm -f $$t; exit $$s' 0; \
for sig in 1 2 3 13 15; do \
@@ -1642,19 +1649,19 @@ _gl_tight_scope: $(bin_PROGRAMS)
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
hdr=`for f in $(_gl_TS_headers); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
- ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_functions); \
+ ( printf '%s\n' '__.*' $(_gl_TS_unmarked_extern_functions); \
grep -h -A1 '^extern .*[^;]$$' $$src \
- | grep -vE '^(extern |--)' | $(SED) 's/ .*//'; \
+ | grep -vE '^(extern |--|#)' | $(SED) 's/ .*//; /^$$/d'; \
perl -lne \
- '$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr; \
- ) | sort -u > $$t; \
+ '$(_gl_TS_function_match) and print $$1' $$hdr; \
+ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|grep -Ev -f $$t \
&& { echo the above functions should have static scope >&2; \
exit 1; } || : ; \
- ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars); \
- perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' \
+ ( printf '%s\n' '__.*' main $(_gl_TS_unmarked_extern_vars); \
+ perl -lne '$(_gl_TS_var_match) and print $$1' \
$$hdr $(_gl_TS_other_headers) \
- ) | sort -u > $$t; \
+ ) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \
| sort -u | grep -Ev -f $$t \
&& { echo the above variables should have static scope >&2; \