Bruno Haible [Sat, 5 Sep 2020 13:44:29 +0000 (15:44 +0200)]
uniname/uniname: Fix -Wshorten-64-to-32 warnings.
* lib/uniname/uniname.c (unicode_name_word_lookup): Change type of last
argument to size_t.
(unicode_name_character): Change type of len, n1, n2, n3, words_length,
n to size_t.
Paul Eggert [Tue, 1 Sep 2020 18:14:33 +0000 (11:14 -0700)]
manywarnings: remove -Wchkp and -Wabi from C++ too
Suggested by Reuben Thomas in:
https://lists.gnu.org/r/bug-gnulib/2020-09/msg00001.html
At some point somebody should merge the many other manywarnings-c.m4
changes into manywarnings-c++.m4 too, e.g.,
2020-07-02T00:00:51Z!eggert@cs.ucla.edu.
* m4/manywarnings-c++.m4 (gl_MANYWARN_ALL_GCC_CXX_IMPL):
Remove -Wchkp, -Wabi.
Bruno Haible [Sun, 30 Aug 2020 20:19:05 +0000 (22:19 +0200)]
strerrorname_np: New module.
* lib/string.in.h (strerrorname_np): New declaration.
* lib/strerrorname_np.c: New file.
* m4/strerrorname_np.m4: New file.
* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Test whether strerrorname_np
is declared.
(gl_HEADER_STRING_H_DEFAULTS): Initialize GNULIB_STRERRORNAME_NP,
HAVE_STRERRORNAME_NP, REPLACE_STRERRORNAME_NP.
* modules/string (Makefile.am): Substitute GNULIB_STRERRORNAME_NP,
HAVE_STRERRORNAME_NP, REPLACE_STRERRORNAME_NP.
* modules/strerrorname_np: New file.
* tests/test-string-c++.cc: Verify the signature of strerrorname_np.
* doc/glibc-functions/strerrorname_np.texi: Mention the new module and
the glibc 2.32 bug.
Bruno Haible [Wed, 26 Aug 2020 23:23:55 +0000 (01:23 +0200)]
time_rz: Change configure message.
* m4/time_rz.m4 (gl_TIME_RZ): Say "checking whether localtime works even
near extrema..." instead of "checking whether localtime loops forever
near extrema...".
Bruno Haible [Wed, 26 Aug 2020 23:21:27 +0000 (01:21 +0200)]
stdint: Change configure message.
* m4/stdint.m4 (gl_STDINT_H): Say "checking whether stdint.h works
without ISO C predefines..." instead of "checking whether stdint.h
predates C++11...".
Bruno Haible [Wed, 26 Aug 2020 23:04:36 +0000 (01:04 +0200)]
include_next: Change configure message.
* m4/include_next.m4 (gl_INCLUDE_NEXT): Say "checking whether source
code line length is unlimited..." instead of "checking whether system
header files limit the line length...".
Bruno Haible [Wed, 26 Aug 2020 22:49:28 +0000 (00:49 +0200)]
chdir-long: Change configure message.
* m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Say "checking whether this
system supports file names of any length..." instead of "checking
whether this system has an arbitrary file name length limit...".
Set gl_cv_have_unlimited_file_name_length instead of
gl_cv_have_arbitrary_file_name_length_limit.
* modules/chdir-long (Depends-on, configure.ac): Update accordingly.
Bruno Haible [Wed, 26 Aug 2020 22:42:22 +0000 (00:42 +0200)]
iconv: Change configure message.
* m4/iconv.m4 (AM_ICONV): Say "checking whether iconv is compatible
with its POSIX signature..." instead of "checking for iconv
declaration...". Remove K&R C support.
Paul Eggert [Wed, 26 Aug 2020 22:30:53 +0000 (15:30 -0700)]
getcwd: help the merge back into glibc
This patch was inspired by Adhemerval Zanella’s proposed glibc patches:
https://sourceware.org/pipermail/libc-alpha/2020-August/117294.html
The idea is to make it easier for Gnulib lib/getcwd.c to match
glibc io/getcwd-generic.c.
* lib/getcwd.c [_LIBC]: Do not include pathmax.h.
Include not-cancel.h.
(HAVE_OPENAT, D_INO_IN_DIRENT, HAVE_MSVC_INVALID_PARAMETER_HANDLER)
(HAVE_MINIMALLY_WORKING_GETCWD): Define for the _LIBC case.
(__getcwd, __lstat, __readdir) [!_LIBC]: Remove these macros.
(__close_nocancel_nostatus, __getcwd_generic, stat64, __fstat64)
(__fstatat64, __lstat64, __readdir64, __fdopendir, __openat)
(__rewinddir, __openat64, dirent64) [_LIBC]: New macros.
(__getcwd_generic): Rename from __getcwd.
Use the abovementioned macros for consistency with glibc.
(weak_alias): Remove.
Bruno Haible [Tue, 25 Aug 2020 23:45:49 +0000 (01:45 +0200)]
verify: Avoid warnings when assume(0) is used.
Reported by Mattias Engdegård <mattiase@acm.org> via Paul Eggert in
<https://lists.gnu.org/archive/html/emacs-devel/2020-08/msg00838.html>.
* lib/verify.h (assume): Use __builtin_unreachable if the argument is
the constant 0.
* tests/test-verify.c (f): New function.
(state): New type.
(test_assume_expressions, test_assume_optimization,
test_assume_noreturn): New functions.
Paul Eggert [Mon, 24 Aug 2020 22:19:27 +0000 (15:19 -0700)]
diffseq: new option NOTE_ORDERED
Problem reported by Phil Sainty <https://bugs.gnu.org/42931>.
* NEWS: Mention this.
* lib/diffseq.h (NOTE_ORDERED): New macro.
(IF_LINT2): Remove; no longer needed.
(compareseq): If (!NOTE_ORDERED), recurse on the smaller
subproblem and iterate to do the larger.
Paul Eggert [Sun, 23 Aug 2020 20:14:13 +0000 (13:14 -0700)]
intprops: fix INT_MULTIPLY_WRAPV bit-field bug
The bug occurs when using INT_MULTIPLY_WRAPV (a, b, c) where B
is a bit-field, on older GCC or non-GCC compilers where we do
things ourselves instead of using __builtin_mul_overflow.
Without this fix, INT_MULTIPLY_WRAPV would not compile, due
to applying sizeof to a bit-field.
* lib/intprops.h (_GL_INT_MULTIPLY_RANGE_OVERFLOW):
Promote B before giving it to TYPE_WIDTH, in case B is a bit-field.
Bruno Haible [Sun, 23 Aug 2020 17:37:17 +0000 (19:37 +0200)]
supersede: Avoid a failure when writing to /dev/null in Solaris zones.
Reported by Jörg Sonnenberger <joerg@netbsd.org>
via Thomas Klausner <tk@giga.or.at> in
<https://pkgsrc.se/files.php?messageId=20200812233110.30230FB28@cvs.NetBSD.org>.
* lib/supersede.c (open_supersede): When opening an existing non-regular
file on Solaris, use O_CREAT although it should not be necessary.
Bruno Haible [Sat, 22 Aug 2020 00:22:05 +0000 (02:22 +0200)]
sigdescr_np: New module.
* lib/string.in.h (sigdescr_np): New declaration.
* lib/sigdescr_np.c: New file.
* m4/sigdescr_np.m4: New file.
* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Test whether sigdescr_np is
declared.
(gl_HEADER_STRING_H_DEFAULTS): Initialize GNULIB_SIGDESCR_NP,
HAVE_SIGDESCR_NP.
* modules/string (Makefile.am): Substitute GNULIB_SIGDESCR_NP,
HAVE_SIGDESCR_NP.
* modules/sigdescr_np: New file.
* tests/test-string-c++.cc: Verify the signature of sigdescr_np.
* doc/glibc-functions/sigdescr_np.texi: Mention the new module.
Bruno Haible [Thu, 20 Aug 2020 22:54:18 +0000 (00:54 +0200)]
sigabbrev_np: New module.
* lib/string.in.h (sigabbrev_np): New declaration.
* lib/sigabbrev_np.c: New file.
* m4/sigabbrev_np.m4: New file.
* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Test whether sigabbrev_np is
declared.
(gl_HEADER_STRING_H_DEFAULTS): Initialize GNULIB_SIGABBREV_NP,
HAVE_SIGABBREV_NP.
* modules/string (Makefile.am): Substitute GNULIB_SIGABBREV_NP,
HAVE_SIGABBREV_NP.
* modules/sigabbrev_np: New file.
* tests/test-string-c++.cc: Verify the signature of sigabbrev_np.
* doc/glibc-functions/sigabbrev_np.texi: Mention the new module.
Transform the ProjectQuirks comments into a docstring so that it can
be accessed from python as ProjectQuirks.__doc__ and harmonize
descriptions with the documentation.
* build-aux/vcstocl/projectquirks.py (ProjectQuirks):
Transform comments into a docstring.
* doc/vcs-to-changelog.texi: Sync up description with
comments.
ProjectQuirks is used by external quirks files and importing it from
vcs-to-changelog.py is broken since it was renamed to use hyphens. It
is cleaner to put it in its own file anyway.
* build-aux/vcstocl/projectquirks.py: A new file...
* build-aux/vcs-to-changelog.py (ProjectQuirks): ...to which
we move ProjectQuirks and import the file.
Bruno Haible [Wed, 19 Aug 2020 18:40:20 +0000 (20:40 +0200)]
uchar: Fix compilation errors in C++ mode on OpenBSD.
* lib/uchar.in.h (char16_t, char32_t): Don't define in C++ mode if
CXX_HAS_UCHAR_TYPES is 1.
* m4/uchar.m4 (gl_UCHAR_H): Determine whether the C++ compiler
predefines char16_t and char32_t. Substitute CXX_HAS_UCHAR_TYPES.
* modules/uchar (Makefile.am): Substitute CXX_HAS_UCHAR_TYPES.
Paul Eggert [Mon, 17 Aug 2020 21:47:45 +0000 (14:47 -0700)]
verify: avoid __built_assume on Clang
* lib/verify.h (assume): Do not use Clang’s __builtin_assume, as
Clang 9 incorrectly diagnoses arguments as having side effects
even when they do not. I guess Clang 9 considers any function
call as if it had a side effect here.
Paul Eggert [Mon, 17 Aug 2020 21:45:38 +0000 (14:45 -0700)]
libc-config: avoid Clang’s __diagnose_if__
* lib/cdefs.h (__warndecl, __warnattr, __errordecl):
For now, do not use __diagnose_if__ here, as this fails
on Fedora 31 with Clang 9.0.1, with diagnostic
"/usr/include/bits/stdio2.h:263:9: error: fgets called with bigger
size than length of destination buffer
[-Werror,-Wuser-defined-warnings]". I guess Clang 9 warns even
for functions that are not called?
Paul Eggert [Mon, 17 Aug 2020 19:39:48 +0000 (12:39 -0700)]
careadlinkat: speedup for GCC 10 with GCC_LINT
Inspired by a suggestion by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00155.html
* lib/careadlinkat.c (STACK_BUF_SIZE): New constant.
(readlink_stk): New function, with most of the old careadlinkat
contents and with a new STACK_BUF arg. Inline it in GCC 10
if GCC_LINT.
(careadlinkat): Use the new function for everything but the
stack buffer.
Bruno Haible [Mon, 17 Aug 2020 08:39:03 +0000 (10:39 +0200)]
uchar C++ tests: Fix build error on FreeBSD 12.
* modules/uchar-c++-tests (configure.ac): Test whether <cuchar> exists.
(Makefile.am): Don't include test-uchar-c++2.cc in the compilation if
<cuchar> does not exist.
Bruno Haible [Sun, 16 Aug 2020 16:59:14 +0000 (18:59 +0200)]
Use _Static_assert and static_assert primitives when present on clang.
* lib/cdefs.h (_Static_assert): Don't define as a macro on clang.
* lib/verify.h (_GL_HAVE__STATIC_ASSERT, _GL_HAVE__STATIC_ASSERT1,
_GL_HAVE_STATIC_ASSERT1): Define as appropriate on clang.
Bruno Haible [Sun, 16 Aug 2020 16:44:53 +0000 (18:44 +0200)]
Use __restrict also on clang.
* lib/argp.h (__restrict): Don't define as a macro on clang >= 3.
* lib/glob.in.h (_Restrict_): Use __restrict on clang >= 3.
* lib/unitypes.in.h (_UC_RESTRICT): Likewise.
Bruno Haible [Sun, 16 Aug 2020 10:53:57 +0000 (12:53 +0200)]
C++ tests: Fix link errors on MSVC (regression from 2020-05-31).
* modules/stdio-c++-tests (Makefile.am): Link test-stdio-c++ with
$(LIB_GETRANDOM), needed for the rpl_tmpfile symbol.
* modules/stdlib-c++-tests (Makefile.am): Link test-stdlib-c++ with
$(LIB_GETRANDOM), needed for the mkdtemp and mkstemp symbols.
Paul Eggert [Sat, 15 Aug 2020 23:05:35 +0000 (16:05 -0700)]
nstrftime: be more predictable about errno
This aligns nstrftime better with draft POSIX 202x strftime.
* lib/nstrftime.c: Include errno.h.
(width_add, __strftime_internal): Set errno on failure,
and preserve it on success. Check for mktime_z failure.
* modules/nstrftime (Depends-on): Add errno.
* modules/nstrftime-tests (Depends-on): Add atoll, intprops.
* tests/test-nstrftime.c: Include intprops.h, limits.h.
(errno_test): New test function.
(main): Call it.