Bruno Haible [Tue, 18 Dec 2018 08:59:41 +0000 (09:59 +0100)]
duplocale: Avoid test failure on AIX 7.
* modules/duplocale-tests (Files): Add m4/intl-thread-locale.m4.
(configure.ac): Invoke gt_FUNC_USELOCALE.
* tests/test-duplocale.c: Test HAVE_WORKING_USELOCALE instead of
HAVE_USELOCALE. Assume that nl_langinfo_l only works when uselocale
works.
Bruno Haible [Tue, 18 Dec 2018 08:49:42 +0000 (09:49 +0100)]
localename: Fix test failure on AIX 7.
Reported by Assaf Gordon in
<https://lists.gnu.org/archive/html/sed-devel/2018-12/msg00019.html>.
* m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): New macro.
(gt_INTL_THREAD_LOCALE_NAME): Invoke it. Test gt_cv_func_uselocale_works
instead of ac_cv_func_uselocale.
* lib/localename.c: Test HAVE_WORKING_USELOCALE instead of
HAVE_USELOCALE.
* lib/localename-table.h: Likewise.
* lib/localename-table.c: Likewise.
* tests/test-localename.c: Likewise.
* doc/posix-functions/uselocale.texi: Mention the AIX problem.
Bruno Haible [Sun, 16 Dec 2018 20:31:15 +0000 (21:31 +0100)]
localename: Avoid test failure on some glibc systems.
* tests/test-localename.c (test_locale_name, test_locale_name_posix):
Unset environment variables that might disturb the first setlocale call,
and verify that this setlocale call succeeds.
Bruno Haible [Sun, 16 Dec 2018 09:46:13 +0000 (10:46 +0100)]
obstack, libc-config: Support HP-UX cc in C99 mode.
* lib/obstack.h (__FLEXIBLE_ARRAY_MEMBER): Treat HP-UX cc as a pre-C99
compiler, even when in C99 mode.
* lib/cdefs.h (__flexarr): Likewise.
* lib/gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Update comment.
Bruno Haible [Sun, 16 Dec 2018 06:11:44 +0000 (07:11 +0100)]
localename: Fix test failure on OpenBSD >= 6.2.
* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Test for fake
locale system. Define HAVE_FAKE_LOCALES in this case.
* lib/localename.c (HAVE_GOOD_USELOCALE): New macro. Use it instead of
HAVE_USELOCALE.
* tests/test-localename.c (HAVE_GOOD_USELOCALE): New macro. Use it
instead of HAVE_NEWLOCALE && HAVE_USELOCALE.
* doc/posix-functions/uselocale.texi: Mention OpenBSD problem. Update
platforms list.
* doc/posix-functions/newlocale.texi: Likewise.
* doc/posix-functions/duplocale.texi: Update platforms list.
* doc/posix-functions/freelocale.texi: Likewise.
Jim Meyering [Sat, 15 Dec 2018 18:09:35 +0000 (10:09 -0800)]
dfa: avoid new warnings from gcc
These would prevent building with -Werror and a Dec snapshot of gcc.
* lib/dfa.c (dfaanalyze): Avoid shadowing warnings for "pos".
Rename each inner instance to "p".
(charclass_context): Remove unused static function.
Paul Eggert [Sat, 15 Dec 2018 00:25:13 +0000 (16:25 -0800)]
mkdir-p: improve diagnostic for FUSE mounts
Problem reported by Niklas Hambüchen in:
https://lists.gnu.org/r/bug-gnulib/2018-12/msg00074.html
* lib/mkdir-p.c (make_dir_parents): In diagnostic, prefer stat
errno to mkdir errno if the stat errno is likely more interesting.
Bruno Haible [Fri, 14 Dec 2018 22:07:39 +0000 (23:07 +0100)]
map: New module.
* lib/gl_map.h: New file.
* lib/gl_map.c: New file.
* lib/gl_omap.h (gl_mapkey_dispose_fn, gl_mapvalue_dispose_fn): Avoid
conflict with gl_map.h.
* modules/map: New file.
Bruno Haible [Tue, 11 Dec 2018 19:56:27 +0000 (20:56 +0100)]
rbtree-omap: New module.
* lib/gl_rbtree_omap.h: New file.
* lib/gl_rbtree_omap.c: New file.
* lib/gl_rbtree_ordered.h: Code moved to here from lib/gl_rbtree_oset.c.
Parameterize.
* lib/gl_rbtree_oset.c: Include gl_rbtree_ordered.h.
* modules/rbtree-omap: New file.
* modules/rbtree-oset (Files): Add lib/gl_rbtree_ordered.h.
(Makefile.am): Add gl_rbtree_ordered.h to lib_SOURCES.
Bruno Haible [Tue, 11 Dec 2018 19:56:25 +0000 (20:56 +0100)]
avltree-omap: New module.
* lib/gl_avltree_omap.h: New file.
* lib/gl_avltree_omap.c: New file.
* lib/gl_avltree_ordered.h: Code moved to here from
lib/gl_avltree_oset.c. Parameterize.
* lib/gl_avltree_oset.c: Include gl_avltree_ordered.h.
* lib/gl_anytree_omap.h: New file.
* modules/avltree-omap: New file.
* modules/avltree-oset (Files): Add lib/gl_avltree_ordered.h.
(Makefile.am): Add gl_avltree_ordered.h to lib_SOURCES.
Bruno Haible [Tue, 11 Dec 2018 19:36:35 +0000 (20:36 +0100)]
array-set, linkedhash-set, hash-set: Fix tests.
* tests/test-array_set.c (cmp_objects_in_array): New function.
(check_equals): Use it.
* tests/test-hash_set.c: Likewise.
* tests/test-linkedhash_set.c: Likewise.
Bruno Haible [Mon, 3 Dec 2018 23:53:12 +0000 (00:53 +0100)]
linkedhash-set: New module.
* lib/gl_linkedhash_set.h: New file.
* lib/gl_linkedhash_set.c: New file.
* lib/gl_anyhash_set1.h: New file, based on lib/gl_anyhash_list1.h.
* lib/gl_anyhash_set2.h: New file, based on lib/gl_anyhash_list2.h.
* lib/gl_anyhash_primes.h: New file, extracted from
lib/gl_anyhash_list2.h.
* lib/gl_anyhash_list2.h: Include it.
(primes, next_prime): Remove definitions.
* modules/linkedhash-set: New file.
* modules/avltreehash-list (Files): Add lib/gl_anyhash_primes.h.
(Makefile.am): Add gl_anyhash_primes.h to lib_SOURCES.
* modules/linkedhash-list (Files): Add lib/gl_anyhash_primes.h.
(Makefile.am): Add gl_anyhash_primes.h to lib_SOURCES.
* modules/rbtreehash-list (Files): Add lib/gl_anyhash_primes.h.
(Makefile.am): Add gl_anyhash_primes.h to lib_SOURCES.
Akim Demaille [Fri, 7 Dec 2018 05:26:08 +0000 (06:26 +0100)]
bison: don't force the Yacc mode
Passing -y forces Bison into POSIX YACC mode. This includes reporting
errors when Bison features are used in the grammar file. Some of
these features (such as %expect) were flagged non-yacc recently. Most
of the time, -y is actually used to please Automake's ylwrap which
expects the output to be y.tab.c.
* m4/bison.m4 (gl_BISON): Use `-o y.tab.c` rather than `-y`.
Eric Blake [Thu, 29 Nov 2018 19:33:28 +0000 (13:33 -0600)]
docs: mention printf %m considerations
gcc -Wformat does NOT flag printf("%m") on a BSD system, even though
it prints only "m" instead of the desired GNU/Linux behavior of the
current errno value (you have to use -Wpedantic to flag it, but that's
a rather heavy hammer). Still, it's easy enough (even if verbose)
to write out strerror() usage directly, to the point that gnulib will
probably never provide a module to guarantee %m everywhere.
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88270
Paul Eggert [Thu, 29 Nov 2018 00:10:03 +0000 (16:10 -0800)]
strerror_r-posix: memmove, not memcpy
* lib/strerror_r.c (safe_copy): Use memmove, not memcpy,
since the source and destination might overlap in the call
‘safe_copy (buf, buflen, strerror_r (errnum, buf, buflen))’.
Simplify.
Paul Eggert [Fri, 2 Nov 2018 21:09:35 +0000 (14:09 -0700)]
gnulib-common.m4: port _Noreturn to C++
Problem reported by Akim Demaille in:
https://lists.gnu.org/r/bug-bison/2018-10/msg00067.html
* m4/gnulib-common.m4 (gl_COMMON_BODY): If C++, use [[noreturn]].
Merge adjustments from _Noreturn.h and from glibc into the non-C++
version.
* lib/_Noreturn.h: Match gnulib-common.
Norihiro Tanaka [Mon, 22 Oct 2018 14:51:20 +0000 (23:51 +0900)]
dfa: a state has a set of current positions.
Up to now, a state had a set of follow-on positions. It is replaced a
set of current positions. This change will save memory space.
dfa.c (leaf_set): Remove it.
(struct dfa): Add new member constraints and separates.
(append): New function.
(state_index): Bring constraint from pre-calculated.
(state_separate_contexts): Bring separate contexts from pre-calculated.
Change argument, update callers.
(merge_nfa_state): Pre-calculate constraints for END. and remove END.
No longer END is not used after here.
(dfaoptimize): Initialize added member constraints.
(dfaanalyze): Pre-calculate seprate contexts.
(build_state): Change for this update.
(dfassbuild): Initialize new members .
(dfafree): Free memory for new members.
Norihiro Tanaka [Mon, 22 Oct 2018 14:31:26 +0000 (23:31 +0900)]
dfa: position set sorts increasing order
Change the order of position set from decreasing to increaing, then even
after dfa is optimized, it is guaranteed that the number of a position
is smaller than the subsequent one's number.
dfa.c (insert, merged_constrained, delete): Reverse the direction of an
inequality sign.
(dfaanalyze): Position set sorts increasing order.
Paul Eggert [Thu, 25 Oct 2018 15:33:59 +0000 (08:33 -0700)]
havelib: fix nested ‘configure’ chatter
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Don’t nest
AC_CACHE_CHECK calls, which resulted in confusing output like
“checking for the common suffixes of directories in the library
search path... checking for 64-bit host... no lib,lib”.
Paul Eggert [Thu, 25 Oct 2018 15:25:41 +0000 (08:25 -0700)]
backupfile: tweak for better code
* lib/backupfile.c: Sort include directives, and remove
unnecessary <limits.h> include.
(FALLTHROUGH): New macro, copied from other modules.
(backupfile_internal): Use it to avoid code duplication.
This lets GCC 8.2.1 generate better code by inlining the
call to check_extension.
Paul Eggert [Wed, 24 Oct 2018 02:10:21 +0000 (19:10 -0700)]
backupfile: new dir_fd args
New module opendirat with code taken from fts.
Use this module to let backupfile use a directory file descriptor.
* NEWS: Document the incompatible change.
* lib/backup-find.c (find_backup_file_name):
* lib/backup-rename.c (backup_file_rename):
New arg DIR_FD.
* lib/backupfile.c: Include stdint.h, for SIZE_MAX.
(SIZE_MAX): Remove.
Include opendirat.h rather than dirent--.h.
(check_extension): New args DIR_FD and BASE_MAX. All callers changed.
(numbered_backup): New args DIR_FD and PNEW_FD. All callers changed.
(backupfile_internal): New arg DIR_FD. All callers changed.
* lib/fts.c: Include opendirat.h.
(opendirat): Move to opendirat.c.
* lib/opendirat.c, lib/opendirat.h, modules/opendirat: New files.
* modules/backupfile (Depends-on): Remove dirfd, opendir.
Add opendirat.
* modules/fts (Depends-on): Remove fdopendir, openat-safer.
Add opendirat.