]> Savannah Git Hosting - gnulib.git/log
gnulib.git
8 years agofreadahead: Silence warning on DragonFlyBSD.
Bruno Haible [Wed, 15 Mar 2017 17:53:58 +0000 (18:53 +0100)]
freadahead: Silence warning on DragonFlyBSD.

* lib/freadahead.c (__sreadahead): Declare ourselves.

8 years agovma-iter: Add comment about AIX.
Bruno Haible [Tue, 14 Mar 2017 23:12:50 +0000 (00:12 +0100)]
vma-iter: Add comment about AIX.

* lib/vma-iter.c: Add comment about why this module is not implemented
on AIX.

8 years agosnippets: move unadjusted snippet sources to lib
Paul Eggert [Tue, 14 Mar 2017 20:23:25 +0000 (13:23 -0700)]
snippets: move unadjusted snippet sources to lib

Problem reported by Michal Privoznik in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00039.html
* lib/_Noreturn.h: Rename from build-aux/snippet/_Noreturn.h.
* lib/arg-nonnull.h: Rename from build-aux/snippet/arg-nonnull.h.
* lib/c++defs.h: Rename from build-aux/snippet/c++defs.h.
* lib/unused-parameter.h: Rename from
build-aux/snippet/unused-parameter.h.
* lib/warn-on-use.h: Rename from build-aux/snippet/warn-on-use.h.
* modules/snippet/_Noreturn (Files:, _NORETURN_H):
* modules/snippet/arg-nonnull (Files:, ARG_NONNULL_H):
* modules/snippet/c++defs (Files:, CXXDEFS_H):
* modules/snippet/unused-parameter (Files:, UNUSED_PARAMETER_H):
* modules/snippet/warn-on-use (Files: WARN_ON_USE_H):
Adjust to file renamings.

8 years agognulib-tool: don't automatically distribute files from top/
Mathieu Lirzin [Tue, 14 Mar 2017 11:19:40 +0000 (12:19 +0100)]
gnulib-tool: don't automatically distribute files from top/

* gnulib-tool (func_get_automake_snippet_unconditional): To be able to
not distribute top/README-release by default, don't distribute files
from top/ unconditionally.
* modules/gnumakefile (Makefile.am): Distribute top/GNUmakefile.
* modules/maintainer-makefile (Makefile.am): Distribute top/maint.mk.

8 years agousers.txt: Update link to libvirt's repo
Michal Privoznik [Tue, 14 Mar 2017 12:22:47 +0000 (13:22 +0100)]
users.txt: Update link to libvirt's repo

The currently listed link does not exist anymore. For a quite
long time the libvirt's repo lives on libvirt.org server.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agognulib-tool: fix typo in comment output
Paul Eggert [Tue, 14 Mar 2017 15:39:27 +0000 (08:39 -0700)]
gnulib-tool: fix typo in comment output

* gnulib-tool (func_import): Fix typo with previous change.

8 years agosnippets: work around GNU Make 3.82 VPATH
Paul Eggert [Tue, 14 Mar 2017 08:20:11 +0000 (01:20 -0700)]
snippets: work around GNU Make 3.82 VPATH

When using 'gnulib-tool --gnu-make' on Emacs, and building
the resulting tarball on Solaris 10 which bundles GNU Make 3.82,
an out-of-source (VPATH) build failed because the sans-copyright
snippet file was not built before the file that used it.
Presumably this is some sort of VPATH thing.  Work around the
problem by using the original snippet, i.e., don’t bother to
remove its copyright notice.
* modules/snippet/_Noreturn, modules/snippet/link-warning:
Don’t assume Automake in comments.  Omit long-incorrect comment.
* modules/snippet/arg-nonnull (BUILT_SOURCES, arg-nonnull.h)
(MOSTLYCLEANFILES):
* modules/snippet/c++defs (BUILT_SOURCES, c++defs.h)
(MOSTLYCLEANFILES):
* modules/snippet/unused-parameter (BUILT_SOURCES, unused-parameter.h)
(MOSTLYCLEANFILES):
* modules/snippet/warn-on-use (BUILT_SOURCES, warn-on-use.h)
(MOSTLYCLEANFILES):
Remove.
* modules/snippet/arg-nonnull (ARG_NONNULL_H):
* modules/snippet/c++defs (CXXDEFS_H):
* modules/snippet/unused-parameter (UNUSED_PARAMETER_H):
* modules/snippet/warn-on-use (WARN_ON_USE_H):
Don’t bother to remove the copyright notice; just use the
original snippet as-is.

8 years agognulib-tool: minor --gnu-make fixups
Paul Eggert [Mon, 13 Mar 2017 22:50:44 +0000 (15:50 -0700)]
gnulib-tool: minor --gnu-make fixups

* gnulib-tool (func_emit_lib_Makefile_am):
Remove useless code that was a blind alley during implementation.
Problem reported by Thien-Thi Nguyen in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00029.html
(func_import): Note the "--gnu-make" option in the output comment.

8 years agognulib-tool: new option --gnu-make
Paul Eggert [Mon, 13 Mar 2017 02:18:53 +0000 (19:18 -0700)]
gnulib-tool: new option --gnu-make

This is for applications like GNU Emacs that use GNU Make
features instead of Automake.
* doc/gnulib-tool.texi (Initial import): Mention --gnu-make.
* doc/gnulib.texi (Unit test modules, Build robot for gnulib):
Do not assume Automake.
* gnulib-tool (func_determine_path_separator)
(func_modules_transitive_closure, func_update_file)
(func_emit_lib_Makefile_am, func_emit_tests_Makefile_am)
(func_import): Add support for --gnu-make.

8 years agognulib-common.m4: avoid aclocal.m4 bloat
Paul Eggert [Sun, 12 Mar 2017 02:13:44 +0000 (18:13 -0800)]
gnulib-common.m4: avoid aclocal.m4 bloat

* m4/gnulib-common.m4 (gl_PROG_AR_RANLIB):
Hide AM_PROG_AR from aclocal, so that aclocal does not
install irrelevant macro definitions into aclocal.m4.

8 years agovma-iter: Let callers know about error.
Bruno Haible [Fri, 10 Mar 2017 17:08:18 +0000 (18:08 +0100)]
vma-iter: Let callers know about error.

* lib/vma-iter.h (vma_iterate): Return 'int', not 'void'.
* lib/vma-iter.c (vma_iterate): Return -1 in case of error.

8 years agoparse-datetime: remove extraneous generated source file
Pádraig Brady [Thu, 9 Mar 2017 03:44:46 +0000 (19:44 -0800)]
parse-datetime: remove extraneous generated source file

* modules/parse-datetime: Remove the tmp generated source.

8 years agoautoupdate
Karl Berry [Wed, 8 Mar 2017 14:37:57 +0000 (06:37 -0800)]
autoupdate

8 years agoautoupdate
Karl Berry [Tue, 7 Mar 2017 15:51:04 +0000 (07:51 -0800)]
autoupdate

8 years agoautoupdate
Karl Berry [Mon, 6 Mar 2017 14:38:58 +0000 (06:38 -0800)]
autoupdate

8 years agoFix value of LD for 64-bit compilers on AIX.
Bruno Haible [Sun, 5 Mar 2017 16:50:34 +0000 (17:50 +0100)]
Fix value of LD for 64-bit compilers on AIX.

* m4/lib-ld.m4 (AC_LIB_PROG_LD): For 64-bit compilers on AIX
("gcc -maix64" and "xlc -q64"), add option -b64 to $LD.

8 years agoautoupdate
Karl Berry [Sun, 5 Mar 2017 16:55:23 +0000 (08:55 -0800)]
autoupdate

8 years agodtotimespec: simplify
Paul Eggert [Sun, 5 Mar 2017 04:42:52 +0000 (20:42 -0800)]
dtotimespec: simplify

* lib/dtotimespec.c (dtotimespec): Simplify.

8 years agotest-calloc-gnu: Reenable test also for GCC 7.
Bruno Haible [Sun, 5 Mar 2017 01:17:00 +0000 (02:17 +0100)]
test-calloc-gnu: Reenable test also for GCC 7.

* tests/test-calloc-gnu.c (eight): New function.
(main): Don't skip test; use eight() instead.

8 years agotest-calloc-gnu: port to GCC7
Jim Meyering [Sat, 4 Mar 2017 22:50:41 +0000 (14:50 -0800)]
test-calloc-gnu: port to GCC7

* tests/test-calloc-gnu.c (main) [__GNUC__ >= 7]: Skip a test
that attempts to calloc more than SIZE_MAX bytes, because GCC7
and newer would detect that at compilation time.

8 years agotests: Avoid compiler warning about uses of null_ptr.
Bruno Haible [Sat, 4 Mar 2017 10:24:37 +0000 (11:24 +0100)]
tests: Avoid compiler warning about uses of null_ptr.

* tests/null-ptr.h: New file.
* tests/test-canonicalize.c: Include null-ptr.h.
(null_ptr): Remove function.
* tests/test-canonicalize-lgpl.c: Likewise.
* tests/test-memmem.c: Likewise.
* tests/test-ptsname_r.c: Likewise.
* modules/canonicalize-tests (Files): Add tests/null-ptr.h.
* modules/canonicalize-lgpl-tests: Likewise.
* modules/memmem-tests: Likewise.
* modules/ptsname_r-tests: Likewise.
Reported by Jim Meyering.

8 years agodoc: Mention Mac OS X deficiencies regarding semaphores.
Bruno Haible [Fri, 3 Mar 2017 11:47:04 +0000 (12:47 +0100)]
doc: Mention Mac OS X deficiencies regarding semaphores.

* doc/posix-functions/sem_init.texi: Mention status on Mac OS X.
* doc/posix-functions/sem_destroy.texi: Likewise.
* doc/posix-functions/sem_getvalue.texi: Likewise.

8 years agolock tests: Fix test failure on Mac OS X (regression from 2017-01-05).
Bruno Haible [Fri, 3 Mar 2017 11:13:48 +0000 (12:13 +0100)]
lock tests: Fix test failure on Mac OS X (regression from 2017-01-05).

Reported by Assaf Gordon <assafgordon@gmail.com> via
Pádraig Brady <P@draigBrady.com>.
* tests/test-lock.c: On Mac OS X, use named semaphores, not unnamed
semaphores.
(USE_NAMED_SEMAPHORE, USE_UNNAMED_SEMAPHORE): New macros.
(atomic_int_semaphore): New macro.

8 years agoperror tests: Tweak for z/OS.
Bruno Haible [Tue, 28 Feb 2017 23:57:33 +0000 (00:57 +0100)]
perror tests: Tweak for z/OS.

Reported by Daniel Richard G. <skunk@iskunk.org>.
* tests/test-perror.sh: Don't fail z/OS style perror output.

8 years agonproc: Refactor large function.
Bruno Haible [Sun, 26 Feb 2017 17:05:12 +0000 (18:05 +0100)]
nproc: Refactor large function.

* lib/nproc.c (num_processors_ignoring_omp): New function, extracted
from num_processors.
(num_processors): In this function, only deal with OMP.

8 years agonproc: adjust handling of OpenMP environment variables
Pádraig Brady [Sun, 26 Feb 2017 14:32:19 +0000 (06:32 -0800)]
nproc: adjust handling of OpenMP environment variables

Adjust to match the return value from omp_get_num_threads(), i.e.:
 - honor OMP_THREAD_LIMIT without OMP_NUM_THREADS
 - Treat 0 as an invalid value and ignore

Also remove the call to omp_get_num_threads()
added in the previous recent commit, because it's
ineffective without the omp pragmas in place.

* lib/nproc.c (parse_omp_threads): Return 0 if specified,
so that it can be ignored.
(num_processors): Honor OMP_THREAD_LIMIT even without
OMP_NUM_THREADS being set.  Also fix a typo in the environment
variable being checked, from the previous recent commit.

8 years agonproc: support nested OMP_NUM_THREADS, and OMP_THREAD_LIMIT
Pádraig Brady [Tue, 21 Feb 2017 04:26:35 +0000 (20:26 -0800)]
nproc: support nested OMP_NUM_THREADS, and OMP_THREAD_LIMIT

* lib/nproc.c (parse_omp_threads): A new function refactored
from num_processors() to support parsing both of the
above environment variables.
(num_processors): Prefer using omp_get_num_threads() with [_OPENMP]
to accurately reflect the current OpenMP nesting level.
Also support the OMP_THREAD_LIMIT environment variable
to limit the max value determined from OMP_NUM_THREADS.
* modules/nproc: Depend on minmax header.
Suggested by Oliver Heimlich.

8 years agomaintainer-makefile: Fix AC_PROG_SED with autoconf cache.
Bruno Haible [Sat, 25 Feb 2017 21:54:53 +0000 (22:54 +0100)]
maintainer-makefile: Fix AC_PROG_SED with autoconf cache.

* m4/gnulib-common.m4 (AC_PROG_SED): Fix AC_CACHE_CHECK invocation.

8 years agoftoastr: port to -Wdouble-promotion
Paul Eggert [Fri, 24 Feb 2017 16:44:27 +0000 (08:44 -0800)]
ftoastr: port to -Wdouble-promotion

Work around -Wdouble-promotion false alarm in recent GCCs.
* lib/ftoastr.c (PROMOTED_FLOAT): New macro.
(ftoastr_snprintf, FTOASTR): Use it.

8 years agolock tests: Fix build failure on GNU/Hurd (regression from 2017-01-05).
Bruno Haible [Tue, 21 Feb 2017 16:07:27 +0000 (17:07 +0100)]
lock tests: Fix build failure on GNU/Hurd (regression from 2017-01-05).

Reported by Rene Saavedra <rennes@openmailbox.org> in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25821 via Paul Eggert.
* lib/glthread/lock.h: On glibc systems without
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, use the fallback
implementation of rwlocks.
* lib/glthread/lock.c: Likewise.

8 years agolock tests: Fix build failure on z/OS.
Bruno Haible [Mon, 20 Feb 2017 21:34:24 +0000 (22:34 +0100)]
lock tests: Fix build failure on z/OS.

Reported by Daniel Richard G. <skunk@iskunk.org>.
* modules/lock-tests (configure.ac): Test for <semaphore.h>.
* tests/test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not
exist.

8 years agohavelib: Prefer the search path of /usr/bin/gcc over the one of $CC.
Bruno Haible [Sun, 19 Feb 2017 18:46:14 +0000 (19:46 +0100)]
havelib: Prefer the search path of /usr/bin/gcc over the one of $CC.

8 years agohavelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible [Sun, 19 Feb 2017 18:07:09 +0000 (19:07 +0100)]
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.

* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Use AC_CACHE_CHECK.

8 years agognulib-tool: Avoid conflict of havelib-tests with --single-configure.
Bruno Haible [Sun, 19 Feb 2017 14:15:11 +0000 (15:15 +0100)]
gnulib-tool: Avoid conflict of havelib-tests with --single-configure.

* gnulib_tool (func_create_testdir): Avoid havelib-tests when
--with-tests --single-configure is specified.

8 years agousers.txt: Update links, use HTTPS where possible
Tim Rühsen [Thu, 16 Feb 2017 10:12:57 +0000 (11:12 +0100)]
users.txt: Update links, use HTTPS where possible

* users.txt: Updated to HTTPS where possible,
fixed some links to new locations.

8 years agoxbinary-io: Fix inlining.
Bruno Haible [Thu, 16 Feb 2017 09:16:02 +0000 (10:16 +0100)]
xbinary-io: Fix inlining.

* lib/xbinary-io.c: Set XBINARY_IO_INLINE, not XSETMODE_INLINE.

8 years agoxbinary-io: rename from xsetmode
Paul Eggert [Thu, 16 Feb 2017 08:17:56 +0000 (00:17 -0800)]
xbinary-io: rename from xsetmode

This patch is taken from suggestions by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00060.html
http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00061.html
* lib/binary-io.c (__gl_setmode_check): Set errno to EINVAL,
not ENOTTY, when it is an inappropriate device.
* lib/binary-io.h (SET_BINARY): Resurrect.
* lib/xbinary-io.c: Rename from lib/xsetmode.c.
(xset_binary_mode_error): Rename from xsetmode_error.
* lib/xbinary-io.h: Rename from lib/xsetmode.h.
(xset_binary_mode): Rename from xsetmode.
All uses changed.
* modules/xbinary-io: Rename from modules/xsetmode.
Update file names.
* tests/test-binary-io.sh (tmpfiles): Remove no-longer-used file name.
* NEWS: Update to match revised behavior.

8 years agotests: Adjust to recent SET_BINARY change
Paul Eggert [Wed, 15 Feb 2017 23:33:17 +0000 (15:33 -0800)]
tests: Adjust to recent SET_BINARY change

* tests/test-binary-io.c (main):
* tests/test-binary-io.sh: Remove test for SET_BINARY.
* tests/test-closein.c, tests/test-fflush2.c, tests/test-ftell.c:
* tests/test-ftello.c, tests/test-nonblocking-pipe-child.c:
* tests/test-yesno.c: Use set_binary_mode, not SET_BINARY.

8 years agoxsetmode: new module
Paul Eggert [Wed, 15 Feb 2017 22:30:33 +0000 (14:30 -0800)]
xsetmode: new module

This is to fix a problem noted by Eric Blake.
Code was using xfreopen to change files to binary mode, but this
fails for stdout when in append mode.  Such code should use
xsetmode instead.
* NEWS: Document incompatible changes to binary-io module.
* lib/binary-io.c (__gl_setmode_check) [__DJGPP__ || __EMX__]:
New function.
* lib/binary-io.h (__gl_setmode): Rename from set_binary_mode.
(set_binary_mode): New function, which also checks for tty.
* lib/xsetmode.c, lib/xsetmode.h, modules/xsetmode: New files.

8 years agoheaders: fix begin-end typos
Paul Eggert [Tue, 14 Feb 2017 16:50:58 +0000 (08:50 -0800)]
headers: fix begin-end typos

* lib/mbfile.h, lib/se-selinux.in.h: Fix typos by replacing
_GL_INLINE_HEADER_BEGIN with _GL_INLINE_HEADER_END.

8 years agoselinux-h: port to PGI 16.10
Paul Eggert [Tue, 14 Feb 2017 16:46:05 +0000 (08:46 -0800)]
selinux-h: port to PGI 16.10

* lib/se-selinux.in.h: Don't assume that include_next skips over
duplicate -I DIR options.

8 years agoargp: port to PGI 16.10
Paul Eggert [Tue, 14 Feb 2017 16:40:23 +0000 (08:40 -0800)]
argp: port to PGI 16.10

* lib/argp-pin.c (dummy): Declare as needed to make file nonempty.

8 years agounicase: Update function protoype to match definition
Darshit Shah [Mon, 13 Feb 2017 17:40:33 +0000 (18:40 +0100)]
unicase: Update function protoype to match definition

* lib/unicase/special-casing.h (gl_unicase_special_lookup): Gperf 3.1
uses 'size_t' as the datatype for the 'len' parameter in the functions
it generates. Update the prototype specified here to match the newly
generated function.

8 years agotimes test: Avoid gcc warnings on Linux/x32.
Bruno Haible [Sun, 12 Feb 2017 12:05:25 +0000 (13:05 +0100)]
times test: Avoid gcc warnings on Linux/x32.

* tests/test-times.c (main): Really cast printf arguments from clock_t
to 'long int'.

8 years agoglob: port better to emscripten
Paul Eggert [Sun, 12 Feb 2017 08:11:46 +0000 (00:11 -0800)]
glob: port better to emscripten

Problem reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00031.html
* lib/glob.c (glob): Don't assume HAVE_GETPWNAM_R || _LIBC.

8 years agohost-cpu-c-abi: Support for 64-bit AIX, 32-bit armhf on arm64, hppa64.
Bruno Haible [Sat, 11 Feb 2017 12:41:49 +0000 (13:41 +0100)]
host-cpu-c-abi: Support for 64-bit AIX, 32-bit armhf on arm64, hppa64.

* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Define also HOST_CPU.
For the x32 ABI on x86_64, set HOST_CPU_C_ABI to 'x86_64-x32' and define
both __x86_64__ and __x86_64_x32__. For the ELFv2 ABI on powerpc64,
define both __powerpc64__ and __powerpc64_elfv2__. Recognize 64-bit
compilation on AIX. Recognize 32-bit compilation on arm64/Linux.
Distinguish hppa64 from hppa.

8 years agosearch: Don't assume that tsearch() exists if 'VISIT' is defined.
Bruno Haible [Fri, 10 Feb 2017 21:42:36 +0000 (22:42 +0100)]
search: Don't assume that tsearch() exists if 'VISIT' is defined.

* m4/search_h.m4 (gl_SEARCH_H): Determine HAVE_TYPE_VISIT.
* modules/search (Makefile.am): Substitute HAVE_TYPE_VISIT.
* lib/search.in.h (VISIT): Define if HAVE_TYPE_VISIT is 0.

8 years agodoc: Don't mention obsolete AC_LIBTOOL_WIN32_DLL macro.
Bruno Haible [Thu, 9 Feb 2017 16:27:40 +0000 (17:27 +0100)]
doc: Don't mention obsolete AC_LIBTOOL_WIN32_DLL macro.

* doc/gnulib.texi (Libtool and Windows): Recommend
LT_INIT([win32-dll]) instead of AC_LIBTOOL_WIN32_DLL.
Reported by Reuben Thomas <rrt@sc3d.org>.

8 years agostddef-tests: port to SIZE_MAX <= INT_MAX
Paul Eggert [Thu, 9 Feb 2017 00:41:39 +0000 (16:41 -0800)]
stddef-tests: port to SIZE_MAX <= INT_MAX

* tests/test-stddef.c: Include <limits.h>, for INT_MAX.
Do not assume that INT_MAX < SIZE_MAX.

8 years agoautoupdate
Karl Berry [Tue, 7 Feb 2017 16:50:57 +0000 (08:50 -0800)]
autoupdate

8 years agolock tests: Fix link error.
Bruno Haible [Wed, 1 Feb 2017 21:47:27 +0000 (22:47 +0100)]
lock tests: Fix link error.

* modules/lock-tests (test_rwlock1_LDADD): Add @YIELD_LIB@.
Reported by Tom G. Christensen <tgc@jupiterrise.com>.

8 years agolock: Fix link error (regression from 2017-01-05).
Bruno Haible [Tue, 31 Jan 2017 23:13:21 +0000 (00:13 +0100)]
lock: Fix link error (regression from 2017-01-05).

* lib/glthread/lock.h [USE_POSIX_THREADS_WEAK]: Declare also
pthread_rwlockattr_init, pthread_rwlockattr_setkind_np,
pthread_rwlockattr_destroy weak.
Reported by Tom G. Christensen <tgc@jupiterrise.com>.

8 years agoPort to PGI 16.10 x86-64
Paul Eggert [Tue, 31 Jan 2017 02:20:43 +0000 (18:20 -0800)]
Port to PGI 16.10 x86-64

This patch fixes one real bug in gl_anylinked_list2.h, along with
some minor glitches that are not bugs.  It does not silence PGI’s
thousands of bogus warnings when compiling test-intprops.c.
Fortunately, the warnings do not cause a failure.
* lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N):
Rename parameter to avoid PGI warning about ‘#define f(n) 'n'’.
My goodness, PGI goes back a long ways - this predates C89!
* lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI.
For example, ASYNCSAFE (const void *) should expand to
‘const void *volatile’, not to ‘volatile const void *’.
* lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined.
* lib/verify.h (verify) [!__GNUC__]:
Use shorter albeit meaningless string to bypass silly compiler limits.
* tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]:
* tests/nan.h (NaNf, NaNd, NaNl):
Use static functions to avoid misguided compiler diagnostics.
Is there some reason we don’t use static functions on all platforms?

8 years agoparse-datetime: handle timezones reentrantly
Paul Eggert [Sat, 21 Jan 2017 01:11:55 +0000 (17:11 -0800)]
parse-datetime: handle timezones reentrantly

This API change was prompted by a report by Pádraig Brady in:
https://bug.debian.org/851934#10
To help fix the bug, make parse_datetime2 more reentrant.
* NEWS: Document this incompatible change.
* lib/parse-datetime.h, lib/parse-datetime.y (parse_datetime2):
Add two arguments, the timezone and the timezone name.
All callers changed.  If TZ="..." is specified, use it for
calculating defaults.
* lib/parse-datetime.y: Don't include xalloc.h or use xmalloc, as
this code should be usable in a library.
(mktime_ok, get_effective_timezone):
Accept timezone arg too.  All callers changed.
(get_tz): Remove.
(get_effective_timezone): Check for failures.
* modules/parse-datetime: Add time_r, time_rz.  Remove xalloc.

8 years agotime_rz: fix comment typo
Paul Eggert [Sat, 21 Jan 2017 00:59:17 +0000 (16:59 -0800)]
time_rz: fix comment typo

8 years agolocalename: port to cygwin 2.6
Eric Blake [Thu, 19 Jan 2017 20:26:30 +0000 (14:26 -0600)]
localename: port to cygwin 2.6

Cygwin 2.6 introduced uselocale() and thread-local locales in general,
but lacks any way to get at the name of each portion of a locale_t
object short of peeking behind an opaque object.  Cygwin has just
been patched to add NL_LOCALE_NAME() patterned after glibc's
extension of the same name[1], but as that version of Cygwin has not
yet been released, we might as well work around it in the meantime.

[1] https://sourceware.org/ml/newlib/2017/msg00071.html

* lib/localename.c (gl_locale_name_thread_unsafe): Add clause for
Cygwin.
* modules/localename (Depends-on): Add extensions, since
NL_LOCALE_NAME() is not visible without it.

Signed-off-by: Eric Blake <eblake@redhat.com>
8 years agousers.txt: Update wget URL (tiny change)
Tim Rühsen [Thu, 19 Jan 2017 07:37:21 +0000 (23:37 -0800)]
users.txt: Update wget URL (tiny change)

8 years agousers.txt: Add wget2 (tiny change)
Tim Rühsen [Thu, 19 Jan 2017 07:36:06 +0000 (23:36 -0800)]
users.txt: Add wget2 (tiny change)

8 years agodfa: fix memory leak in parse
Norihiro Tanaka [Wed, 18 Jan 2017 22:44:13 +0000 (07:44 +0900)]
dfa: fix memory leak in parse

Problem reported by Arnold Robbins in:
http://lists.gnu.org/archive/html/bug-grep/2017-01/msg00006.html

* lib/dfa.c (epsclosure): Do it.

8 years agoparse-datetime: fix dependence on AC_PROG_SED
Pádraig Brady [Tue, 17 Jan 2017 09:08:14 +0000 (09:08 +0000)]
parse-datetime: fix dependence on AC_PROG_SED

* modules/parse-datetime: Use `sed` directly like all other modules.
Reported by J William Piggott

8 years agointprops: update doc URLs
Paul Eggert [Tue, 17 Jan 2017 01:21:57 +0000 (17:21 -0800)]
intprops: update doc URLs

* doc/intprops.texi (Integer Range Overflow): Update URLs.

8 years agohost-cpu-c-abi: Add support for armhf, arm64, x32, s390x.
Bruno Haible [Mon, 16 Jan 2017 21:07:51 +0000 (22:07 +0100)]
host-cpu-c-abi: Add support for armhf, arm64, x32, s390x.

* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Require gl_C_ASM. On x86_64
systems, distinguish x86_64 and x32. On arm systems, distinguish arm,
armhf, arm64, and no longer distinguish arm and armel. On s390x systems,
distinguish s390 and s390x.
* modules/host-cpu-c-abi (Files): Add m4/asm-underscore.m4.
* NEWS: Mention the change regarding 'armel'.

8 years agoupdate from texinfo
Karl Berry [Mon, 16 Jan 2017 15:09:50 +0000 (07:09 -0800)]
update from texinfo

8 years agolocaleinfo: case_folded_counterparts and WEOF
Paul Eggert [Mon, 16 Jan 2017 05:23:34 +0000 (21:23 -0800)]
localeinfo: case_folded_counterparts and WEOF

* NEWS: Document this.
* lib/localeinfo.c (case_folded_counterparts):
First arg is now wint_t, not wchar_t.  This generalizes the
function to also work on WEOF, where it returns 0.

8 years agodfa: port to gcc -fsanitize=undefined
Paul Eggert [Mon, 16 Jan 2017 01:18:10 +0000 (17:18 -0800)]
dfa: port to gcc -fsanitize=undefined

* lib/dfa.c (copy): Don’t pass NULL with size 0 to memcpy,
as this runs afoul of gcc -fsanitize=undefined.

8 years agostrftime: %z is -00 if unknown
Paul Eggert [Sat, 14 Jan 2017 19:35:34 +0000 (11:35 -0800)]
strftime: %z is -00 if unknown

* lib/strftime.c (DO_TZ_OFFSET): Omit arg 'negative'; it's now
the caller's responsibility to set 'negative_number'.  All uses changed.
(__strftime_internal): Put '-' before a zero UTC offset if the time
zone abbreviation starts with "-", which is the recently-introduced
tzdb convention for an unknown UTC offset that is arbitrarily set to 0.
* tests/test-strftime.c: Test for this.

8 years agodfa: port to older GCC
Paul Eggert [Tue, 10 Jan 2017 22:35:34 +0000 (14:35 -0800)]
dfa: port to older GCC

Problem reported by Assaf Gordon in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00103.html
* modules/c99: New module.  This merely attempts to use the latest
C version, which should be enough to solve this particular problem.
The idea is to document which Gnulib modules assume C99 or later.
* modules/dfa (Depends-on): Add it.

8 years agoUpdate DEPENDENCIES.
Bruno Haible [Tue, 10 Jan 2017 20:57:15 +0000 (21:57 +0100)]
Update DEPENDENCIES.

* DEPENDENCIES: List only https URLs. Update recommended version for
autoconf, automake, gperf.

8 years agomaint.mk: enforce spelling of "timestamp" (i.e., no space)
Jim Meyering [Tue, 10 Jan 2017 15:19:02 +0000 (07:19 -0800)]
maint.mk: enforce spelling of "timestamp" (i.e., no space)

* top/maint.mk (prohibit_undesirable_word_seq_RE_): Also
disallow /\btime\s+stamps?\b/.  Prefer "timestamp".

8 years agodfa: minor simplification with emptyset
Paul Eggert [Tue, 10 Jan 2017 09:27:44 +0000 (01:27 -0800)]
dfa: minor simplification with emptyset

* lib/dfa.c (build_state): Simplify by using emptyset.

8 years agodfa: shrink constraints from 4 bits to 3
Paul Eggert [Tue, 10 Jan 2017 06:48:46 +0000 (22:48 -0800)]
dfa: shrink constraints from 4 bits to 3

* lib/dfa.c (newline_constraint, letter_constraint)
(other_constraint, prev_newline_dependent)
(prev_letter_dependent, NO_CONSTRAINT, BEGLINE_CONSTRAINT)
(ENDLINE_CONSTRAINT, BEGWORD_CONSTRAINT, ENDWORD_CONSTRAINT)
(LIMWORD_CONSTRAINT, NOTLIMWORD_CONSTRAINT):
Constraints need only 3 bits, not 4.  Using smaller integers
shrinks the code a bit and makes grep a tad faster on x86-64.

8 years agodfa: omit unnecessary ptrdiff_t check
Paul Eggert [Tue, 10 Jan 2017 04:28:11 +0000 (20:28 -0800)]
dfa: omit unnecessary ptrdiff_t check

* lib/dfa.c (alloc_position_set): Do not worry about ptrdiff_t
overflow, since xnmalloc does that now.

8 years agodfa: omit unnecessary allocation
Paul Eggert [Tue, 10 Jan 2017 04:26:02 +0000 (20:26 -0800)]
dfa: omit unnecessary allocation

* lib/dfa.c (dfaanalyze): Do not allocate follow set, since
an all-zero follow set works just fine.

8 years agodfa: omit unused local
Paul Eggert [Tue, 10 Jan 2017 00:30:41 +0000 (16:30 -0800)]
dfa: omit unused local

* lib/dfa.c (build_state): Fix up recent change.

8 years agomaint: time stamp -> timestamp
Paul Eggert [Mon, 9 Jan 2017 19:55:22 +0000 (11:55 -0800)]
maint: time stamp -> timestamp

Use the spelling "timestamp", as that is what POSIX uses.

8 years agomaint: remove stray .texi files
Paul Eggert [Mon, 9 Jan 2017 19:49:35 +0000 (11:49 -0800)]
maint: remove stray .texi files

Although these were superseded by other files like
doc/posix-functions/ctime.texi, the old files were not removed.
* doc/ctime.texi, doc/inet_ntoa.texi: Remove.

8 years agogetprogname: fix port to IRIX
Paul Eggert [Mon, 9 Jan 2017 06:10:58 +0000 (22:10 -0800)]
getprogname: fix port to IRIX

* lib/getprogname.c (getprogname) [__sgi]:
Don't dump core if malloc returns NULL.

8 years agodfa: melt down dfastate into build_state
Norihiro Tanaka [Sun, 8 Jan 2017 23:21:21 +0000 (08:21 +0900)]
dfa: melt down dfastate into build_state

* src/dfa.c (dfastate): Remove it.
(build_state): Insert content of dfastate() to bottom.

8 years agodfa: simplify transition table allocation
Norihiro Tanaka [Sun, 8 Jan 2017 22:46:13 +0000 (07:46 +0900)]
dfa: simplify transition table allocation

* src/dfa.c (realloc_trans_if_necessary): Remove second argument.
Its value is derived from other variable.  Update callers.
(dfastate): Remove calculation of max number of state.

8 years agodfa: fix reallocation bug when matching newlines
Paul Eggert [Sun, 8 Jan 2017 20:44:29 +0000 (12:44 -0800)]
dfa: fix reallocation bug when matching newlines

Problem reported for sed by S. Gilles (Bug#25390).
* lib/dfa.c (realloc_trans_if_necessary): Move earlier.
(dfastate): Reallocate before moving any newline transition ...
(build_state): ... instead of reallocating here, where it is too late.

8 years agoAvoid -Wundef warning about undefined WINDOWS_SOCKETS.
Tim Rühsen [Sat, 7 Jan 2017 17:12:52 +0000 (18:12 +0100)]
Avoid -Wundef warning about undefined WINDOWS_SOCKETS.

* lib/sockets.h: Test if WINDOWS_SOCKETS is defined.

8 years agoAvoid -Wundef warning about undefined __USE_FILE_OFFSET64.
Tim Rühsen [Sat, 7 Jan 2017 17:10:48 +0000 (18:10 +0100)]
Avoid -Wundef warning about undefined __USE_FILE_OFFSET64.

* lib/glob-libc.h: Test if __USE_FILE_OFFSET64 is defined.

8 years agostdioext: Port to Minix 3.2 and newer.
Bruno Haible [Sat, 7 Jan 2017 13:49:10 +0000 (14:49 +0100)]
stdioext: Port to Minix 3.2 and newer.

* lib/stdio-impl.h: Treat __minix like the newest NetBSD.
* lib/fseeko.c (fseeko): Likewise.
Reported by Nelson Beebe via Paul Eggert.

8 years agogetprogname: port to IRIX
Paul Eggert [Sat, 7 Jan 2017 00:14:21 +0000 (16:14 -0800)]
getprogname: port to IRIX

* lib/getprogname.c (getprogname): Port to IRIX.
Based on an idea by Bastien Roucariès at:
http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00096.html
via code from Bruno Haible at:
https://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00249.html

8 years agolocalename-tests: port to NetBSD 7
Paul Eggert [Fri, 6 Jan 2017 22:14:43 +0000 (14:14 -0800)]
localename-tests: port to NetBSD 7

Problem reported by Nelson H. F. Beebe.
* tests/test-localename.c:
Test newlocale and uselocale only if both exist.

8 years agoglob, intprops, xalloc: work around Clang bug
Paul Eggert [Fri, 6 Jan 2017 21:36:57 +0000 (13:36 -0800)]
glob, intprops, xalloc: work around Clang bug

Work around LLVM bug 16404, which is still not fixed.
https://llvm.org/bugs/show_bug.cgi?id=16404
Problem reported by Nelson H. F. Beebe.
* lib/glob.c, lib/intprops.h, lib/xalloc-oversized.h (__has_builtin):
Remove.
* lib/glob.c (size_add_wrapv):
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW, _GL_HAS_BUILTIN_OVERFLOW_P):
* lib/xalloc-oversized.h (xalloc_oversized):
Do not use overflow builtins if Clang.

8 years agodfa: fix 'return' typo
Paul Eggert [Fri, 6 Jan 2017 20:49:39 +0000 (12:49 -0800)]
dfa: fix 'return' typo

Problem reported by Nelson H. F. Beebe.
* lib/dfa.c (merge): Fix typo that Sun compilers rejected.

8 years agolock tests: Prefer semaphore over mutex.
Bruno Haible [Thu, 5 Jan 2017 22:49:34 +0000 (23:49 +0100)]
lock tests: Prefer semaphore over mutex.

* tests/test-lock.c (USE_SEMAPHORE): New constant.
(struct atomic_int, init_atomic_int, get_atomic_int_value,
set_atomic_int_value) [USE_SEMAPHORE]: Define using a POSIX semaphore.
Suggested by Torvald Riegel <triegel@redhat.com>.

8 years agoparse-datetime: fix generated paths for coverage files
Pádraig Brady [Tue, 3 Jan 2017 00:52:13 +0000 (00:52 +0000)]
parse-datetime: fix generated paths for coverage files

* modules/parse-datetime: Adjust the paths for parse-datetime.y
within parse-datetime.c, so that gcc generates appropriate .gcno
files, allowing lcov to proceed without error.  Previously it
would error trying to find "lib/lib/parse-datetime.y".

8 years agomaint.mk: support parallel execution of coverage
Pádraig Brady [Mon, 2 Jan 2017 21:31:49 +0000 (21:31 +0000)]
maint.mk: support parallel execution of coverage

* top/maint.mk (coverage): Run dependencies serially,
thus supporting parallel processing of each one,
particularly build-coverage, which builds and runs tests.

8 years agolock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible [Thu, 5 Jan 2017 11:51:36 +0000 (12:51 +0100)]
lock: Provide guarantee to avoid writer starvation for rwlocks.

The rationale is: 1) Read-preferring read-write locks are prone to
writer starvation if the number of reader threads multiplied by the
percentage of time they have the lock held is too high. 2) Write-
preferring read-write locks are the only reliable way to avoid this.
3) There have been reports of 'test-lock' hanging on glibc systems
http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00009.html,
and glibc indeed implements read-preferring rwlocks by default, see
http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html
and https://sourceware.org/bugzilla/show_bug.cgi?id=13701 .

* m4/pthread_rwlock_rdlock.m4: New file.
* m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
* lib/glthread/lock.h [USE_POSIX_THREADS]: Test
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlock initialization on glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlocks altogether on non-glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
[USE_PTH_THREADS]: Use a different implementation of rwlocks altogether.
* lib/glthread/lock.c [USE_POSIX_THREADS]
(glthread_rwlock_init_for_glibc): New function.
[USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update
comment.
[USE_PTH_THREADS]: New implementation of rwlocks.
[USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over
readers.
* modules/lock (Files): Add m4/pthread_rwlock_rdlock.m4.
(Depends-on): Add 'extensions'.
* tests/test-rwlock1.c: New file.
* lock-tests (Files): Add it.
(Depends-on): Add usleep.
(Makefile.am): Add test-rwlock1 to the tests.

8 years agothread: Fix pth port.
Bruno Haible [Thu, 5 Jan 2017 10:04:52 +0000 (11:04 +0100)]
thread: Fix pth port.

* lib/glthread/thread.h (pth_init): Declare weak.
(glthread_create, glthread_sigmask, glthread_join, gl_thread_self,
gl_thread_exit): Make sure Pth is initialized before invoking any Pth
function.

8 years agoparse-datetime: fix debug message on lone year number
Assaf Gordon [Thu, 5 Jan 2017 04:22:22 +0000 (23:22 -0500)]
parse-datetime: fix debug message on lone year number

Input dates such as
  date -d "Apr 11 22:59:00 2011"
are parsed as date (Apr 11, with default year 2016), then time, then a
number (2011). Based on the combination of previously seen tokens,
'digits_to_date_time' determines 2011 to be a year value.

This fixes the debug messages to correctly show the updated year.

Before:
    $ date --debug -d 'Apr 11 22:59:00 2011'
    date: parsed date part: (Y-M-D) 2016-04-11
    date: parsed time part: 22:59:00
    date: parsed number part: today/this/now

After:
    $ ./src/date --debug -d 'Apr 11 22:59:00 2011'
    date: parsed date part: (Y-M-D) 2016-04-11
    date: parsed time part: 22:59:00
    date: parsed number part: year: 2011

* lib/parse-datetime.y (struct parser_control): Add 'year_seen',
'debug_year_seen' member fields.
(digits_to_date_time): Update 'year_seen' as needed.
(debug_print_current_time): Inform about year updates.
(parse_datetime2): Initialize year_seen,debug_year_seen member fields.

8 years agoparse-datetime: fix local timezone debug messages
Assaf Gordon [Thu, 5 Jan 2017 04:19:51 +0000 (23:19 -0500)]
parse-datetime: fix local timezone debug messages

"Local timezones" are strings that affect only DST relative to the
default timezone. The debug messages in parse-datetime.y printed
wrong information when encountering local timezones.

Examples:
Here EET/EEST are time zones ('zone' token, with values +02:00/+03:00):
     TZ=Asia/Tokyo ./src/date --debug -d '2011-12-11 EET'
     TZ=Asia/Tokyo ./src/date --debug -d '2011-06-11 EEST'

When the default timezone relates to the zone strings, EET/EEST are
parsed as local timezones (tLOCAL_ZONE), and only change the DST
value (0/1, respectively):
     TZ=Europe/Helsinki ./src/date --debug -d '2011-12-11 EET'
     TZ=Europe/Helsinki ./src/date --debug -d '2011-06-11 EEST'

* lib/parse-datetime.y (debug_print_current_time): If local timezone was
seen, inform about DST change, don't print actual timezone.
(debug_strfdatetime): If local timezone was seen, use default timezone
(and adjust as needed) instead of using incorrect timezone.
(parse_datetime2): Use correct time-zone source string, and adjust
default timezone as needed.

8 years agoparse-datetime: add debug warning about DST changes
Assaf Gordon [Thu, 5 Jan 2017 04:14:37 +0000 (23:14 -0500)]
parse-datetime: add debug warning about DST changes

Incorrect date arithmetic due to daylight saving time (DST) are a
common (false) bug report in coreutils.
Detect two such cases and print a warning:
1. year/month/day adjustments (performed on 'struct tm'),
   where 'mktime' returns a different isdst value.
2. hour/minute/seconds/ns adjustments (performed on 'time_t'),
   where the result of 'localtime(3)' on the value will return a
   different isdst value.

Note: DST changes could be harmless or unnoticeable.

Examples (with 'TZ=America/New_York'):

Unnoticeable: result is 2016-Dec-14
   $ date -d '2016-06-15 EDT + 6 months' +%b
   Dec

Unnoticeable: result is 2016-Dec-15 11:00:00
   $ date -d '2016-06-15 12:00:00 EDT + 6 months' +%F
   2016-12-15

This is unexpected:
   $ date -d '2016-06-01 EDT + 6 months' +%F
   2016-11-30

The new debug warnings will show:

   $ ./src/date --debug -d '2016-06-01 EDT + 6 months' +%F
   ...
   date: warning: daylight saving time changed after date adjustment
   ...

* lib/parse-datetime.y (parse_datetime2): Detect DST changes, and print
an appropriate warning message.

8 years agoparse-datetime: add debug warning about date arithmetic
Assaf Gordon [Thu, 5 Jan 2017 04:11:33 +0000 (23:11 -0500)]
parse-datetime: add debug warning about date arithmetic

Date arithmetic are done directly on the fields of 'struct tm',
which can result in invalid dates. Normalization with 'mktime(3)'
will then produce a different date - which might cause unexpected results.

Examples:
  '2016-10-31 - 1 month' => 2016-09-31 normalized to 2016-10-01.
  '2016-02-29 + 1 year'  => 2017-02-29 normalized to 2017-03-01.

Note that date normalization is not inherently wrong and not rejected,
as it has legitimate uses:
  '2016-12-29 + 5 days' => 2016-12-34 noramlized to 2017-01-03.

If the user asked to adjust months but 'mday' changed,
or user asked to adjust years but 'month' changed - warn about it.

    $ ./src/date --debug -d '2016-10-31 - 1 month'
    ...
    date: warning: when adding relative months/years, \
                   it is recommended to specify the 15th of the month
    ...
    date: warning: month/year adjustment resulted in shifted dates:
    date:      adjusted Y M D: 2016 09 31
    date:    normalized Y M D: 2010 10 01
    ...

* lib/parse-datetime.y (parse_datetime2): Detect such cases and print
a warning message. Improve recommendation of when to use 15 of the month
or noon for date arithmetic.

8 years agoparse-datetime: fix debug message of relative part after timezone
Assaf Gordon [Thu, 5 Jan 2017 04:07:12 +0000 (23:07 -0500)]
parse-datetime: fix debug message of relative part after timezone

Relative part (e.g '+8 days') after a timezone string was not reported
(was only reported after a timezone number). Due to the parser's structure,
timezone strings with numbers were handled separately.

before:
     # Timezone number + relative part: OK
     $ ./src/date --debug +%F -d '2013-10-30 00:00:00 +00:00 -8 days'
     ...
     date: parsed relative part: -8 day(s)

     # Timezone string + relative part: missing
     $ ./src/date --debug +%F -d '2013-10-30 00:00:00 UTC -8 days'
     [ missing message ]

After: messages are printed in both cases.

* lib/parse-datetime.y ('zone' token): Call debug_print_relative_time.

8 years agoparse-datetime: fix incorrect debug message on lone number
Assaf Gordon [Thu, 5 Jan 2017 04:02:41 +0000 (23:02 -0500)]
parse-datetime: fix incorrect debug message on lone number

A lone number is an absolute value, not a relative time part.

before:
   $ date --debug -d '20130101'
   date: parsed number part: today/this/now

After:
   $ ./src/date --debug -d '20130101'
   date: parsed number part: (Y-M-D) 2013-01-01

* lib/parse-datetime.y ('item'/'number' tokens): Call
'debug_print_current_time' instead of 'debug_print_relative_time'.

8 years agoexec
Karl Berry [Tue, 3 Jan 2017 17:47:53 +0000 (09:47 -0800)]
exec

8 years agobuild-aux/mdate-sh
Karl Berry [Tue, 3 Jan 2017 17:47:08 +0000 (09:47 -0800)]
build-aux/mdate-sh