Bruno Haible [Sun, 10 May 2020 16:14:38 +0000 (18:14 +0200)]
string: Fix compilation error in C++ mode.
* lib/warn-on-use.h (_GL_WARN_ON_USE_CXX): In C mode, use plain
_GL_WARN_ON_USE.
* lib/string.in.h (strchr, strpbrk, strrchr): Use _GL_WARN_ON_USE_CXX
instead of _GL_WARN_ON_USE.
Paul Eggert [Sat, 9 May 2020 19:00:08 +0000 (12:00 -0700)]
attribute: remove ATTRIBUTE_DEPRECATED
* lib/attribute.h: Improve recently-added comments, mostly
by shortening them (use active voice, etc.).
(ATTRIBUTE_DEPRECATED): Remove, as it duplicates DEPRECATED.
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00089.html
* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Don't override the definition
that usually comes from m4/gnulib-common.m4.
* lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Don't override the definition
that usually comes from m4/gnulib-common.m4.
* lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise.
Bruno Haible [Sat, 9 May 2020 00:55:06 +0000 (02:55 +0200)]
c32rtomb: Avoid compilation failure on Haiku.
* m4/c32rtomb.m4 (gl_FUNC_C32RTOMB): Test for c32rtomb without excluding
inline definitions.
* doc/posix-functions/c32rtomb.texi: Mention the Haiku problem.
Bruno Haible [Sat, 9 May 2020 00:52:48 +0000 (02:52 +0200)]
mbrtoc32: Avoid compilation failure on Haiku.
* m4/mbrtoc32.m4 (gl_CHECK_FUNC_MBRTOC32): New macro.
(gl_FUNC_MBRTOC32, gl_MBRTOC32_SANITYCHECK): Use it instead of
AC_CHECK_FUNCS_ONCE.
* doc/posix-functions/mbrtoc32.texi: Mention the Haiku problem.
Paul Eggert [Wed, 6 May 2020 22:51:10 +0000 (15:51 -0700)]
Fix version-etc glitch on OpenIndiana
Problem reported by Mats Erik Andersson in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00067.html
* lib/version-etc.h (_GL_ATTRIBUTE_SENTINEL): Remove defn
that now clashes with gnulib-common.h. All uses changed.
Paul Eggert [Sat, 2 May 2020 01:12:12 +0000 (18:12 -0700)]
attribute: new module
This simplifies use of GCC and C2X attributes like ‘deprecated’.
* MODULES.html.sh: Add attribute.
* doc/attribute.texi, lib/attribute.h, modules/attribute: New files.
* doc/gnulib.texi (Particular Modules): Add Attributes.
* lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c:
* lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c:
* lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c:
* lib/vasnprintf.c:
Include attribute.h, and let it define FALLTHROUGH.
* lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro.
* lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of
_GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X.
* lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY.
This is a copy since Gawk doesn’t use Gnulib.
* lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that
is incompatible with gl_COMMON_BODY’s. All uses changed.
* lib/fts.c: Include attribte.h, for FALLTHROUGH.
Keep the existing FALLTHROUGH definition since Glibc might use it,
and it does no harm to Gnulib’s FALLTHROUGH.
* lib/fts_.h, lib/inttostr.h:
(__GNUC_PREREQ): Remove; no longer needed.
(__attribute_warn_unused_result__): Remove. All uses
replaced by _GL_ATTRIBUTE_NODISCARD.
* lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h:
* lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed
__attribute__ ((__warn_unused_result__)), for forward
compatibility to C2X.
* lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by
_GL_ATTRIBUTE_NODISCARD.
(_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it.
* lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses
replaced by gl_COMMON_BODY’s implementation, which has a
slightly different signature.
* lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK):
Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD.
* lib/unused-parameter.h (_GL_UNUSED_PARAMETER):
Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED.
No doubt all uses should be replaced, at some point.
* m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro.
(_Noreturn): Use it.
(_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE)
(_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL)
(_GL_ATTRIBUTE_COLD)
(_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR)
(_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE)
(_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT)
(_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS)
(_GL_ATTRIBUTE_MAYBE_UNUSED)
(_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE)
(_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING)
(_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE)
(_GL_ATTRIBUTE_SENTINEL): New macros.
* modules/backup-rename, modules/backupfile, modules/c-vasnprintf:
* modules/fnmatch, modules/freopen-safer, modules/fts:
* modules/mbrtoc32, modules/mbrtowc, modules/nstrftime:
* modules/quotearg, modules/savewd:
* modules/unistdio/u16-u16-vasnprintf:
* modules/unistdio/u16-vasnprintf:
* modules/unistdio/u32-u32-vasnprintf:
* modules/unistdio/u32-vasnprintf:
* modules/unistdio/u8-u8-vasnprintf:
* modules/unistdio/u8-vasnprintf:
* modules/unistdio/ulc-vasnprintf:
* modules/unistr/u8-uctomb, modules/vasnprintf:
(Depends-on:): Add attribute module.
Akim Demaille [Sun, 3 May 2020 06:54:58 +0000 (08:54 +0200)]
bison: rely on bison's %require to check a version requirement
See https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00021.html.
* m4/bison.m4 (gl_PROG_BISON): Let bison itself decide if it it recent
enough of not.
So far it is the only know Yacc tool that supports '%require'.
Other yaccs will actually even choke on seeing the -o option after the
input file name.
* m4/parse-datetime.m4: Simplify gl_PROG_BISON invocation.
Bruno Haible [Sat, 2 May 2020 15:23:01 +0000 (17:23 +0200)]
bison-i18n: Add support for cross-compilation.
Reported by Hongxu Jia <hongxu.jia@windriver.com> in
<https://lists.gnu.org/archive/html/bison-patches/2016-02/msg00000.html>
via Akim Demaille <akim@lrde.epita.fr>.
* m4/bison-i18n.m4 (BISON_I18N): Accept a configure option
--with-bison-prefix=PREFIX and use it to determine BISON_LOCALEDIR.
Don't use bison's --print-localedir option when cross-compiling.
Also, fix an error message and a comment.
* tests/test-posix_spawn5.c: Include findprog.h.
(test): New function, extracted from main.
(main): Invoke it. Also, invoke it with a program name such as
"bin/pwd".
* modules/posix_spawn_file_actions_addfchdir-tests (Depends-on): Add
findprog.
* tests/test-posix_spawn4.c: Include findprog.h.
(test): New function, extracted from main.
(main): Invoke it. Also, invoke it with a program name such as
"bin/pwd".
* modules/posix_spawn_file_actions_addchdir-tests (Depends-on): Add
findprog.
Paul Eggert [Sat, 25 Apr 2020 18:02:53 +0000 (11:02 -0700)]
Tune fts for FTS_LOGICAL+FTS_NOSTAT
From a suggestion by Askar Safin in:
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00074.html
* lib/fts.c (fts_build): If file types are known, optimize
FTS_LOGICAL+FTS_NOSTAT for non-symlinks and non-directories the
same way that we already optimize FTS_PHYSICAL+FTS_NOSTAT for
non-directories.
Bruno Haible [Sun, 19 Apr 2020 15:02:16 +0000 (17:02 +0200)]
vasnprintf: Add support for printing wide characters using escapes.
* lib/vasnprintf.c (ENABLE_WCHAR_FALLBACK): Document optional macro.
(wctomb_fallback): New function.
(local_wctomb): New function.
(local_wcrtomb): New function or macro.
(MAX_ROOM_NEEDED): Adjust estimate for %lc.
(VASNPRINTF): Simplify %ls code by use of local_wcrtomb. Add code for
%lc.
Paul Eggert [Thu, 16 Apr 2020 03:50:32 +0000 (20:50 -0700)]
fts: remove NOSTAT_LEAF_OPTIMIZATION
It caused ‘find’ and ‘du’ to dump core, and it was useful
only for obsolescent Linux filesystems anyway. Problem reported in:
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00068.html
Quite possibly there is still a serious underlying fts bug with
tight-loop-check and mutating file systems, but if so this patch
should cause the bug to be triggered less often.
* lib/fts.c (enum leaf_optimization): Remove
NOSTAT_LEAF_OPTIMIZATION, as it’s problematic.
(S_MAGIC_REISERFS, S_MAGIC_XFS): Remove; no longer needed.
(leaf_optimization): Remove special cases for ReiserFS and XFS.
(fts_read): Remove NOSTAT_LEAF_OPTIMIZATION code.
* lib/fts_.h (struct _ftsent.fts_n_dirs_remaining):
Remove. All uses removed.
Some OS define memset_s instead of explicit_bzero. Use it.
* lib/explicit_bzero.c (__STDC_WANT_LIB_EXT1__): Define.
(explicit_bzero): Use memset_s when available.
* m4/explicit_bzero.m4 (gl_PREREQ_EXPLICIT_BZERO): Test for memset_s.
Bruno Haible [Fri, 10 Apr 2020 13:57:10 +0000 (15:57 +0200)]
findprog, relocatable-prog: Ignore directories during PATH search.
Reported by Frederick Eaton via Dmitry Goncharov in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00003.html>.
* lib/findprog.c (find_in_path): When the file found in a PATH element
is a directory, continue searching.
* modules/findprog (Depends-on): Add sys_stat, stat.
* modules/findprog-lgpl (Depends-on): Likewise.
* lib/progreloc.c (maybe_executable): When the file found in a PATH
element is a directory, continue searching.
* lib/relocwrapper.c: Update comments.
* modules/relocatable-prog-wrapper (Files): Add m4/largefile.m4.
(configure.ac-early): New section.
Bruno Haible [Sat, 28 Mar 2020 14:12:41 +0000 (15:12 +0100)]
dosname: Redirect to 'filename'.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00042.html>.
* lib/dosname.h: Remove all definitions. Just include filename.h.
* modules/dosname (Status, Notice): Mark as deprecated.
(Depends-on): Add 'filename'.
Bruno Haible [Sat, 28 Mar 2020 13:59:24 +0000 (14:59 +0100)]
dosname: Change IS_RELATIVE_FILE_NAME.
* lib/dosname.h (IS_RELATIVE_FILE_NAME): On native Windows, OS/2, DOS,
change the definition so that IS_RELATIVE_FILE_NAME("c:") is false.
* NEWS: Mention the change.
Bruno Haible [Sun, 8 Mar 2020 21:54:02 +0000 (22:54 +0100)]
*printf-posix: Document why it's overridden on some glibc systems.
Reported by Adrian Bunk <bunk@stusta.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00011.html>.
* doc/posix-functions/*printf.texi: Document the problem with the %n
directive on some glibc systems.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N): Adjust
the cross-compilation guesses accordingly.
Paul Eggert [Sat, 7 Mar 2020 19:02:05 +0000 (11:02 -0800)]
open, openat: port to (O_RDWR | O_RDONLY) != 0
Potential portability problem reported by Dan Gohman in:
https://lists.gnu.org/r/bug-gnulib/2020-03/msg00000.html
* lib/open.c (open):
* lib/openat.c (rpl_openat):
Don’t assume O_RDONLY is disjoint from O_RDWR.
Bruno Haible [Sat, 7 Mar 2020 18:56:33 +0000 (19:56 +0100)]
findprog, relocatable-prog: Ignore directories during PATH search.
Reported by Frederick Eaton via Dmitry Goncharov in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00003.html>.
* lib/findprog.c (find_in_path): When the file found in a PATH element
is a directory, continue searching.
* lib/progreloc.c (maybe_executable): Likewise.