Paul Eggert [Fri, 28 Dec 2018 06:22:41 +0000 (22:22 -0800)]
mkfifo: bring back HAVE_MKFIFO macro
* m4/mkfifo.m4 (gl_FUNC_MKFIFO): #define HAVE_MKFIFO as needed.
Problem reported by Andrew Janke in:
https://lists.gnu.org/r/bug-gnulib/2018-12/msg00147.html
v0.1-2213-gae4b73e28 caused a regression in grep-3.2 (no match):
echo '123-x'|LC_ALL=C grep -E '.\bx'
The goal is to revert the first, but reverting it requires to restore
the function deleted in the second. I ran this to restore the deleted
function:
git show v0.1-2281-g95cd86dd7 lib/dfa.c \
| perl -0777 -pe 's/^@@[^\n]*dfaan.*//ms' \
| patch -R -p1
* lib/dfa.c (charclass_context): Restore deleted function.
Reverting the primary commit removes this change:
dfa: Simplify a building state
* lib/dfa.c (build_state): Simplify a building state.
Bruno Haible [Thu, 20 Dec 2018 02:11:34 +0000 (03:11 +0100)]
lchown tests: Be more permissive regarding errno values.
Reported by Ivan Zakharyaschev <imz@altlinux.org>.
* tests/test-lchown.h (test_lchown): Recognize EOPNOTSUPP as an
alternative to ENOSYS.
* modules/lchown-tests (Depends-on): Add 'errno'.
* modules/fchownat-tests (Depends-on): Likewise.
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.