diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-07-29 22:09:25 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2014-07-29 22:09:25 +0200 |
commit | d294543ea086a8075363274a6e73780f28474a0c (patch) | |
tree | f0e8cff885cf2054cdd18e3cd1620591d311efea | |
parent | 2458eaf14065b0ed5e74a2d5e802b3e3950034b2 (diff) | |
download | gnutls-d294543ea086a8075363274a6e73780f28474a0c.tar.gz |
updated gnulib
-rwxr-xr-x | build-aux/config.rpath | 16 | ||||
-rwxr-xr-x | build-aux/gendocs.sh | 87 | ||||
-rw-r--r-- | doc/gendocs_template | 18 | ||||
-rw-r--r-- | gl/m4/gnulib-common.m4 | 12 | ||||
-rw-r--r-- | gl/m4/intl.m4 | 2 | ||||
-rw-r--r-- | gl/m4/po.m4 | 2 | ||||
-rw-r--r-- | gl/m4/printf.m4 | 18 | ||||
-rw-r--r-- | gl/m4/valgrind-tests.m4 | 4 | ||||
-rw-r--r-- | gl/tests/fcntl.in.h | 16 | ||||
-rw-r--r-- | maint.mk | 17 | ||||
-rw-r--r-- | src/gl/error.c | 17 | ||||
-rw-r--r-- | src/gl/m4/dup2.m4 | 12 | ||||
-rw-r--r-- | src/gl/m4/gnulib-common.m4 | 12 | ||||
-rw-r--r-- | src/gl/m4/printf.m4 | 18 | ||||
-rw-r--r-- | src/gl/mktime.c | 4 | ||||
-rw-r--r-- | src/gl/select.c | 36 | ||||
-rw-r--r-- | src/gl/xalloc.h | 15 |
17 files changed, 200 insertions, 106 deletions
diff --git a/build-aux/config.rpath b/build-aux/config.rpath index ab6fd995f3..b625621fac 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -367,11 +367,7 @@ else dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; - freebsd2.2*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - freebsd2*) + freebsd2.[01]*) hardcode_direct=yes hardcode_minus_L=yes ;; @@ -548,13 +544,11 @@ case "$host_os" in dgux*) library_names_spec='$libname$shrext' ;; + freebsd[23].*) + library_names_spec='$libname$shrext$versuffix' + ;; freebsd* | dragonfly*) - case "$host_os" in - freebsd[123]*) - library_names_spec='$libname$shrext$versuffix' ;; - *) - library_names_spec='$libname$shrext' ;; - esac + library_names_spec='$libname$shrext' ;; gnu*) library_names_spec='$libname$shrext' diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh index f9ec9df76b..b2e7b09730 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-10-10.09 +scriptversion=2014-05-01.10 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 # Free Software Foundation, Inc. @@ -78,6 +78,9 @@ Options: --html ARG pass ARG to makeinfo or texi2html for HTML targets. --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. + --no-info skip generating the info output. + --no-tex skip generating the dvi and pdf output. --source ARG include ARG in tar archive of sources. --split HOW make split HTML by node, section, chapter; default node. @@ -139,10 +142,13 @@ 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's directories. +dirs= # -I directories. htmlarg= infoarg=--no-split generate_ascii=true +generate_html=true +generate_info=true +generate_tex=true outdir=manual source_extra= split=node @@ -159,6 +165,9 @@ while test $# -gt 0; do --html) shift; htmlarg=$1;; --info) shift; infoarg=$1;; --no-ascii) generate_ascii=false;; + --no-html) generate_ascii=false;; + --no-info) generate_info=false;; + --no-tex) generate_tex=false;; --source) shift; source_extra=$1;; --split) shift; split=$1;; --texi2html) use_texi2html=1;; @@ -221,8 +230,9 @@ calcsize() # copy_images OUTDIR HTML-FILE... # ------------------------------- -# Copy all the images needed by the HTML-FILEs into OUTDIR. Look -# for them in the -I directories. +# Copy all the images needed by the HTML-FILEs into OUTDIR. +# Look for them in . and the -I directories; this is simpler than what +# makeinfo supports with -I, but hopefully it will suffice. copy_images() { local odir @@ -232,7 +242,7 @@ copy_images() BEGIN { \$me = '$prog'; \$odir = '$odir'; - @dirs = qw($dirs); + @dirs = qw(. $dirs); } " -e ' /<img src="(.*?)"/g && ++$need{$1}; @@ -270,32 +280,39 @@ echo "Making output for $srcfile" echo " in `pwd`" mkdir -p "$outdir/" -cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\"" -echo "Generating info... ($cmd)" -rm -f $PACKAGE.info* # get rid of any strays -eval "$cmd" -tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info* -ls -l "$outdir/$PACKAGE.info.tar.gz" -info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"` -# do not mv the info files, there's no point in having them available -# separately on the web. - -cmd="$SETLANG $TEXI2DVI $dirargs \"$srcfile\"" -printf "\nGenerating dvi... ($cmd)\n" -eval "$cmd" -# compress/finish dvi: -gzip -f -9 $PACKAGE.dvi -dvi_gz_size=`calcsize $PACKAGE.dvi.gz` -mv $PACKAGE.dvi.gz "$outdir/" -ls -l "$outdir/$PACKAGE.dvi.gz" - -cmd="$SETLANG $TEXI2DVI --pdf $dirargs \"$srcfile\"" -printf "\nGenerating pdf... ($cmd)\n" -eval "$cmd" -pdf_size=`calcsize $PACKAGE.pdf` -mv $PACKAGE.pdf "$outdir/" -ls -l "$outdir/$PACKAGE.pdf" +# +if $generate_info; then + cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\"" + echo "Generating info... ($cmd)" + rm -f $PACKAGE.info* # get rid of any strays + eval "$cmd" + tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info* + ls -l "$outdir/$PACKAGE.info.tar.gz" + info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"` + # do not mv the info files, there's no point in having them available + # separately on the web. +fi # end info + +# +if $generate_tex; then + cmd="$SETLANG $TEXI2DVI $dirargs \"$srcfile\"" + printf "\nGenerating dvi... ($cmd)\n" + eval "$cmd" + # compress/finish dvi: + gzip -f -9 $PACKAGE.dvi + dvi_gz_size=`calcsize $PACKAGE.dvi.gz` + mv $PACKAGE.dvi.gz "$outdir/" + ls -l "$outdir/$PACKAGE.dvi.gz" + + cmd="$SETLANG $TEXI2DVI --pdf $dirargs \"$srcfile\"" + printf "\nGenerating pdf... ($cmd)\n" + eval "$cmd" + pdf_size=`calcsize $PACKAGE.pdf` + mv $PACKAGE.pdf "$outdir/" + ls -l "$outdir/$PACKAGE.pdf" +fi # end tex (dvi + pdf) +# if $generate_ascii; then opt="-o $PACKAGE.txt --no-split --no-headers $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" @@ -308,6 +325,9 @@ if $generate_ascii; then ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz" fi +# + +if $generate_html; then # Split HTML at level $1. Used for texi2html. html_split() { @@ -382,7 +402,9 @@ else # use texi2html: html_split chapter html_split section fi +fi # end html +# printf "\nMaking .tar.gz for sources...\n" d=`dirname $srcfile` ( @@ -393,6 +415,8 @@ d=`dirname $srcfile` ) texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"` +# +# Do everything again through docbook. if test -n "$docbook"; then opt="-o - --docbook $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml" @@ -431,7 +455,8 @@ if test -n "$docbook"; then mv $PACKAGE-db.pdf "$outdir/" fi -printf "\nMaking index file...\n" +# +printf "\nMaking index.html for $PACKAGE...\n" if test -z "$use_texi2html"; then CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" diff --git a/doc/gendocs_template b/doc/gendocs_template index ba271ba2ba..2aba71a0b7 100644 --- a/doc/gendocs_template +++ b/doc/gendocs_template @@ -1,5 +1,6 @@ <!--#include virtual="/server/header.html" --> -<title>%%TITLE%% - GNU Project - Free Software Foundation (FSF)</title> +<!-- Parent-Version: 1.77 --> +<title>%%TITLE%% - GNU Project - Free Software Foundation</title> <!--#include virtual="/server/banner.html" --> <h2>%%TITLE%%</h2> @@ -74,19 +75,22 @@ script</a>.)</p> </div><!-- for id="content", starts in the include above --> <!--#include virtual="/server/footer.html" --> <div id="footer"> +<div class="unprintable"> <p>Please send general FSF & GNU inquiries to <a href="mailto:gnu@gnu.org"><gnu@gnu.org></a>. There are also <a href="/contact/">other ways to contact</a> -the FSF.<br /> -Please send broken links and other corrections or suggestions to -<a href="mailto:%%EMAIL%%"><%%EMAIL%%></a>.</p> +the FSF. Broken links and other corrections or suggestions can be sent +to <a href="mailto:%%EMAIL%%"><%%EMAIL%%></a>.</p> +</div> <p>Copyright © 2014 Free Software Foundation, Inc.</p> -<p>Verbatim copying and distribution of this entire article are -permitted worldwide, without royalty, in any medium, provided this -notice, and the copyright notice, are preserved.</p> +<p>This page is licensed under a <a rel="license" +href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative +Commons Attribution-NoDerivs 3.0 United States License</a>.</p> + +<!--#include virtual="/server/bottom-notes.html" --> </div> </div> diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index 20ce40e744..35f6195204 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 34 +# gnulib-common.m4 serial 35 dnl Copyright (C) 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, @@ -49,6 +49,16 @@ AC_DEFUN([gl_COMMON_BODY], [ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) diff --git a/gl/m4/intl.m4 b/gl/m4/intl.m4 index 1d782d1606..0c394ecad1 100644 --- a/gl/m4/intl.m4 +++ b/gl/m4/intl.m4 @@ -1,4 +1,4 @@ -# intl.m4 serial 24 (gettext-0.18.3) +# intl.m4 serial 27 (gettext-0.18.3) dnl Copyright (C) 1995-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, diff --git a/gl/m4/po.m4 b/gl/m4/po.m4 index bd210c5369..c737878461 100644 --- a/gl/m4/po.m4 +++ b/gl/m4/po.m4 @@ -1,4 +1,4 @@ -# po.m4 serial 21 (gettext-0.18.3) +# po.m4 serial 23 (gettext-0.18.3) dnl Copyright (C) 1995-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, diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 9346ab041d..3d7b381efd 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 50 +# printf.m4 serial 51 dnl Copyright (C) 2003, 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, @@ -61,7 +61,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; @@ -220,7 +220,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; @@ -442,7 +442,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; @@ -588,7 +588,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; @@ -1136,7 +1136,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; @@ -1235,7 +1235,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; @@ -1316,7 +1316,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; @@ -1458,7 +1458,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; diff --git a/gl/m4/valgrind-tests.m4 b/gl/m4/valgrind-tests.m4 index 367816b6eb..502b8df59f 100644 --- a/gl/m4/valgrind-tests.m4 +++ b/gl/m4/valgrind-tests.m4 @@ -12,8 +12,8 @@ dnl From Simon Josefsson AC_DEFUN([gl_VALGRIND_TESTS], [ AC_ARG_ENABLE(valgrind-tests, - AS_HELP_STRING([--enable-valgrind-tests], - [run self tests under valgrind]), + AS_HELP_STRING([--disable-valgrind-tests], + [don't try to run self tests under valgrind]), [opt_valgrind_tests=$enableval], [opt_valgrind_tests=yes]) # Run self-tests under valgrind? diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h index 99f75e60fd..e23b4b2bcd 100644 --- a/gl/tests/fcntl.in.h +++ b/gl/tests/fcntl.in.h @@ -186,6 +186,22 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " /* Fix up the O_* macros. */ +/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT + to values outside 'int' range, so omit these misdefinitions. + But avoid namespace pollution on non-AIX systems. */ +#ifdef _AIX +# include <limits.h> +# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) +# undef O_CLOEXEC +# endif +# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) +# undef O_NOFOLLOW +# endif +# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) +# undef O_TTY_INIT +# endif +#endif + #if !defined O_DIRECT && defined O_DIRECTIO /* Tru64 spells it 'O_DIRECTIO'. */ # define O_DIRECT O_DIRECTIO @@ -21,13 +21,6 @@ # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME := maint.mk -# Diagnostic for continued use of deprecated variable. -# Remove in 2013 -ifneq ($(build_aux),) - $(error "$(ME): \ -set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)") -endif - # Helper variables. _empty = _sp = $(_empty) $(_empty) @@ -155,6 +148,7 @@ export LC_ALL = C ## Sanity checks. ## ## --------------- ## +ifneq ($(_gl-Makefile),) _cfg_mk := $(wildcard $(srcdir)/cfg.mk) # Collect the names of rules starting with 'sc_'. @@ -196,6 +190,7 @@ local-check := \ $(filter-out $(local-checks-to-skip), $(local-checks-available))) syntax-check: $(local-check) +endif # _sc_search_regexp # @@ -445,7 +440,7 @@ sc_require_config_h: # 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 -l '\.c$$' > /dev/null; then \ + @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 \ @@ -469,7 +464,7 @@ sc_prohibit_HAVE_MBRTOWC: define _sc_header_without_use dummy=; : so we do not need a semicolon before each use; \ h_esc=`echo '[<"]'"$$h"'[">]'|$(SED) 's/\./\\\\./g'`; \ - if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ + if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \ files=$$(grep -l '^# *include '"$$h_esc" \ $$($(VC_LIST_EXCEPT) | grep '\.c$$')) && \ grep -LE "$$re" $$files | grep . && \ @@ -716,7 +711,7 @@ sc_changelog: # Ensure that each .c file containing a "main" function also # calls set_program_name. sc_program_name: - @require='set_program_name *\(m?argv\[0\]\);' \ + @require='set_program_name *\(.*\);' \ in_vc_files='\.c$$' \ containing='\<main *(' \ halt='the above files do not call set_program_name' \ @@ -1192,7 +1187,7 @@ sc_copyright_check: in_vc_files=$(sample-test) \ halt='out of date copyright in $(sample-test); update it' \ $(_sc_search_regexp) - @require='Copyright @copyright\{\} .*'$$(date +%Y)' Free' \ + @require='Copyright @copyright\{\} .*'$$(date +%Y) \ in_vc_files=$(texi) \ halt='out of date copyright in $(texi); update it' \ $(_sc_search_regexp) diff --git a/src/gl/error.c b/src/gl/error.c index 31109df3b5..7b99cd7310 100644 --- a/src/gl/error.c +++ b/src/gl/error.c @@ -39,6 +39,9 @@ # include <stdint.h> # include <wchar.h> # define mbsrtowcs __mbsrtowcs +# define USE_UNLOCKED_IO 0 +# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) +# define _GL_ARG_NONNULL(a) #endif #if USE_UNLOCKED_IO @@ -77,9 +80,9 @@ extern void __error_at_line (int status, int errnum, const char *file_name, # define error_at_line __error_at_line # include <libio/iolibio.h> -# define fflush(s) INTUSE(_IO_fflush) (s) +# define fflush(s) _IO_fflush (s) # undef putc -# define putc(c, fp) INTUSE(_IO_putc) (c, fp) +# define putc(c, fp) _IO_putc (c, fp) # include <bits/libc-lock.h> @@ -171,7 +174,7 @@ print_errno_message (int errnum) #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; -# if STRERROR_R_CHAR_P || _LIBC +# if _LIBC || STRERROR_R_CHAR_P s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -201,7 +204,6 @@ error_tail (int status, int errnum, const char *message, va_list args) #if _LIBC if (_IO_fwide (stderr, 0) > 0) { -# define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; @@ -237,7 +239,7 @@ error_tail (int status, int errnum, const char *message, va_list args) if (res != len) break; - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; @@ -342,7 +344,10 @@ error_at_line (int status, int errnum, const char *file_name, if (old_line_number == line_number && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) + || (old_file_name != NULL + && file_name != NULL + && strcmp (old_file_name, file_name) == 0))) + /* Simply return and print nothing. */ return; diff --git a/src/gl/m4/dup2.m4 b/src/gl/m4/dup2.m4 index 89638a0bfe..6498fc2024 100644 --- a/src/gl/m4/dup2.m4 +++ b/src/gl/m4/dup2.m4 @@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_DUP2], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([getdtablesize]) m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [ AC_CHECK_FUNCS_ONCE([dup2]) if test $ac_cv_func_dup2 = no; then @@ -23,6 +24,11 @@ AC_DEFUN([gl_FUNC_DUP2], #include <fcntl.h> #include <errno.h>]], [int result = 0; +#ifdef HAVE_GETDTABLESIZE + int bad_fd = getdtablesize (); +#else + int bad_fd = 1000000; +#endif #ifdef FD_CLOEXEC if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) result |= 1; @@ -37,7 +43,7 @@ AC_DEFUN([gl_FUNC_DUP2], if (dup2 (0, 0) != -1) result |= 8; /* Many gnulib modules require POSIX conformance of EBADF. */ - if (dup2 (2, 1000000) == -1 && errno != EBADF) + if (dup2 (2, bad_fd) == -1 && errno != EBADF) result |= 16; /* Flush out some cygwin core dumps. */ if (dup2 (2, -1) != -1 || errno != EBADF) @@ -56,7 +62,9 @@ AC_DEFUN([gl_FUNC_DUP2], linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a # closed fd may yield -EBADF instead of -1 / errno=EBADF. gl_cv_func_dup2_works="guessing no" ;; - freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF. + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. gl_cv_func_dup2_works="guessing no" ;; haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. gl_cv_func_dup2_works="guessing no" ;; diff --git a/src/gl/m4/gnulib-common.m4 b/src/gl/m4/gnulib-common.m4 index 20ce40e744..35f6195204 100644 --- a/src/gl/m4/gnulib-common.m4 +++ b/src/gl/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 34 +# gnulib-common.m4 serial 35 dnl Copyright (C) 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, @@ -49,6 +49,16 @@ AC_DEFUN([gl_COMMON_BODY], [ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) diff --git a/src/gl/m4/printf.m4 b/src/gl/m4/printf.m4 index 9346ab041d..3d7b381efd 100644 --- a/src/gl/m4/printf.m4 +++ b/src/gl/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 50 +# printf.m4 serial 51 dnl Copyright (C) 2003, 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, @@ -61,7 +61,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; @@ -220,7 +220,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; @@ -442,7 +442,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; @@ -588,7 +588,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on FreeBSD >= 6. - freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; @@ -1136,7 +1136,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; @@ -1235,7 +1235,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; @@ -1316,7 +1316,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; @@ -1458,7 +1458,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on FreeBSD >= 5. - freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; diff --git a/src/gl/mktime.c b/src/gl/mktime.c index 2943823776..48b3a40f9c 100644 --- a/src/gl/mktime.c +++ b/src/gl/mktime.c @@ -38,7 +38,7 @@ #include <string.h> /* For the real memcpy prototype. */ -#if DEBUG +#if defined DEBUG && DEBUG # include <stdio.h> # include <stdlib.h> /* Make it work even if the system's libc has its own mktime routine. */ @@ -600,7 +600,7 @@ libc_hidden_def (mktime) libc_hidden_weak (timelocal) #endif -#if DEBUG +#if defined DEBUG && DEBUG static int not_equal_tm (const struct tm *a, const struct tm *b) diff --git a/src/gl/select.c b/src/gl/select.c index b513025af5..81af82cdcc 100644 --- a/src/gl/select.c +++ b/src/gl/select.c @@ -82,9 +82,11 @@ typedef DWORD (WINAPI *PNtQueryInformationFile) #define PIPE_BUF 512 #endif -/* Optimized test whether a HANDLE refers to a console. - See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */ -#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3) +static BOOL IsConsoleHandle (HANDLE h) +{ + DWORD mode; + return GetConsoleMode (h, &mode) != 0; +} static BOOL IsSocketHandle (HANDLE h) @@ -252,6 +254,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, DWORD ret, wait_timeout, nhandles, nsock, nbuffer; MSG msg; int i, fd, rc; + clock_t tend; if (nfds > FD_SETSIZE) nfds = FD_SETSIZE; @@ -388,6 +391,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, /* Place a sentinel at the end of the array. */ handle_array[nhandles] = NULL; + /* When will the waiting period expire? */ + if (wait_timeout != INFINITE) + tend = clock () + wait_timeout; + restart: if (wait_timeout == 0 || nsock == 0) rc = 0; @@ -408,6 +415,16 @@ restart: wait_timeout = 0; } + /* How much is left to wait? */ + if (wait_timeout != INFINITE) + { + clock_t tnow = clock (); + if (tend >= tnow) + wait_timeout = tend - tnow; + else + wait_timeout = 0; + } + for (;;) { ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, @@ -453,7 +470,16 @@ restart: } } - if (rc == 0 && wait_timeout == INFINITE) + if (rc == 0 + && (wait_timeout == INFINITE + /* If NHANDLES > 1, but no bits are set, it means we've + been told incorrectly that some handle was signaled. + This happens with anonymous pipes, which always cause + MsgWaitForMultipleObjects to exit immediately, but no + data is found ready to be read by windows_poll_handle. + To avoid a total failure (whereby we return zero and + don't wait at all), let's poll in a more busy loop. */ + || (wait_timeout != 0 && nhandles > 1))) { /* Sleep 1 millisecond to avoid busy wait and retry with the original fd_sets. */ @@ -463,6 +489,8 @@ restart: SleepEx (1, TRUE); goto restart; } + if (timeout && wait_timeout == 0 && rc == 0) + timeout->tv_sec = timeout->tv_usec = 0; } /* Now fill in the results. */ diff --git a/src/gl/xalloc.h b/src/gl/xalloc.h index 5f891457ba..3f6b5b80f8 100644 --- a/src/gl/xalloc.h +++ b/src/gl/xalloc.h @@ -64,7 +64,7 @@ void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC; @@ -122,10 +122,9 @@ xnrealloc (void *p, size_t n, size_t s) /* If P is null, allocate a block of at least *PN such objects; otherwise, reallocate P so that it contains more than *PN objects - each of S bytes. *PN must be nonzero unless P is null, and S must - be nonzero. Set *PN to the new number of objects, and return the - pointer to the new block. *PN is never set to zero, and the - returned pointer is never null. + each of S bytes. S must be nonzero. Set *PN to the new number of + objects, and return the pointer to the new block. *PN is never set + to zero, and the returned pointer is never null. Repeated reallocations are guaranteed to make progress, either by allocating an initial block with a nonzero size, or by allocating a @@ -196,13 +195,13 @@ x2nrealloc (void *p, size_t *pn, size_t s) } else { - /* Set N = ceil (1.5 * N) so that progress is made if N == 1. + /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0. Check for overflow, so that N * S stays in size_t range. - The check is slightly conservative, but an exact check isn't + The check may be slightly conservative, but an exact check isn't worth the trouble. */ if ((size_t) -1 / 3 * 2 / s <= n) xalloc_die (); - n += (n + 1) / 2; + n += n / 2 + 1; } *pn = n; |