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.
Bruno Haible [Sat, 15 Aug 2020 00:15:26 +0000 (02:15 +0200)]
stdnoreturn: Work around problem with MSVC/clang.
* m4/stdnoreturn.m4 (gl_STDNORETURN_H): On native Windows, include some
system header after <stdnoreturn.h>.
* doc/posix-headers/stdnoreturn.texi: Mention the issue.
Bruno Haible [Fri, 14 Aug 2020 18:03:33 +0000 (20:03 +0200)]
nstrftime: Assume tzset exists.
* lib/nstrftime.c (HAVE_TZSET): Remove macro.
(__strftime_internal): Test my_strftime, not HAVE_TZSET.
* m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Don't test for tzset.
Paul Eggert [Wed, 12 Aug 2020 18:27:48 +0000 (11:27 -0700)]
stdint: port intptr_t to more-recent MinGW
Problem reported by Eli Zaretskii in <https://bugs.gnu.org/36597#106>.
* lib/stdint.in.h (intptr_t, uintptr_t): Do not define on MinGW,
even if _INTPTR_T_DEFINED and _UINTPTR_T_DEFINED are not defined.
Apparently those two macros were removed in mingwrt-3.22
dated 2016-07-14.
Bruno Haible [Wed, 12 Aug 2020 00:24:04 +0000 (02:24 +0200)]
Use __restrict also on clang.
* lib/cdefs.h (__restrict): Don't define as a macro on clang.
(__restrict_arr): On clang, define like on GCC.
* lib/regex.h (_Restrict_): Use '__restrict' also on clang.
(_Restrict_arr_): Use _Restrict_ also on clang.
* lib/spawn.in.h (_Restrict_): Use '__restrict' also on clang.
(_Restrict_arr_): Use _Restrict_ also on clang.
Bruno Haible [Mon, 10 Aug 2020 23:53:13 +0000 (01:53 +0200)]
Use many __attribute__s with clang.
* m4/gnulib-common.m4 (_Noreturn): Use __attribute__ __noreturn__ also
on clang.
* lib/cdefs.h (__glibc_clang_has_attribute, __glibc_clang_has_builtin):
New macros.
(__THROW, __THROWNL, __NTH, __NTHNL): Use __attribute__ __nothrow__ also
on clang.
(__warndecl, __warnattr, __errordecl): Use __attribute__ __diagnose_if__
also on older clang versions.
(__attribute__): Don't define to empty on clang.
(__attribute_malloc__): Use __attribute__ __malloc__ also on clang.
(__attribute_pure__): Use __attribute__ __pure__ also on clang.
(__attribute_const__): Use __attribute__ __const__ also on clang.
(__attribute_used__): Use __attribute__ __used__ also on clang.
(__attribute_noinline__): Use __attribute__ __noinline__ also on clang.
(__attribute_deprecated__): Use __attribute__ __deprecated__ also on
clang.
(__attribute_format_arg__): Use __attribute__ __format_arg__ also on
clang.
(__attribute_format_strfmon__): Use __attribute__ __format__ __strfmon__
also on clang.
(__nonnull): Use __attribute__ __nonnull__ also on clang.
(__attribute_warn_unused_result__): Use __attribute__
__warn_unused_result__ also on clang.
(__always_inline): Use __attribute__ __always_inline__ also on clang.
(__attribute_artificial__): Use __attribute__ __artificial__ also on
clang >= 7.
(__glibc_unlikely, __glibc_likely): Use __builtin_expect also on older
clang versions.
(_Noreturn): Don't redefine on clang >= 3.5.
* lib/arg-nonnull.h (_GL_ARG_NONNULL): Use __attribute__ __nonnull__
also on clang.
* lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Use __attribute__ __pure__ also
on clang.
* lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise.
* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Use __attribute__ __format__
also on clang.
* lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/textstyle.in.h (ostream_printf, ostream_vprintf): Likewise.
* lib/unitypes.in.h (_UC_ATTRIBUTE_CONST): Use __attribute__ __const__
also on clang.
(_UC_ATTRIBUTE_PURE): Use __attribute__ __pure__ also on clang.
* lib/noreturn.h (_GL_NORETURN_FUNC, _GL_NORETURN_FUNCPTR): Use
__attribute__ __noreturn__ also on clang.
* lib/obstack.h (__attribute_noreturn__): Likewise.
* lib/file-set.h (record_file): Use __attribute__ __nonnull__ also on
clang.
* lib/argp-help.c (hol_entry_long_iterate): Use __attribute__
always_inline also on clang.
* tests/test-printf-posix.c (func1, func2, func3, func4): Test also on
clang.
Bruno Haible [Mon, 10 Aug 2020 01:17:06 +0000 (03:17 +0200)]
string: Fix build error in C++ mode with clang (regression from today).
* lib/warn-on-use.h (_GL_WARN_ON_USE_CXX): Expect two rettype
parameters, one for GCC, one for clang.
* lib/c++defs.h (_GL_CXXALIASWARN1_2): Update.
* lib/string.in.h (strchr, strpbrk, strrchr): For clang, pass 'char *'
as return type.
Bruno Haible [Sun, 9 Aug 2020 20:59:26 +0000 (22:59 +0200)]
ftruncate: Use _chsize, not chsize.
* m4/ftruncate.m4 (gl_PREREQ_FTRUNCATE): Test for _chsize, not chsize.
* lib/ftruncate.c: Test HAVE__CHSIZE.
(chsize_nothrow): Use _chsize, not chsize.