summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-10-29 18:33:17 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-10-29 18:33:17 +0100
commit4fcc9e988b0283ad438836098f30adf5cd4acb7c (patch)
tree9d4e4b72638ccfb7059b4503622988e91a421447
parent6cda033627007ac64f8a0643309c7e0d83aec893 (diff)
downloadgnutls-4fcc9e988b0283ad438836098f30adf5cd4acb7c.tar.gz
Updated gnulib
-rwxr-xr-xbuild-aux/config.rpath106
-rwxr-xr-xbuild-aux/gendocs.sh14
-rw-r--r--build-aux/pmccabe2html18
-rwxr-xr-xbuild-aux/test-driver127
-rw-r--r--gl/Makefile.am20
-rw-r--r--gl/argp-fmtstream.h3
-rw-r--r--gl/argp-help.c2
-rw-r--r--gl/argp.h3
-rw-r--r--gl/c-ctype.h3
-rw-r--r--gl/dup2.c4
-rw-r--r--gl/error.c2
-rw-r--r--gl/fseeko.c10
-rw-r--r--gl/intprops.h2
-rw-r--r--gl/m4/dup2.m47
-rw-r--r--gl/m4/extensions.m42
-rw-r--r--gl/m4/extern-inline.m445
-rw-r--r--gl/m4/frexp.m410
-rw-r--r--gl/m4/fseeko.m44
-rw-r--r--gl/m4/getdtablesize.m444
-rw-r--r--gl/m4/gnulib-comp.m412
-rw-r--r--gl/m4/intl.m441
-rw-r--r--gl/m4/inttypes.m41
-rw-r--r--gl/m4/lock.m43
-rw-r--r--gl/m4/manywarnings.m410
-rw-r--r--gl/m4/po.m49
-rw-r--r--gl/m4/putenv.m44
-rw-r--r--gl/m4/stdalign.m48
-rw-r--r--gl/m4/sys_types_h.m44
-rw-r--r--gl/m4/unistd_h.m43
-rw-r--r--gl/m4/warnings.m430
-rw-r--r--gl/math.in.h3
-rw-r--r--gl/msvc-inval.c6
-rw-r--r--gl/signal.in.h14
-rw-r--r--gl/stdalign.in.h39
-rw-r--r--gl/stdio-impl.h2
-rw-r--r--gl/stdio.in.h23
-rw-r--r--gl/strerror-override.h2
-rw-r--r--gl/sys_select.in.h16
-rw-r--r--gl/sys_socket.in.h3
-rw-r--r--gl/sys_time.in.h10
-rw-r--r--gl/tests/Makefile.am20
-rw-r--r--gl/tests/binary-io.h3
-rw-r--r--gl/tests/getcwd-lgpl.c1
-rw-r--r--gl/tests/getdtablesize.c107
-rw-r--r--gl/tests/ignore-value.h13
-rw-r--r--gl/tests/inttypes.in.h16
-rw-r--r--gl/tests/macros.h4
-rw-r--r--gl/tests/malloca.c29
-rw-r--r--gl/tests/malloca.h2
-rw-r--r--gl/tests/putenv.c82
-rw-r--r--gl/tests/test-dup2.c16
-rw-r--r--gl/tests/test-getaddrinfo.c5
-rw-r--r--gl/tests/test-getdtablesize.c36
-rw-r--r--gl/tests/test-snprintf.c2
-rw-r--r--gl/tests/test-sys_select.c5
-rw-r--r--gl/tests/test-sys_socket.c2
-rw-r--r--gl/tests/test-sys_time.c5
-rw-r--r--gl/tests/test-vasnprintf.c2
-rw-r--r--gl/tests/test-vsnprintf.c2
-rw-r--r--gl/timespec.h20
-rw-r--r--gl/u64.h3
-rw-r--r--gl/unistd.in.h20
-rw-r--r--gl/vasnprintf.c3
-rw-r--r--gl/verify.h134
-rw-r--r--gl/xsize.h3
-rw-r--r--maint.mk6
66 files changed, 907 insertions, 303 deletions
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 17298f2348..c38b914d6b 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2010 Free Software Foundation, Inc.
+# Copyright 1996-2013 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@@ -25,7 +25,7 @@
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
@@ -57,13 +57,6 @@ else
aix*)
wl='-Wl,'
;;
- darwin*)
- case $cc_basename in
- xlc*)
- wl='-Wl,'
- ;;
- esac
- ;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
@@ -72,9 +65,7 @@ else
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
- newsos6)
- ;;
- linux* | k*bsd*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
@@ -85,17 +76,26 @@ else
lf95*)
wl='-Wl,'
;;
- pgcc | pgf77 | pgf90)
+ nagfor*)
+ wl='-Wl,-Wl,,'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
+ xl* | bgxl* | bgf* | mpixl*)
+ wl='-Wl,'
+ ;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ F* | *Sun*Fortran*)
+ wl=
+ ;;
*Sun\ C*)
wl='-Wl,'
;;
@@ -103,13 +103,24 @@ else
;;
esac
;;
+ newsos6)
+ ;;
+ *nto* | *qnx*)
+ ;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
- wl='-Wl,'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ wl='-Qoption ld '
+ ;;
+ *)
+ wl='-Wl,'
+ ;;
+ esac
;;
sunos4*)
wl='-Qoption ld '
@@ -171,15 +182,14 @@ if test "$with_gnu_ld" = yes; then
fi
;;
amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we cannot use
- # them.
- ld_shlibs=no
+ case "$host_cpu" in
+ powerpc)
+ ;;
+ m68k)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
@@ -198,11 +208,13 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
+ haiku*)
+ ;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
- gnu* | linux* | k*bsd*-gnu)
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
@@ -325,10 +337,14 @@ else
fi
;;
amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # see comment about different semantics on the GNU ld section
- ld_shlibs=no
+ case "$host_cpu" in
+ powerpc)
+ ;;
+ m68k)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
;;
bsdi[45]*)
;;
@@ -342,24 +358,15 @@ else
;;
darwin* | rhapsody*)
hardcode_direct=no
- if test "$GCC" = yes ; then
+ if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
:
else
- case $cc_basename in
- xlc*)
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
+ ld_shlibs=no
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
- freebsd1*)
- ld_shlibs=no
- ;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
@@ -420,6 +427,8 @@ else
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
+ *nto* | *qnx*)
+ ;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
@@ -515,7 +524,12 @@ case "$host_os" in
library_names_spec='$libname$shrext'
;;
amigaos*)
- library_names_spec='$libname.a'
+ case "$host_cpu" in
+ powerpc*)
+ library_names_spec='$libname$shrext' ;;
+ m68k)
+ library_names_spec='$libname.a' ;;
+ esac
;;
beos*)
library_names_spec='$libname$shrext'
@@ -534,8 +548,6 @@ case "$host_os" in
dgux*)
library_names_spec='$libname$shrext'
;;
- freebsd1*)
- ;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
@@ -547,6 +559,9 @@ case "$host_os" in
gnu*)
library_names_spec='$libname$shrext'
;;
+ haiku*)
+ library_names_spec='$libname$shrext'
+ ;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
@@ -582,7 +597,7 @@ case "$host_os" in
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
- linux* | k*bsd*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
@@ -594,7 +609,7 @@ case "$host_os" in
newsos6)
library_names_spec='$libname$shrext'
;;
- nto-qnx*)
+ *nto* | *qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
@@ -625,6 +640,9 @@ case "$host_os" in
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
+ tpf*)
+ library_names_spec='$libname$shrext'
+ ;;
uts4*)
library_names_spec='$libname$shrext'
;;
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index e4bfc9fd2b..98c7523536 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -2,7 +2,7 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2013-02-03.15
+scriptversion=2013-03-08.15
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
# Free Software Foundation, Inc.
@@ -307,6 +307,7 @@ if $generate_ascii; then
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
fi
+# Split HTML at level $1. Used for texi2html.
html_split()
{
opt="--split=$1 --node-files $commonarg $htmlarg"
@@ -339,7 +340,16 @@ if test -z "$use_texi2html"; then
mv $PACKAGE.html "$outdir/"
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
- opt="--html -o $PACKAGE.html --split=$split $commonarg $htmlarg"
+ # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
+ # it just always split by node. So if we're splitting by node anyway,
+ # leave it out.
+ if test "x$split" = xnode; then
+ split_arg=
+ else
+ split_arg=--split=$split
+ fi
+ #
+ opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating html by $split... ($cmd)\n"
eval "$cmd"
diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
index 863c73e939..ffd07881b3 100644
--- a/build-aux/pmccabe2html
+++ b/build-aux/pmccabe2html
@@ -47,6 +47,10 @@
# Prologue & configuration
BEGIN {
+ # Portable lookup of present time.
+ "date +%s" | getline epoch_time
+ "date" | getline chronos_time
+
section_global_stats_p = 1
section_function_cyclo_p = 1
@@ -69,7 +73,7 @@ BEGIN {
Copyright (c) 2007, 2008 Free Software Foundation, Inc."
html_doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \
\"http://www.w3.org/TR/html401/loose.dtd\">"
- html_comment = "<!-- Generated by gnulib's pmccabe2html at " systime() " -->"
+ html_comment = "<!-- Generated by gnulib's pmccabe2html at " epoch_time " -->"
html_title = "Cyclomatic Complexity report for " package_name
# Wiki options
@@ -211,7 +215,7 @@ function html_header ()
print cssline
}
print "-->"
- print "</style />"
+ print "</style>"
close(css)
}
print "</head>"
@@ -418,9 +422,9 @@ function html_fnc (nfun,
while ((getline codeline < (fname nfun "_fn.txt")) > 0)
{
- sub(/\\</, "&lt;", codeline)
- sub(/\\>/, "&gt;", codeline)
- sub(/&/, "&amp;", codeline)
+ gsub(/&/, "\&amp;", codeline) # Must come first.
+ gsub(/</, "\&lt;", codeline)
+ gsub(/>/, "\&gt;", codeline)
print codeline
}
@@ -852,12 +856,12 @@ END {
if (output_lang == "html")
{
print "<div class=\"page_title\">" package_name " Cyclomatic Complexity Report</div>"
- print "<p>Report generated at: <span class=\"report_timestamp\">" strftime() "</div></p>"
+ print "<p>Report generated at: <span class=\"report_timestamp\">" chronos_time "</span></p>"
}
if (output_lang == "wiki")
{
print "==" package_name " Cyclomatic Complexity Report=="
- print "Report generated at: '''" strftime() "'''"
+ print "Report generated at: '''" chronos_time "'''"
}
if (section_global_stats_p)
diff --git a/build-aux/test-driver b/build-aux/test-driver
new file mode 100755
index 0000000000..32bf39e837
--- /dev/null
+++ b/build-aux/test-driver
@@ -0,0 +1,127 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2012-06-27.10; # UTC
+
+# Copyright (C) 2011-2013 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 2, 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "test-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) enable_hard_errors=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ esac
+ shift
+done
+
+if test $color_tests = yes; then
+ # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+ red='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+ estatus=1
+fi
+
+case $estatus:$expect_failure in
+ 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+ 0:*) col=$grn res=PASS recheck=no gcopy=no;;
+ 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
+ 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
+ *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
+ *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
+esac
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# 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-end: "; # UTC"
+# End:
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 0b5861b6a1..d20a80b411 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -23,7 +23,7 @@
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --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 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp base64 bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime hash-pjw-bare havelib iconv iconv_open-utf inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r timer-time timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
-AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
+AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects
SUBDIRS =
noinst_HEADERS =
@@ -568,15 +568,16 @@ EXTRA_libgnu_la_SOURCES += getsubopt.c
## begin gnulib module gettext
-# This is for those projects which use "gettextize --intl" to put a source-code
-# copy of libintl into their package. In such projects, every Makefile.am needs
+# If your project uses "gettextize --intl" to put a source-code
+# copy of libintl into the package, every Makefile.am needs
# -I$(top_builddir)/intl, so that <libintl.h> can be found in this directory.
-# For the Makefile.ams in other directories it is the maintainer's
-# responsibility; for the one from gnulib we do it here.
-# This option has no effect when the user disables NLS (because then the intl
-# directory contains no libintl.h file) or when the project does not use
-# "gettextize --intl".
-AM_CPPFLAGS += -I$(top_builddir)/intl
+# Here's one way to do this:
+#AM_CPPFLAGS += -I$(top_builddir)/intl
+# This option has no effect when the user disables NLS (because then
+# the intl directory contains no libintl.h file). This option is not
+# enabled by default because the intl directory might not exist if
+# your project does not use "gettext --intl", and some compilers
+# complain about -I options applied to nonexistent directories.
EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
@@ -2587,6 +2588,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
+ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
diff --git a/gl/argp-fmtstream.h b/gl/argp-fmtstream.h
index 000090ea68..0222d1d49c 100644
--- a/gl/argp-fmtstream.h
+++ b/gl/argp-fmtstream.h
@@ -197,6 +197,9 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
#define __argp_fmtstream_point argp_fmtstream_point
#define __argp_fmtstream_update _argp_fmtstream_update
#define __argp_fmtstream_ensure _argp_fmtstream_ensure
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef ARGP_FS_EI
# define ARGP_FS_EI _GL_INLINE
diff --git a/gl/argp-help.c b/gl/argp-help.c
index 354f1e22f5..85def445ed 100644
--- a/gl/argp-help.c
+++ b/gl/argp-help.c
@@ -649,7 +649,7 @@ hol_find_entry (struct hol *hol, const char *name)
return 0;
}
-/* If an entry with the long option NAME occurs in HOL, set it's special
+/* If an entry with the long option NAME occurs in HOL, set its special
sort position to GROUP. */
static void
hol_set_group (struct hol *hol, const char *name, int group)
diff --git a/gl/argp.h b/gl/argp.h
index c4094a40c3..a5f686a975 100644
--- a/gl/argp.h
+++ b/gl/argp.h
@@ -579,6 +579,9 @@ extern void *__argp_input (const struct argp *__restrict __argp,
# define __argp_state_help argp_state_help
# define __option_is_short _option_is_short
# define __option_is_end _option_is_end
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
# ifndef ARGP_EI
# define ARGP_EI _GL_INLINE
diff --git a/gl/c-ctype.h b/gl/c-ctype.h
index 3a66440ae9..ad589b5c20 100644
--- a/gl/c-ctype.h
+++ b/gl/c-ctype.h
@@ -136,7 +136,8 @@ extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
-#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
+#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \
+ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS)
/* ASCII optimizations. */
diff --git a/gl/dup2.c b/gl/dup2.c
index 9219eb3823..f128e7a63c 100644
--- a/gl/dup2.c
+++ b/gl/dup2.c
@@ -96,7 +96,11 @@ rpl_dup2 (int fd, int desired_fd)
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
On Cygwin 1.5.x, dup2 (1, 1) returns 0.
On Cygwin 1.7.17, dup2 (1, -1) dumps core.
+ On Cygwin 1.7.25, dup2 (1, 256) can dump core.
On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
+# if HAVE_SETDTABLESIZE
+ setdtablesize (desired_fd + 1);
+# endif
if (desired_fd < 0)
fd = desired_fd;
if (fd == desired_fd)
diff --git a/gl/error.c b/gl/error.c
index 865b29340b..cdc3026fc9 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -195,7 +195,7 @@ print_errno_message (int errnum)
#endif
}
-static void
+static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
error_tail (int status, int errnum, const char *message, va_list args)
{
#if _LIBC
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 42cd642854..c03be3d0c5 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -19,7 +19,7 @@
/* Specification. */
#include <stdio.h>
-/* Get off_t and lseek. */
+/* Get off_t, lseek, _POSIX_VERSION. */
#include <unistd.h>
#include "stdio-impl.h"
@@ -99,8 +99,14 @@ fseeko (FILE *fp, off_t offset, int whence)
#elif defined EPLAN9 /* Plan9 */
if (fp->rp == fp->buf
&& fp->wp == fp->buf)
+#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
+ /* Cross-compiling to some other system advertising conformance to
+ POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
+ If this assumption is incorrect, please report the bug to
+ bug-gnulib. */
+ if (0)
#else
- #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
+ #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
#endif
{
/* We get here when an fflush() call immediately preceded this one (or
diff --git a/gl/intprops.h b/gl/intprops.h
index b473052d11..f57f9b4dda 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -89,7 +89,7 @@
/* Return 1 if the __typeof__ keyword works. This could be done by
'configure', but for now it's easier to do it by hand. */
-#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C
+#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C
# define _GL_HAVE___TYPEOF__ 1
#else
# define _GL_HAVE___TYPEOF__ 0
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
index 269cfdc112..dc3070c0d9 100644
--- a/gl/m4/dup2.m4
+++ b/gl/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 19
+#serial 20
dnl Copyright (C) 2002, 2005, 2007, 2009-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -39,9 +39,11 @@ AC_DEFUN([gl_FUNC_DUP2],
/* Many gnulib modules require POSIX conformance of EBADF. */
if (dup2 (2, 1000000) == -1 && errno != EBADF)
result |= 16;
- /* Flush out a cygwin core dump. */
+ /* Flush out some cygwin core dumps. */
if (dup2 (2, -1) != -1 || errno != EBADF)
result |= 32;
+ dup2 (2, 255);
+ dup2 (2, 256);
return result;
])
],
@@ -65,6 +67,7 @@ AC_DEFUN([gl_FUNC_DUP2],
*yes) ;;
*)
REPLACE_DUP2=1
+ AC_CHECK_FUNCS([setdtablesize])
;;
esac
fi
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 07ba376c0e..e30f12206c 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -6,7 +6,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
# Autoconf. Perhaps we can remove this once we can assume Autoconf
# 2.70 or later everywhere, but since Autoconf mutates rapidly
# enough in this area it's likely we'll need to redefine
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4
index 0152f29326..e4454d8fe3 100644
--- a/gl/m4/extern-inline.m4
+++ b/gl/m4/extern-inline.m4
@@ -1,3 +1,4 @@
+# extern-inline.m4 serial 2
dnl 'extern inline' a la ISO C99.
dnl Copyright 2012-2013 Free Software Foundation, Inc.
@@ -8,37 +9,47 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_EXTERN_INLINE],
[
AH_VERBATIM([extern_inline],
-[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
- _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
- _GL_INLINE_HEADER_BEGIN contains useful stuff to put
- in an include file, before uses of _GL_INLINE.
- It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
- when FOO is an inline function in the header; see
- <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
- _GL_INLINE_HEADER_END contains useful stuff to put
- in the same include file, after uses of _GL_INLINE.
+[/* Please see the Gnulib manual for how to use these macros.
Suppress extern inline with HP-UX cc, as it appears to be broken; see
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
- Suppress the use of extern inline on Apple's platforms,
- as Libc-825.25 (2012-09-19) is incompatible with it; see
+ Suppress extern inline with Sun C in standards-conformance mode, as it
+ mishandles inline functions that call each other. E.g., for 'inline void f
+ (void) { } inline void g (void) { f (); }', c99 incorrectly complains
+ 'reference to static identifier "f" in extern inline function'.
+ This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
+
+ Suppress the use of extern inline on problematic Apple configurations, as
+ Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
<http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
Perhaps Apple will fix this some day. */
+#if (defined __APPLE__ \
+ && ((! defined _DONT_USE_CTYPE_INLINE_ \
+ && (defined __GNUC__ || defined __cplusplus)) \
+ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
+ && defined __GNUC__ && ! defined __cplusplus)))
+# define _GL_EXTERN_INLINE_APPLE_BUG
+#endif
#if ((__GNUC__ \
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
- : 199901L <= __STDC_VERSION__ && !defined __HP_cc) \
- && !defined __APPLE__)
+ : (199901L <= __STDC_VERSION__ \
+ && !defined __HP_cc \
+ && !(defined __SUNPRO_C && __STDC__))) \
+ && !defined _GL_EXTERN_INLINE_APPLE_BUG)
# define _GL_INLINE inline
# define _GL_EXTERN_INLINE extern inline
-#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
-# if __GNUC_GNU_INLINE__
+# define _GL_EXTERN_INLINE_IN_USE
+#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
+ && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
# else
# define _GL_INLINE extern inline
# endif
# define _GL_EXTERN_INLINE extern
+# define _GL_EXTERN_INLINE_IN_USE
#else
# define _GL_INLINE static _GL_UNUSED
# define _GL_EXTERN_INLINE static _GL_UNUSED
@@ -51,6 +62,10 @@ AC_DEFUN([gl_EXTERN_INLINE],
# define _GL_INLINE_HEADER_CONST_PRAGMA \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
# endif
+ /* Suppress GCC's bogus "no previous prototype for 'FOO'"
+ and "no previous declaration for 'FOO'" diagnostics,
+ when FOO is an inline function in the header; see
+ <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
# define _GL_INLINE_HEADER_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
diff --git a/gl/m4/frexp.m4 b/gl/m4/frexp.m4
index 39097923e4..2eb98a1dcd 100644
--- a/gl/m4/frexp.m4
+++ b/gl/m4/frexp.m4
@@ -1,4 +1,4 @@
-# frexp.m4 serial 14
+# frexp.m4 serial 15
dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -93,7 +93,7 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_FUNCS_ONCE([alarm])
+ AC_CHECK_DECLS_ONCE([alarm])
AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
[
AC_RUN_IFELSE(
@@ -101,7 +101,8 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
#include <float.h>
#include <math.h>
#include <string.h>
-#if HAVE_ALARM
+#if HAVE_DECL_ALARM
+# include <signal.h>
# include <unistd.h>
#endif
/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
@@ -124,9 +125,10 @@ int main()
int i;
volatile double x;
double zero = 0.0;
-#if HAVE_ALARM
+#if HAVE_DECL_ALARM
/* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite
number. Let the test fail in this case. */
+ signal (SIGALRM, SIG_DFL);
alarm (5);
#endif
/* Test on denormalized numbers. */
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index e0f2dfbe1f..ca9da2835d 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 16
+# fseeko.m4 serial 17
dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,7 @@ AC_DEFUN([gl_FUNC_FSEEKO],
fi
m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
gl_FUNC_FFLUSH_STDIN
- if test $gl_cv_func_fflush_stdin = no; then
+ if test $gl_cv_func_fflush_stdin != yes; then
REPLACE_FSEEKO=1
fi
])
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
new file mode 100644
index 0000000000..b3fa1af6a5
--- /dev/null
+++ b/gl/m4/getdtablesize.m4
@@ -0,0 +1,44 @@
+# getdtablesize.m4 serial 5
+dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_GETDTABLESIZE],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CHECK_FUNCS_ONCE([getdtablesize])
+ if test $ac_cv_func_getdtablesize = yes; then
+ # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
+ # up to an unchangeable hard limit; all other platforms correctly
+ # require setrlimit before getdtablesize() can report a larger value.
+ AC_CACHE_CHECK([whether getdtablesize works],
+ [gl_cv_func_getdtablesize_works],
+ [AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[#include <unistd.h>]],
+ [int size = getdtablesize();
+ if (dup2 (0, getdtablesize()) != -1)
+ return 1;
+ if (size != getdtablesize())
+ return 2;
+ ])],
+ [gl_cv_func_getdtablesize_works=yes],
+ [gl_cv_func_getdtablesize_works=no],
+ [case "$host_os" in
+ cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
+ gl_cv_func_getdtablesize_works="guessing no" ;;
+ *) gl_cv_func_getdtablesize_works="guessing yes" ;;
+ esac])
+ ])
+ case "$gl_cv_func_getdtablesize_works" in
+ *yes) ;;
+ *) REPLACE_GETDTABLESIZE=1 ;;
+ esac
+ else
+ HAVE_GETDTABLESIZE=0
+ fi
+])
+
+# Prerequisites of lib/getdtablesize.c.
+AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index c92e5ac104..baaa92796f 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -126,6 +126,8 @@ AC_DEFUN([gl_EARLY],
# Code from module getcwd-lgpl-tests:
# Code from module getdelim:
# Code from module getdelim-tests:
+ # Code from module getdtablesize:
+ # Code from module getdtablesize-tests:
# Code from module getline:
# Code from module getline-tests:
# Code from module getopt-gnu:
@@ -967,6 +969,12 @@ changequote([, ])dnl
AC_LIBOBJ([getcwd-lgpl])
fi
gl_UNISTD_MODULE_INDICATOR([getcwd])
+ gl_FUNC_GETDTABLESIZE
+ if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then
+ AC_LIBOBJ([getdtablesize])
+ gl_PREREQ_GETDTABLESIZE
+ fi
+ gl_UNISTD_MODULE_INDICATOR([getdtablesize])
gl_FUNC_GETPAGESIZE
if test $REPLACE_GETPAGESIZE = 1; then
AC_LIBOBJ([getpagesize])
@@ -990,6 +998,7 @@ changequote([, ])dnl
gl_LOCALENAME
AC_CHECK_FUNCS_ONCE([newlocale])
gl_LOCK
+ gl_MODULE_INDICATOR([lock])
gl_FUNC_LSTAT
if test $REPLACE_LSTAT = 1; then
AC_LIBOBJ([lstat])
@@ -1435,6 +1444,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/getaddrinfo.m4
m4/getcwd.m4
m4/getdelim.m4
+ m4/getdtablesize.m4
m4/getline.m4
m4/getopt.m4
m4/getpagesize.m4
@@ -1654,6 +1664,7 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-getaddrinfo.c
tests/test-getcwd-lgpl.c
tests/test-getdelim.c
+ tests/test-getdtablesize.c
tests/test-getline.c
tests/test-getopt.c
tests/test-getopt.h
@@ -1775,6 +1786,7 @@ AC_DEFUN([gl_FILE_LIST], [
tests=lib/fdopen.c
tests=lib/ftruncate.c
tests=lib/getcwd-lgpl.c
+ tests=lib/getdtablesize.c
tests=lib/getpagesize.c
tests=lib/glthread/lock.c
tests=lib/glthread/lock.h
diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4
index b8cc79f8a3..dffcd881b8 100644
--- a/gl/m4/intl.m4
+++ b/gl/m4/intl.m4
@@ -1,4 +1,4 @@
-# intl.m4 serial 17d
+# intl.m4 serial 24 (gettext-0.18.3)
dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ dnl Authors:
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009.
-AC_PREREQ([2.53])
+AC_PREREQ([2.60])
dnl Checks for all prerequisites of the intl subdirectory,
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
@@ -55,21 +55,19 @@ AC_DEFUN([AM_INTL_SUBDIR],
[AC_DEFINE([ptrdiff_t], [long],
[Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
])
- AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
+ AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h])
AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
dnl Use the _snprintf function only if it is declared (because on NetBSD it
dnl is defined as a weak alias of snprintf; we prefer to use the latter).
- gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
- gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
+ AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>])
dnl Use the *_unlocked functions only if they are declared.
dnl (because some of them were defined without being declared in Solaris
dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
dnl on Solaris 2.5.1 to run on Solaris 2.6).
- dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
- gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
+ AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>])
case $gt_cv_func_printf_posix in
*yes) HAVE_POSIX_PRINTF=1 ;;
@@ -236,9 +234,7 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
dnl (because some of them were defined without being declared in Solaris
dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
dnl on Solaris 2.5.1 to run on Solaris 2.6).
- dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
- gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>])
- gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>])
+ AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>])
AM_ICONV
@@ -273,28 +269,3 @@ changequote([,])dnl
INTLBISON=:
fi
])
-
-
-dnl gt_CHECK_DECL(FUNC, INCLUDES)
-dnl Check whether a function is declared.
-AC_DEFUN([gt_CHECK_DECL],
-[
- AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[$2]],
- [[
-#ifndef $1
- char *p = (char *) $1;
-#endif
- ]])],
- [ac_cv_have_decl_$1=yes],
- [ac_cv_have_decl_$1=no])])
- if test $ac_cv_have_decl_$1 = yes; then
- gt_value=1
- else
- gt_value=0
- fi
- AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
- [Define to 1 if you have the declaration of '$1', and to 0 if you don't.])
-])
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4
index 3b483d39f5..b06c77753b 100644
--- a/gl/m4/inttypes.m4
+++ b/gl/m4/inttypes.m4
@@ -148,6 +148,7 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX])
+ REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX])
INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX])
PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN])
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index d3fc1eff01..aae1701a0a 100644
--- a/gl/m4/lock.m4
+++ b/gl/m4/lock.m4
@@ -24,6 +24,9 @@ AC_DEFUN([gl_LOCK],
[[
#if __FreeBSD__ == 4
error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
+#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \
+ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
+error "No, in Mac OS X < 10.7 recursive mutexes actually don't work."
#else
int x = (int)PTHREAD_MUTEX_RECURSIVE;
return !x;
diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4
index 45a30afda7..80b2476d25 100644
--- a/gl/m4/manywarnings.m4
+++ b/gl/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 5
+# manywarnings.m4 serial 6
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -98,6 +98,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-W \
-Wabi \
-Waddress \
+ -Waggressive-loop-optimizations \
-Wall \
-Warray-bounds \
-Wattributes \
@@ -125,7 +126,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wformat-security \
-Wformat-y2k \
-Wformat-zero-length \
- -Wformat=2 \
-Wfree-nonheap-object \
-Wignored-qualifiers \
-Wimplicit \
@@ -143,9 +143,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wmissing-braces \
-Wmissing-declarations \
-Wmissing-field-initializers \
- -Wmissing-format-attribute \
-Wmissing-include-dirs \
- -Wmissing-noreturn \
-Wmissing-parameter-type \
-Wmissing-prototypes \
-Wmudflap \
@@ -166,6 +164,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
+ -Wreturn-local-addr \
-Wreturn-type \
-Wsequence-point \
-Wshadow \
@@ -187,7 +186,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wtype-limits \
-Wuninitialized \
-Wunknown-pragmas \
- -Wunreachable-code \
-Wunsafe-loop-optimizations \
-Wunused \
-Wunused-but-set-parameter \
@@ -206,6 +204,8 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
-Wvla \
-Wvolatile-register-var \
-Wwrite-strings \
+ -fdiagnostics-show-option \
+ -funit-at-a-time \
\
; do
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
diff --git a/gl/m4/po.m4 b/gl/m4/po.m4
index 5fde6f292e..1c70b6c1af 100644
--- a/gl/m4/po.m4
+++ b/gl/m4/po.m4
@@ -1,4 +1,4 @@
-# po.m4 serial 17c
+# po.m4 serial 21 (gettext-0.18.3)
dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ dnl Authors:
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-AC_PREREQ([2.50])
+AC_PREREQ([2.60])
dnl Checks for all prerequisites of the po subdirectory.
AC_DEFUN([AM_PO_SUBDIRS],
@@ -25,6 +25,7 @@ AC_DEFUN([AM_PO_SUBDIRS],
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+ AC_REQUIRE([AC_PROG_SED])dnl
AC_REQUIRE([AM_NLS])dnl
dnl Release version of the gettext macros. This is used to ensure that
@@ -102,7 +103,7 @@ changequote([,])dnl
case "$ac_file" in */Makefile.in)
# Adjust a relative srcdir.
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
# In autoconf-2.13 it is called $ac_given_srcdir.
# In autoconf-2.50 it is called $srcdir.
@@ -227,7 +228,7 @@ AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
changequote(,)dnl
# Adjust a relative srcdir.
ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
# In autoconf-2.13 it is called $ac_given_srcdir.
# In autoconf-2.50 it is called $srcdir.
diff --git a/gl/m4/putenv.m4 b/gl/m4/putenv.m4
index 03ed4f97db..c33b5b5170 100644
--- a/gl/m4/putenv.m4
+++ b/gl/m4/putenv.m4
@@ -1,4 +1,4 @@
-# putenv.m4 serial 19
+# putenv.m4 serial 20
dnl Copyright (C) 2002-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -52,5 +52,5 @@ AC_DEFUN([gl_FUNC_PUTENV],
# Prerequisites of lib/putenv.c.
AC_DEFUN([gl_PREREQ_PUTENV],
[
- AC_CHECK_FUNCS([_putenv])
+ AC_CHECK_DECLS([_putenv])
])
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index 3d7993dbec..20be01aaf2 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -31,10 +31,12 @@ AC_DEFUN([gl_STDALIGN_H],
/* Test _Alignas only on platforms where gnulib can help. */
#if \
- (__GNUC__ || __IBMC__ || __IBMCPP__ \
+ ((defined __cplusplus && 201103 <= __cplusplus) \
+ || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \
|| 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
- int alignas (8) alignas_int = 1;
- char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1];
+ struct alignas_test { char c; char alignas (8) alignas_8; };
+ char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
+ ? 1 : -1];
#endif
]])],
[gl_cv_header_working_stdalign_h=yes],
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index 6132727f87..d15c1b3709 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,10 +1,10 @@
-# sys_types_h.m4 serial 4
+# sys_types_h.m4 serial 5
dnl Copyright (C) 2011-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_SYS_TYPES_H],
+AC_DEFUN_ONCE([gl_SYS_TYPES_H],
[
AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
gl_NEXT_HEADERS([sys/types.h])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 32dcfa5820..4231578cf2 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 66
+# unistd_h.m4 serial 67
dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -160,6 +160,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
+ REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
diff --git a/gl/m4/warnings.m4 b/gl/m4/warnings.m4
index 4b2ac38501..e3d239b64f 100644
--- a/gl/m4/warnings.m4
+++ b/gl/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 7
+# warnings.m4 serial 11
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -25,19 +25,36 @@ m4_ifdef([AS_VAR_APPEND],
AC_DEFUN([gl_COMPILER_OPTION_IF],
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AS_LITERAL_IF([$1],
+ [m4_pushdef([gl_Positive], m4_bpatsubst([$1], [^-Wno-], [-W]))],
+ [gl_positive="$1"
+case $gl_positive in
+ -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
+esac
+m4_pushdef([gl_Positive], [$gl_positive])])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
gl_save_compiler_FLAGS="$gl_Flags"
- gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"])
- AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
- [AS_VAR_SET(gl_Warn, [yes])],
- [AS_VAR_SET(gl_Warn, [no])])
+ gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
+ [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
+ AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
+ [AS_VAR_SET(gl_Warn, [yes])],
+ [AS_VAR_SET(gl_Warn, [no])])
gl_Flags="$gl_save_compiler_FLAGS"
])
AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+m4_popdef([gl_Positive])dnl
AS_VAR_POPDEF([gl_Flags])dnl
AS_VAR_POPDEF([gl_Warn])dnl
])
+# gl_UNKNOWN_WARNINGS_ARE_ERRORS
+# ------------------------------
+# Clang doesn't complain about unknown warning options unless one also
+# specifies -Wunknown-warning-option -Werror. Detect this.
+AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS],
+[gl_COMPILER_OPTION_IF([-Werror -Wunknown-warning-option],
+ [gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'],
+ [gl_unknown_warnings_are_errors=])])
# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
# [PROGRAM = AC_LANG_PROGRAM()])
@@ -47,7 +64,8 @@ AS_VAR_POPDEF([gl_Warn])dnl
#
# If VARIABLE is a variable name, AC_SUBST it.
AC_DEFUN([gl_WARN_ADD],
-[gl_COMPILER_OPTION_IF([$1],
+[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
+gl_COMPILER_OPTION_IF([$1],
[gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
[],
[$3])
diff --git a/gl/math.in.h b/gl/math.in.h
index 7189819b04..6cc0f7dd45 100644
--- a/gl/math.in.h
+++ b/gl/math.in.h
@@ -28,6 +28,9 @@
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_MATH_INLINE
# define _GL_MATH_INLINE _GL_INLINE
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c
index 72a6b6ee89..396031e4c2 100644
--- a/gl/msvc-inval.c
+++ b/gl/msvc-inval.c
@@ -28,7 +28,7 @@
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
@@ -45,7 +45,7 @@ gl_msvc_invalid_parameter_handler (const wchar_t *expression,
# if defined _MSC_VER
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
@@ -94,7 +94,7 @@ gl_msvc_inval_current (void)
}
}
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
diff --git a/gl/signal.in.h b/gl/signal.in.h
index 54849504d7..a531487e35 100644
--- a/gl/signal.in.h
+++ b/gl/signal.in.h
@@ -195,6 +195,20 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
# endif
+/* When also using extern inline, suppress the use of static inline in
+ standard headers of problematic Apple configurations, as Libc at
+ least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ Perhaps Apple will fix this some day. */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+ && (defined __i386__ || defined __x86_64__))
+# undef sigaddset
+# undef sigdelset
+# undef sigemptyset
+# undef sigfillset
+# undef sigismember
+#endif
+
/* Test whether a given signal is contained in a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on Mac OS X. */
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h
index c3a67321b0..7254a3dec1 100644
--- a/gl/stdalign.in.h
+++ b/gl/stdalign.in.h
@@ -41,13 +41,28 @@
are 4 unless the option '-malign-double' is used.
The result cannot be used as a value for an 'enum' constant, if you
- want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
+ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
+
+ Include <stddef.h> for offsetof. */
#include <stddef.h>
-#if defined __cplusplus
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+ standard headers, defines conflicting implementations of _Alignas
+ and _Alignof that are no better than ours; override them. */
+#undef _Alignas
+#undef _Alignof
+
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# ifdef __cplusplus
+# if 201103 <= __cplusplus
+# define _Alignof(type) alignof (type)
+# else
template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-#else
-# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+# endif
+# else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# endif
#endif
#define alignof _Alignof
#define __alignof_is_defined 1
@@ -77,12 +92,16 @@
*/
-#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
-# define _Alignas(a) __attribute__ ((__aligned__ (a)))
-#elif 1300 <= _MSC_VER
-# define _Alignas(a) __declspec (align (a))
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# if defined __cplusplus && 201103 <= __cplusplus
+# define _Alignas(a) alignas (a)
+# elif __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC || 0x5110 <= __SUNPRO_C
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+# elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
+# endif
#endif
-#ifdef _Alignas
+#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)
# define alignas _Alignas
# define __alignas_is_defined 1
#endif
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index e00600a158..45291cf3ba 100644
--- a/gl/stdio-impl.h
+++ b/gl/stdio-impl.h
@@ -57,7 +57,7 @@
# define fp_ fp
# endif
-# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
+# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index d6af99ca77..76e62fba6b 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -124,6 +124,15 @@
#define _GL_STDIO_STRINGIZE(token) #token
#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
+/* When also using extern inline, suppress the use of static inline in
+ standard headers of problematic Apple configurations, as Libc at
+ least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ Perhaps Apple will fix this some day. */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+ && defined __GNUC__ && defined __STDC__)
+# undef putc_unlocked
+#endif
#if @GNULIB_DPRINTF@
# if @REPLACE_DPRINTF@
@@ -579,13 +588,23 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
which sometimes causes an unwanted diagnostic for fwrite calls.
This affects only function declaration attributes under certain
- versions of gcc, and is not needed for C++. */
+ versions of gcc and clang, and is not needed for C++. */
# if (0 < __USE_FORTIFY_LEVEL \
&& __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
&& 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
&& !defined __cplusplus)
# undef fwrite
-# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
+# undef fwrite_unlocked
+extern size_t __REDIRECT (rpl_fwrite,
+ (const void *__restrict, size_t, size_t,
+ FILE *__restrict),
+ fwrite);
+extern size_t __REDIRECT (rpl_fwrite_unlocked,
+ (const void *__restrict, size_t, size_t,
+ FILE *__restrict),
+ fwrite_unlocked);
+# define fwrite rpl_fwrite
+# define fwrite_unlocked rpl_fwrite_unlocked
# endif
# endif
_GL_CXXALIASWARN (fwrite);
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
index 3b8f24b995..0d086b873b 100644
--- a/gl/strerror-override.h
+++ b/gl/strerror-override.h
@@ -48,7 +48,7 @@
|| GNULIB_defined_EOWNERDEAD \
|| GNULIB_defined_ENOTRECOVERABLE \
|| GNULIB_defined_EILSEQ
-extern const char *strerror_override (int errnum);
+extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
# else
# define strerror_override(ignored) NULL
# endif
diff --git a/gl/sys_select.in.h b/gl/sys_select.in.h
index 521ccef321..2af6bfe6f6 100644
--- a/gl/sys_select.in.h
+++ b/gl/sys_select.in.h
@@ -21,23 +21,27 @@
/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
both include <sys/select.h>.
+ On Cygwin, <sys/time.h> includes <sys/select.h>.
Simply delegate to the system's header in this case. */
#if (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \
+ && ((defined __osf__ && defined _SYS_TYPES_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TYPES_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
#elif (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \
+ && (defined _CYGWIN_SYS_TIME_H \
+ || (defined __osf__ && defined _SYS_TIME_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TIME_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index b4cf0c3933..e6350f2a3e 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -63,6 +63,9 @@
#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#define _@GUARD_PREFIX@_SYS_SOCKET_H
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_SYS_SOCKET_INLINE
# define _GL_SYS_SOCKET_INLINE _GL_INLINE
diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h
index 656c3f13ad..f721580a76 100644
--- a/gl/sys_time.in.h
+++ b/gl/sys_time.in.h
@@ -24,6 +24,15 @@
#endif
@PRAGMA_COLUMNS@
+/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
+ recursively via <sys/select.h>.
+ Simply delegate to the system's header in this case; it is a no-op.
+ Without this extra ifdef, the C++ gettimeofday declaration below
+ would be a forward declaration in gnulib's nested <sys/time.h>. */
+#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -200,4 +209,5 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
#endif
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H */
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 8f65361a54..3cd5bb3c8a 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -22,7 +22,7 @@
#
# Generated by gnulib-tool.
-AUTOMAKE_OPTIONS = 1.5 foreign subdir-objects
+AUTOMAKE_OPTIONS = 1.9.6 foreign subdir-objects
SUBDIRS = .
TESTS =
@@ -432,6 +432,23 @@ EXTRA_DIST += test-getdelim.c signature.h macros.h
## end gnulib module getdelim-tests
+## begin gnulib module getdtablesize
+
+
+EXTRA_DIST += getdtablesize.c
+
+EXTRA_libtests_a_SOURCES += getdtablesize.c
+
+## end gnulib module getdtablesize
+
+## begin gnulib module getdtablesize-tests
+
+TESTS += test-getdtablesize
+check_PROGRAMS += test-getdtablesize
+EXTRA_DIST += test-getdtablesize.c signature.h macros.h
+
+## end gnulib module getdtablesize-tests
+
## begin gnulib module getline-tests
TESTS += test-getline
@@ -574,6 +591,7 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
-e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
-e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
+ -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \
-e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
-e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
-e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h
index 317fe3d3c2..423c2ae3ff 100644
--- a/gl/tests/binary-io.h
+++ b/gl/tests/binary-io.h
@@ -25,6 +25,9 @@
so we include it here first. */
#include <stdio.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef BINARY_IO_INLINE
# define BINARY_IO_INLINE _GL_INLINE
diff --git a/gl/tests/getcwd-lgpl.c b/gl/tests/getcwd-lgpl.c
index d550f35c4e..cebe8f7b3d 100644
--- a/gl/tests/getcwd-lgpl.c
+++ b/gl/tests/getcwd-lgpl.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#if GNULIB_GETCWD
diff --git a/gl/tests/getdtablesize.c b/gl/tests/getdtablesize.c
new file mode 100644
index 0000000000..355c17e3b9
--- /dev/null
+++ b/gl/tests/getdtablesize.c
@@ -0,0 +1,107 @@
+/* getdtablesize() function for platforms that don't have it.
+ Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2008.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+# include <stdio.h>
+
+# include "msvc-inval.h"
+
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+_setmaxstdio_nothrow (int newmax)
+{
+ int result;
+
+ TRY_MSVC_INVAL
+ {
+ result = _setmaxstdio (newmax);
+ }
+ CATCH_MSVC_INVAL
+ {
+ result = -1;
+ }
+ DONE_MSVC_INVAL;
+
+ return result;
+}
+# define _setmaxstdio _setmaxstdio_nothrow
+# endif
+
+/* Cache for the previous getdtablesize () result. Safe to cache because
+ Windows also lacks setrlimit. */
+static int dtablesize;
+
+int
+getdtablesize (void)
+{
+ if (dtablesize == 0)
+ {
+ /* We are looking for the number N such that the valid file descriptors
+ are 0..N-1. It can be obtained through a loop as follows:
+ {
+ int fd;
+ for (fd = 3; fd < 65536; fd++)
+ if (dup2 (0, fd) == -1)
+ break;
+ return fd;
+ }
+ On Windows XP, the result is 2048.
+ The drawback of this loop is that it allocates memory for a libc
+ internal array that is never freed.
+
+ The number N can also be obtained as the upper bound for
+ _getmaxstdio (). _getmaxstdio () returns the maximum number of open
+ FILE objects. The sanity check in _setmaxstdio reveals the maximum
+ number of file descriptors. This too allocates memory, but it is
+ freed when we call _setmaxstdio with the original value. */
+ int orig_max_stdio = _getmaxstdio ();
+ unsigned int bound;
+ for (bound = 0x10000; _setmaxstdio (bound) < 0; bound = bound / 2)
+ ;
+ _setmaxstdio (orig_max_stdio);
+ dtablesize = bound;
+ }
+ return dtablesize;
+}
+
+#elif HAVE_GETDTABLESIZE
+
+# include <sys/resource.h>
+# undef getdtablesize
+
+int
+rpl_getdtablesize(void)
+{
+ /* To date, this replacement is only compiled for Cygwin 1.7.25,
+ which auto-increased the RLIMIT_NOFILE soft limit until it
+ hits the compile-time constant hard limit of 3200. Although
+ that version of cygwin supported a child process inheriting
+ a smaller soft limit, the smaller limit is not enforced, so
+ we might as well just report the hard limit. */
+ struct rlimit lim;
+ if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
+ return lim.rlim_max;
+ return getdtablesize ();
+}
+
+#endif
diff --git a/gl/tests/ignore-value.h b/gl/tests/ignore-value.h
index 63ecde8513..ebd6bf42f5 100644
--- a/gl/tests/ignore-value.h
+++ b/gl/tests/ignore-value.h
@@ -33,15 +33,16 @@
declared with attribute warn_unused_result". */
#ifndef _GL_IGNORE_VALUE_H
-# define _GL_IGNORE_VALUE_H
+#define _GL_IGNORE_VALUE_H
/* The __attribute__((__warn_unused_result__)) feature
is available in gcc versions 3.4 and newer,
while the typeof feature has been available since 2.7 at least. */
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-# define ignore_value(x) ((void) (x))
-# else
-# define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
-# endif
+#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+# define ignore_value(x) \
+ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
#endif
diff --git a/gl/tests/inttypes.in.h b/gl/tests/inttypes.in.h
index 1893f5569d..05a22fff79 100644
--- a/gl/tests/inttypes.in.h
+++ b/gl/tests/inttypes.in.h
@@ -1105,12 +1105,22 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
#endif
#if @GNULIB_STRTOUMAX@
-# if !@HAVE_DECL_STRTOUMAX@
-# undef strtoumax
+# if @REPLACE_STRTOUMAX@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strtoumax
+# define strtoumax rpl_strtoumax
+# endif
+_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
+ (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int));
+# else
+# if !@HAVE_DECL_STRTOUMAX@
+# undef strtoumax
_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
(const char *, char **, int) _GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+# endif
_GL_CXXALIASWARN (strtoumax);
#elif defined GNULIB_POSIXCHECK
# undef strtoumax
diff --git a/gl/tests/macros.h b/gl/tests/macros.h
index 60ba894d89..1ceb815116 100644
--- a/gl/tests/macros.h
+++ b/gl/tests/macros.h
@@ -48,8 +48,8 @@
{ \
if (!(expr)) \
{ \
- fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", \
- __FILE__, __LINE__); \
+ fprintf (ASSERT_STREAM, "%s:%d: assertion '%s' failed\n", \
+ __FILE__, __LINE__, #expr); \
fflush (ASSERT_STREAM); \
abort (); \
} \
diff --git a/gl/tests/malloca.c b/gl/tests/malloca.c
index 3cd2f6d99e..311be569bc 100644
--- a/gl/tests/malloca.c
+++ b/gl/tests/malloca.c
@@ -49,12 +49,18 @@
#define MAGIC_SIZE sizeof (int)
/* This is how the header info would look like without any alignment
considerations. */
-struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
+struct preliminary_header { void *next; int magic; };
/* But the header's size must be a multiple of sa_alignment_max. */
#define HEADER_SIZE \
(((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
-verify (HEADER_SIZE == sizeof (struct header));
+union header {
+ void *next;
+ struct {
+ char room[HEADER_SIZE - MAGIC_SIZE];
+ int word;
+ } magic;
+};
+verify (HEADER_SIZE == sizeof (union header));
/* We make the hash table quite big, so that during lookups the probability
of empty hash buckets is quite high. There is no need to make the hash
table resizable, because when the hash table gets filled so much that the
@@ -74,20 +80,21 @@ mmalloca (size_t n)
if (nplus >= n)
{
- char *p = (char *) malloc (nplus);
+ void *p = malloc (nplus);
if (p != NULL)
{
size_t slot;
+ union header *h = p;
- p += HEADER_SIZE;
+ p = h + 1;
/* Put a magic number into the indicator word. */
- ((int *) p)[-1] = MAGIC_NUMBER;
+ h->magic.word = MAGIC_NUMBER;
/* Enter p into the hash table. */
slot = (uintptr_t) p % HASH_TABLE_SIZE;
- ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
+ h->next = mmalloca_results[slot];
mmalloca_results[slot] = p;
return p;
@@ -123,15 +130,17 @@ freea (void *p)
void **chain = &mmalloca_results[slot];
for (; *chain != NULL;)
{
+ union header *h = p;
if (*chain == p)
{
/* Found it. Remove it from the hash table and free it. */
- char *p_begin = (char *) p - HEADER_SIZE;
- *chain = ((struct header *) p_begin)->next;
+ union header *p_begin = h - 1;
+ *chain = p_begin->next;
free (p_begin);
return;
}
- chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next;
+ h = *chain;
+ chain = &h[-1].next;
}
}
/* At this point, we know it was not a mmalloca() result. */
diff --git a/gl/tests/malloca.h b/gl/tests/malloca.h
index 906d47a207..6fbe45eab6 100644
--- a/gl/tests/malloca.h
+++ b/gl/tests/malloca.h
@@ -92,7 +92,7 @@ extern void * nmalloca (size_t n, size_t s);
/* ------------------- Auxiliary, non-public definitions ------------------- */
/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__
+#if defined __GNUC__ || defined __IBM__ALIGNOF__
# define sa_alignof __alignof__
#elif defined __cplusplus
template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
diff --git a/gl/tests/putenv.c b/gl/tests/putenv.c
index ed666afc3b..5461273084 100644
--- a/gl/tests/putenv.c
+++ b/gl/tests/putenv.c
@@ -62,7 +62,9 @@ static int
_unsetenv (const char *name)
{
size_t len;
+#if !HAVE_DECL__PUTENV
char **ep;
+#endif
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
{
@@ -72,7 +74,7 @@ _unsetenv (const char *name)
len = strlen (name);
-#if HAVE__PUTENV
+#if HAVE_DECL__PUTENV
{
int putenv_result, putenv_errno;
char *name_ = malloc (len + 2);
@@ -125,46 +127,46 @@ putenv (char *string)
return _unsetenv (string);
}
-#if HAVE__PUTENV
- /* Rely on _putenv to allocate the new environment. If other
- parts of the application use _putenv, the !HAVE__PUTENV code
- would fight over who owns the environ vector, causing a crash. */
- if (name_end[1])
- return _putenv (string);
- else
- {
- /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
- to allocate the environ vector and then replace the new
- entry with "NAME=". */
- int putenv_result, putenv_errno;
- char *name_x = malloc (name_end - string + sizeof "= ");
- if (!name_x)
- return -1;
- memcpy (name_x, string, name_end - string + 1);
- name_x[name_end - string + 1] = ' ';
- name_x[name_end - string + 2] = 0;
- putenv_result = _putenv (name_x);
- putenv_errno = errno;
- for (ep = environ; *ep; ep++)
- if (strcmp (*ep, name_x) == 0)
- {
- *ep = string;
- break;
- }
+#if HAVE_DECL__PUTENV
+ /* Rely on _putenv to allocate the new environment. If other
+ parts of the application use _putenv, the !HAVE_DECL__PUTENV code
+ would fight over who owns the environ vector, causing a crash. */
+ if (name_end[1])
+ return _putenv (string);
+ else
+ {
+ /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
+ to allocate the environ vector and then replace the new
+ entry with "NAME=". */
+ int putenv_result, putenv_errno;
+ char *name_x = malloc (name_end - string + sizeof "= ");
+ if (!name_x)
+ return -1;
+ memcpy (name_x, string, name_end - string + 1);
+ name_x[name_end - string + 1] = ' ';
+ name_x[name_end - string + 2] = 0;
+ putenv_result = _putenv (name_x);
+ putenv_errno = errno;
+ for (ep = environ; *ep; ep++)
+ if (strcmp (*ep, name_x) == 0)
+ {
+ *ep = string;
+ break;
+ }
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- if (putenv_result == 0)
- {
- /* _putenv propagated "NAME= " into the subprocess environment;
- fix that by calling SetEnvironmentVariable directly. */
- name_x[name_end - string] = 0;
- putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
- putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
- }
-# endif
- free (name_x);
- __set_errno (putenv_errno);
- return putenv_result;
+ if (putenv_result == 0)
+ {
+ /* _putenv propagated "NAME= " into the subprocess environment;
+ fix that by calling SetEnvironmentVariable directly. */
+ name_x[name_end - string] = 0;
+ putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
+ putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
}
+# endif
+ free (name_x);
+ __set_errno (putenv_errno);
+ return putenv_result;
+ }
#else
for (ep = environ; *ep; ep++)
if (strncmp (*ep, string, name_end - string) == 0
@@ -186,7 +188,7 @@ putenv (char *string)
last_environ = new_environ;
environ = new_environ;
}
-#endif
return 0;
+#endif
}
diff --git a/gl/tests/test-dup2.c b/gl/tests/test-dup2.c
index 9600c850b1..44039f102b 100644
--- a/gl/tests/test-dup2.c
+++ b/gl/tests/test-dup2.c
@@ -26,6 +26,10 @@ SIGNATURE_CHECK (dup2, int, (int, int));
#include <errno.h>
#include <fcntl.h>
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
#include "binary-io.h"
#if GNULIB_TEST_CLOEXEC
@@ -103,6 +107,7 @@ main (void)
{
const char *file = "test-dup2.tmp";
char buffer[1];
+ int bad_fd = getdtablesize ();
int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600);
/* Assume std descriptors were provided by invoker. */
@@ -145,8 +150,17 @@ main (void)
errno = 0;
ASSERT (dup2 (fd, -2) == -1);
ASSERT (errno == EBADF);
+ if (bad_fd > 256)
+ {
+ ASSERT (dup2 (fd, 255) == 255);
+ ASSERT (dup2 (fd, 256) == 256);
+ ASSERT (close (255) == 0);
+ ASSERT (close (256) == 0);
+ }
+ ASSERT (dup2 (fd, bad_fd - 1) == bad_fd - 1);
+ ASSERT (close (bad_fd - 1) == 0);
errno = 0;
- ASSERT (dup2 (fd, 10000000) == -1);
+ ASSERT (dup2 (fd, bad_fd) == -1);
ASSERT (errno == EBADF);
/* Using dup2 can skip fds. */
diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c
index 1b9892f410..5c27d3bef8 100644
--- a/gl/tests/test-getaddrinfo.c
+++ b/gl/tests/test-getaddrinfo.c
@@ -114,6 +114,8 @@ simple (char const *host, char const *service)
for (ai = ai0; ai; ai = ai->ai_next)
{
+ void *ai_addr = ai->ai_addr;
+ struct sockaddr_in *sock_addr = ai_addr;
dbgprintf ("\tflags %x\n", ai->ai_flags);
dbgprintf ("\tfamily %x\n", ai->ai_family);
dbgprintf ("\tsocktype %x\n", ai->ai_socktype);
@@ -121,8 +123,7 @@ simple (char const *host, char const *service)
dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
dbgprintf ("\tFound %s\n",
inet_ntop (ai->ai_family,
- &((struct sockaddr_in *)
- ai->ai_addr)->sin_addr,
+ &sock_addr->sin_addr,
buf, sizeof (buf) - 1));
if (ai->ai_canonname)
dbgprintf ("\tFound %s...\n", ai->ai_canonname);
diff --git a/gl/tests/test-getdtablesize.c b/gl/tests/test-getdtablesize.c
new file mode 100644
index 0000000000..b371ccf0d4
--- /dev/null
+++ b/gl/tests/test-getdtablesize.c
@@ -0,0 +1,36 @@
+/* Test of getdtablesize() function.
+ Copyright (C) 2008-2013 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>, 2008. */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getdtablesize, int, (void));
+
+#include "macros.h"
+
+int
+main (int argc, char *argv[])
+{
+ ASSERT (getdtablesize () >= 3);
+ ASSERT (dup2 (0, getdtablesize() - 1) == getdtablesize () - 1);
+ ASSERT (dup2 (0, getdtablesize()) == -1);
+
+ return 0;
+}
diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c
index 805735769e..108346e129 100644
--- a/gl/tests/test-snprintf.c
+++ b/gl/tests/test-snprintf.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
#if !CHECK_SNPRINTF_POSIX
if (size > 0)
#endif
- ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+ ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
}
else
{
diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-sys_select.c
index cd84c0103b..1604699879 100644
--- a/gl/tests/test-sys_select.c
+++ b/gl/tests/test-sys_select.c
@@ -40,8 +40,9 @@ SIGNATURE_CHECK (FD_ZERO, void, (fd_set *));
/* Check that the 'struct timeval' type is defined. */
struct timeval a;
-/* Check that &a.tv_sec is a 'time_t *', ignoring signedness issues. */
-typedef int verify_tv_sec_type[sizeof (a.tv_sec) == sizeof (time_t) ? 1 : -1];
+/* Check that a.tv_sec is wide enough to hold a time_t, ignoring
+ signedness issues. */
+typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
/* Check that sigset_t is defined. */
sigset_t t2;
diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c
index 0ac8a33264..9084b18b6d 100644
--- a/gl/tests/test-sys_socket.c
+++ b/gl/tests/test-sys_socket.c
@@ -47,7 +47,7 @@ main (void)
sa_family_t i;
/* Check some errno values. */
- switch (0)
+ switch (ENOTSOCK)
{
case ENOTSOCK:
case EADDRINUSE:
diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c
index 1389b52008..80628423e1 100644
--- a/gl/tests/test-sys_time.c
+++ b/gl/tests/test-sys_time.c
@@ -23,8 +23,9 @@
/* Check that the 'struct timeval' type is defined. */
struct timeval a;
-/* Check that &a.tv_sec is a 'time_t *', ignoring signedness issues. */
-typedef int verify_tv_sec_type[sizeof (a.tv_sec) == sizeof (time_t) ? 1 : -1];
+/* Check that a.tv_sec is wide enough to hold a time_t, ignoring
+ signedness issues. */
+typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1];
int
main (void)
diff --git a/gl/tests/test-vasnprintf.c b/gl/tests/test-vasnprintf.c
index f29b05aeb5..4cce0a947a 100644
--- a/gl/tests/test-vasnprintf.c
+++ b/gl/tests/test-vasnprintf.c
@@ -55,7 +55,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
ASSERT (length == 5);
if (size < 6)
ASSERT (result != buf);
- ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+ ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
if (result != buf)
free (result);
}
diff --git a/gl/tests/test-vsnprintf.c b/gl/tests/test-vsnprintf.c
index 3353b2eb47..84b5d89676 100644
--- a/gl/tests/test-vsnprintf.c
+++ b/gl/tests/test-vsnprintf.c
@@ -65,7 +65,7 @@ main (int argc, char *argv[])
#if !CHECK_VSNPRINTF_POSIX
if (size > 0)
#endif
- ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+ ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
}
else
{
diff --git a/gl/timespec.h b/gl/timespec.h
index d665e6ccf9..d0c029b570 100644
--- a/gl/timespec.h
+++ b/gl/timespec.h
@@ -21,11 +21,31 @@
# include <time.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_TIMESPEC_INLINE
# define _GL_TIMESPEC_INLINE _GL_INLINE
#endif
+/* Resolution of timespec time stamps (in units per second), and log
+ base 10 of the resolution. */
+
+enum { TIMESPEC_RESOLUTION = 1000000000 };
+enum { LOG10_TIMESPEC_RESOLUTION = 9 };
+
+/* Return a timespec with seconds S and nanoseconds NS. */
+
+_GL_TIMESPEC_INLINE struct timespec
+make_timespec (time_t s, long int ns)
+{
+ struct timespec r;
+ r.tv_sec = s;
+ r.tv_nsec = ns;
+ return r;
+}
+
/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
For each time stamp T, this code assumes that either:
diff --git a/gl/u64.h b/gl/u64.h
index d8009ad391..af8441f52e 100644
--- a/gl/u64.h
+++ b/gl/u64.h
@@ -19,6 +19,9 @@
#include <stdint.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_U64_INLINE
# define _GL_U64_INLINE _GL_INLINE
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 675c7e6a55..0e510d679c 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -61,8 +61,10 @@
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
<unistd.h>. */
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
+/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
+ included here. */
/* But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
+#if !defined __GLIBC__ && !defined __osf__
# define __need_system_stdlib_h
# include <stdlib.h>
# undef __need_system_stdlib_h
@@ -114,6 +116,9 @@
# include <getopt.h>
#endif
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_UNISTD_INLINE
# define _GL_UNISTD_INLINE _GL_INLINE
@@ -649,10 +654,19 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
#if @GNULIB_GETDTABLESIZE@
/* Return the maximum number of file descriptors in the current process.
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
-# if !@HAVE_GETDTABLESIZE@
+# if @REPLACE_GETDTABLESIZE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getdtablesize
+# define getdtablesize rpl_getdtablesize
+# endif
+_GL_FUNCDECL_RPL (getdtablesize, int, (void));
+_GL_CXXALIAS_RPL (getdtablesize, int, (void));
+# else
+# if !@HAVE_GETDTABLESIZE@
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
-# endif
+# endif
_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+# endif
_GL_CXXALIASWARN (getdtablesize);
#elif defined GNULIB_POSIXCHECK
# undef getdtablesize
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index 8fdab32ea5..5267b1bb5e 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -5153,7 +5153,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t tmp_length =
MAX_ROOM_NEEDED (&a, dp->arg_index,
dp->conversion, type, flags,
- width, has_precision,
+ has_width ? width : 0,
+ has_precision,
precision, pad_ourselves);
if (maxlen < tmp_length)
diff --git a/gl/verify.h b/gl/verify.h
index cb8e90b542..bf40b028c9 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -18,7 +18,7 @@
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#ifndef _GL_VERIFY_H
-# define _GL_VERIFY_H
+#define _GL_VERIFY_H
/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
@@ -31,14 +31,24 @@
Use this only with GCC. If we were willing to slow 'configure'
down we could also use it with other compilers, but since this
affects only the quality of diagnostics, why bother? */
-# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
-# define _GL_HAVE__STATIC_ASSERT 1
-# endif
+#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
+ && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \
+ && !defined __cplusplus)
+# define _GL_HAVE__STATIC_ASSERT 1
+#endif
/* The condition (99 < __GNUC__) is temporary, until we know about the
first G++ release that supports static_assert. */
-# if (99 < __GNUC__) && defined __cplusplus
-# define _GL_HAVE_STATIC_ASSERT 1
-# endif
+#if (99 < __GNUC__) && defined __cplusplus
+# define _GL_HAVE_STATIC_ASSERT 1
+#endif
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+ system headers, defines a conflicting _Static_assert that is no
+ better than ours; override it. */
+#ifndef _GL_HAVE_STATIC_ASSERT
+# include <stddef.h>
+# undef _Static_assert
+#endif
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
@@ -141,50 +151,50 @@
Use a template type to work around the problem. */
/* Concatenate two preprocessor tokens. */
-# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
-# define _GL_CONCAT0(x, y) x##y
+#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+#define _GL_CONCAT0(x, y) x##y
/* _GL_COUNTER is an integer, preferably one that changes each time we
use it. Use __COUNTER__ if it works, falling back on __LINE__
otherwise. __LINE__ isn't perfect, but it's better than a
constant. */
-# if defined __COUNTER__ && __COUNTER__ != __COUNTER__
-# define _GL_COUNTER __COUNTER__
-# else
-# define _GL_COUNTER __LINE__
-# endif
+#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+# define _GL_COUNTER __COUNTER__
+#else
+# define _GL_COUNTER __LINE__
+#endif
/* Generate a symbol with the given prefix, making it unique if
possible. */
-# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
+#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression
that returns 1. If R is false, fail at compile-time, preferably
with a diagnostic that includes the string-literal DIAGNOSTIC. */
-# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
- (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
+#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
+ (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
-# ifdef __cplusplus
-# if !GNULIB_defined_struct__gl_verify_type
+#ifdef __cplusplus
+# if !GNULIB_defined_struct__gl_verify_type
template <int w>
struct _gl_verify_type {
unsigned int _gl_verify_error_if_negative: w;
};
-# define GNULIB_defined_struct__gl_verify_type 1
-# endif
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- _gl_verify_type<(R) ? 1 : -1>
-# elif defined _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { \
- _Static_assert (R, DIAGNOSTIC); \
- int _gl_dummy; \
- }
-# else
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+# define GNULIB_defined_struct__gl_verify_type 1
# endif
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ _gl_verify_type<(R) ? 1 : -1>
+#elif defined _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { \
+ _Static_assert (R, DIAGNOSTIC); \
+ int _gl_dummy; \
+ }
+#else
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+#endif
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. If R is false, fail at compile-time, preferably
@@ -193,23 +203,23 @@ template <int w>
Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */
-# ifdef _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY _Static_assert
-# else
-# define _GL_VERIFY(R, DIAGNOSTIC) \
- extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
- [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
-# endif
+#ifdef _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY _Static_assert
+#else
+# define _GL_VERIFY(R, DIAGNOSTIC) \
+ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
+ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
+#endif
/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
-# ifdef _GL_STATIC_ASSERT_H
-# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
-# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
-# endif
-# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
-# define static_assert _Static_assert /* C11 requires this #define. */
-# endif
+#ifdef _GL_STATIC_ASSERT_H
+# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
+# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
# endif
+# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
+# define static_assert _Static_assert /* C11 requires this #define. */
+# endif
+#endif
/* @assert.h omit start@ */
@@ -227,18 +237,42 @@ template <int w>
verify_true is obsolescent; please use verify_expr instead. */
-# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
/* Verify requirement R at compile-time. Return the value of the
expression E. */
-# define verify_expr(R, E) \
- (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
+#define verify_expr(R, E) \
+ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+/* Assume that R always holds. This lets the compiler optimize
+ accordingly. R should not have side-effects; it may or may not be
+ evaluated. Behavior is undefined if R is false. */
+
+#if (__has_builtin (__builtin_unreachable) \
+ || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))
+# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
+#elif 1200 <= _MSC_VER
+# define assume(R) __assume (R)
+#elif (defined lint \
+ && (__has_builtin (__builtin_trap) \
+ || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
+ /* Doing it this way helps various packages when configured with
+ --enable-gcc-warnings, which compiles with -Dlint. It's nicer
+ when 'assume' silences warnings even with older GCCs. */
+# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
+#else
+# define assume(R) ((void) (0 && (R)))
+#endif
/* @assert.h omit end@ */
diff --git a/gl/xsize.h b/gl/xsize.h
index 2922f35305..5675593f54 100644
--- a/gl/xsize.h
+++ b/gl/xsize.h
@@ -27,6 +27,9 @@
# include <stdint.h>
#endif
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef XSIZE_INLINE
# define XSIZE_INLINE _GL_INLINE
diff --git a/maint.mk b/maint.mk
index 2b454a15cc..8cb58f8415 100644
--- a/maint.mk
+++ b/maint.mk
@@ -809,7 +809,7 @@ sc_prohibit_always_true_header_tests:
$(_sc_search_regexp)
sc_prohibit_defined_have_decl_tests:
- @prohibit='#[ ]*if(n?def|.*\<defined)\>[ (]+HAVE_DECL_' \
+ @prohibit='(#[ ]*ifn?def|\<defined)\>[ (]+HAVE_DECL_' \
halt='HAVE_DECL macros are always defined' \
$(_sc_search_regexp)
@@ -1283,7 +1283,8 @@ vc-diff-check:
rel-files = $(DIST_ARCHIVES)
gnulib_dir ?= $(srcdir)/gnulib
-gnulib-version = $$(cd $(gnulib_dir) && git describe)
+gnulib-version = $$(cd $(gnulib_dir) \
+ && { git describe || git rev-parse --short=10 HEAD; } )
bootstrap-tools ?= autoconf,automake,gnulib
# If it's not already specified, derive the GPG key ID from
@@ -1424,6 +1425,7 @@ alpha beta stable: $(local-check) writable-files $(submodule-checks)
$(AM_V_at)$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
release:
+ $(AM_V_GEN)$(MAKE) _version
$(AM_V_GEN)$(MAKE) $(release-type)
# Override this in cfg.mk if you follow different procedures.