Merge from Gnulib

This incorporates:
2017-10-29 timespec: prefer ‘assume’ to ‘assure’
2017-10-27 timespec.h: use "assure" to avoid a spurious warning
2017-10-09 getopt-posix: Fix build failure if ac_cv_header_getopt_h=no
* build-aux/config.guess, build-aux/config.sub:
* lib/timespec.h, lib/unistd.in.h:
Copy from Gnulib.
This commit is contained in:
Paul Eggert 2017-11-02 13:18:16 -07:00
parent 6b08ad5263
commit 04bc1410c2
4 changed files with 32 additions and 25 deletions

View file

@ -2,7 +2,7 @@
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2017 Free Software Foundation, Inc. # Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-09-26' timestamp='2017-11-01'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -479,13 +479,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif #endif
#if defined (host_mips) && defined (MIPSEB) #if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV) #if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); printf ("mips-mips-risco0s%ssysv\\n", argv[1]); exit (0);
#endif #endif
#if defined (SYSTYPE_SVR4) #if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif #endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif #endif
#endif #endif
exit (-1); exit (-1);
@ -608,7 +608,7 @@ EOF
*:AIX:*:*) *:AIX:*:*)
echo rs6000-ibm-aix echo rs6000-ibm-aix
exit ;; exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*) ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
echo romp-ibm-bsd4.4 echo romp-ibm-bsd4.4
exit ;; exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
@ -1072,7 +1072,7 @@ EOF
i*86:*DOS:*:*) i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;; exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) i*86:*:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}

View file

@ -2,7 +2,7 @@
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2017 Free Software Foundation, Inc. # Copyright 1992-2017 Free Software Foundation, Inc.
timestamp='2017-09-26' timestamp='2017-11-01'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -640,7 +640,7 @@ case $basic_machine in
basic_machine=rs6000-bull basic_machine=rs6000-bull
os=-bosx os=-bosx
;; ;;
dpx2* | dpx2*-bull) dpx2*)
basic_machine=m68k-bull basic_machine=m68k-bull
os=-sysv3 os=-sysv3
;; ;;

View file

@ -33,6 +33,8 @@ _GL_INLINE_HEADER_BEGIN
extern "C" { extern "C" {
#endif #endif
#include "verify.h"
/* Resolution of timespec timestamps (in units per second), and log /* Resolution of timespec timestamps (in units per second), and log
base 10 of the resolution. */ base 10 of the resolution. */
@ -67,23 +69,29 @@ make_timespec (time_t s, long int ns)
any platform of interest to the GNU project, since all such any platform of interest to the GNU project, since all such
platforms have 32-bit int or wider. platforms have 32-bit int or wider.
Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like Replacing "a.tv_nsec - b.tv_nsec" with something like
"a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause
this function to work in some cases where the above assumption is this function to work in some cases where the above assumption is
violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2, violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2,
b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the
extra instructions. Using a subtraction has the advantage of extra instructions. Using a subtraction has the advantage of
detecting some invalid cases on platforms that detect integer detecting some invalid cases on platforms that detect integer
overflow. overflow. */
The (int) cast avoids a gcc -Wconversion warning. */
_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE _GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
timespec_cmp (struct timespec a, struct timespec b) timespec_cmp (struct timespec a, struct timespec b)
{ {
return (a.tv_sec < b.tv_sec ? -1 if (a.tv_sec < b.tv_sec)
: a.tv_sec > b.tv_sec ? 1 return -1;
: (int) (a.tv_nsec - b.tv_nsec)); if (a.tv_sec > b.tv_sec)
return 1;
/* Pacify gcc -Wstrict-overflow (bleeding-edge circa 2017-10-02). See:
http://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00006.html */
assume (-1 <= a.tv_nsec && a.tv_nsec <= 2 * TIMESPEC_RESOLUTION);
assume (-1 <= b.tv_nsec && b.tv_nsec <= 2 * TIMESPEC_RESOLUTION);
return a.tv_nsec - b.tv_nsec;
} }
/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be

View file

@ -134,9 +134,8 @@
/* The definition of _GL_WARN_ON_USE is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */
/* Get getopt(), optarg, optind, opterr, optopt. /* Get getopt(), optarg, optind, opterr, optopt. */
But avoid namespace pollution on glibc systems. */ #if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
# include <getopt-cdefs.h> # include <getopt-cdefs.h>
# include <getopt-pfx-core.h> # include <getopt-pfx-core.h>
#endif #endif