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.
Bruno Haible [Mon, 22 Oct 2018 22:06:52 +0000 (00:06 +0200)]
Assume Autoconf >= 2.63.
* DEPENDENCIES: Mention the requirement.
* gnulib-tool (DEFAULT_AUTOCONF_MINVERSION): Bump to 2.63.
(func_get_filelist): Don't list m4/onceonly.m4 any more.
* pygnulib/GLModuleSystem.py (getFiles): Likewise.
* m4/onceonly.m4: Remove file.
Bruno Haible [Mon, 22 Oct 2018 00:38:39 +0000 (02:38 +0200)]
localename: Fine-tune support for per-thread locales on Solaris 11.4.
* lib/localename-table.h: New file, extracted from lib/localename.c.
* lib/localename-table.c: Likewise.
* lib/localename.c: Include localename-table.h.
(get_locale_t_name, newlocale, duplocale, freelocale): Invoke
locale_hash_function instead of pointer_hash.
* modules/localename (Files): Add lib/localename-table.h,
lib/localename-table.c.
(lib_SOURCES): Add localename-table.c.
* m4/intlsolaris.m4 (gt_INTL_SOLARIS): Require AC_CANONICAL_HOST. Test
for Solaris 11.4 locale system only on Solaris. Test for it
independently whether getlocalename_l exists.
* m4/intl.m4 (gt_INTL_SUBDIR_CORE): Don't test for 'uselocale' and
'getlocalename_l'. Instead, invoke gt_INTL_SOLARIS. Set
HAVE_NAMELESS_LOCALES.
* modules/gettext (Files): Add m4/intlsolaris.m4.
Bruno Haible [Mon, 22 Oct 2018 00:34:07 +0000 (02:34 +0200)]
Small update from gettext.
* m4/intl.m4: Update from gettext:
- 2018-01-02: Fix 'ar' invocation when cross-compiling and in 64-bit
mode on AIX.
- 2018-01-02: Don't use -lc explicitly when linking with libtool.
- 2017-05-19: (AM_INTL_SUBDIR): Require AC_C_FLEXIBLE_ARRAY_MEMBER.