]> Savannah Git Hosting - gnulib.git/log
gnulib.git
4 years agointprops test: Strengthen on clang.
Bruno Haible [Sun, 16 Aug 2020 17:14:43 +0000 (19:14 +0200)]
intprops test: Strengthen on clang.

* tests/test-intprops.c (VERIFY): Use verify_stmt.

4 years agonstrftime: Guide inlining also on clang.
Bruno Haible [Sun, 16 Aug 2020 17:13:57 +0000 (19:13 +0200)]
nstrftime: Guide inlining also on clang.

* lib/nstrftime.c (iso_week_days): Inline also on clang.

4 years agointprops: Avoid bogus "warning: division by zero is undefined" on clang.
Bruno Haible [Sun, 16 Aug 2020 17:12:28 +0000 (19:12 +0200)]
intprops: Avoid bogus "warning: division by zero is undefined" on clang.

* lib/intprops.h (_GL__GENERIC_BOGUS): Define to 1 on clang.

4 years agolog2l: Disable MSVC workaround on clang.
Bruno Haible [Sun, 16 Aug 2020 17:10:32 +0000 (19:10 +0200)]
log2l: Disable MSVC workaround on clang.

* lib/log2l.c (log2l): On clang, use the expression 0.0L/0.0L.

4 years agoargp: Emit a warning also with clang.
Bruno Haible [Sun, 16 Aug 2020 17:09:00 +0000 (19:09 +0200)]
argp: Emit a warning also with clang.

* lib/argp-help.c (__argp_short_program_name): Use #warning also on
clang.

4 years agolibc-config: Enable __REDIRECT macro also on clang.
Bruno Haible [Sun, 16 Aug 2020 17:06:58 +0000 (19:06 +0200)]
libc-config: Enable __REDIRECT macro also on clang.

* lib/cdefs.h (__REDIRECT, __REDIRECT_NTH, __REDIRECT_NTHNL, __ASMNAME,
__ASMNAME2): Define on clang like on GCC.

4 years agoregex: Use initializer shorthand syntax also with clang.
Bruno Haible [Sun, 16 Aug 2020 17:03:49 +0000 (19:03 +0200)]
regex: Use initializer shorthand syntax also with clang.

* lib/regcomp.c (utf8_sb_map): Use the initializer shorthand syntax also
with clang.

4 years agoregex: Use space optimization also with clang.
Bruno Haible [Sun, 16 Aug 2020 17:01:01 +0000 (19:01 +0200)]
regex: Use space optimization also with clang.

* lib/regex_internal.h (re_token_t): Use a single byte for the type also
with clang.

4 years agoUse _Static_assert and static_assert primitives when present on clang.
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.

4 years agoUse 'throw ()' for optimization in C++ mode also on clang.
Bruno Haible [Sun, 16 Aug 2020 16:57:22 +0000 (18:57 +0200)]
Use 'throw ()' for optimization in C++ mode also on clang.

* lib/cdefs.h (__THROW): Define to 'throw ()' also on clang.
* lib/getopt-cdefs.in.h (__THROW): Likewise.
* lib/md5.h (__THROW): Likewise.

4 years agoabsolute-header: Add support for clang.
Bruno Haible [Sun, 16 Aug 2020 16:54:44 +0000 (18:54 +0200)]
absolute-header: Add support for clang.

* modules/absolute-header (Makefile.am): Include '__clang__' in the
HAVE_INCLUDE_NEXT expression.

4 years agoFix "warning: implicitly declaring library function 'strcasecmp'".
Bruno Haible [Sun, 16 Aug 2020 16:51:09 +0000 (18:51 +0200)]
Fix "warning: implicitly declaring library function 'strcasecmp'".

* lib/argp-help.c: Include <strings.h>.

4 years agostdio: Don't break attribute 'scanf' on clang.
Bruno Haible [Sun, 16 Aug 2020 16:47:47 +0000 (18:47 +0200)]
stdio: Don't break attribute 'scanf' on clang.

* lib/stdio.in.h (scanf): Treat clang like GCC.

4 years agoUse __restrict also 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.

4 years agopthread-spin: Use GCC built-ins also on clang.
Bruno Haible [Sun, 16 Aug 2020 16:42:02 +0000 (18:42 +0200)]
pthread-spin: Use GCC built-ins also on clang.

* lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock,
pthread_spin_trylock, pthread_spin_unlock): Use the newer GCC built-ins
also on clang.

4 years agoasyncsafe-spin tests: Update.
Bruno Haible [Sun, 16 Aug 2020 16:41:57 +0000 (18:41 +0200)]
asyncsafe-spin tests: Update.

* tests/test-asyncsafe-spin2.c: Update to match the change in
lib/asyncsafe-spin.c from 2020-08-11.

4 years agosetenv: Use tree code also with clang.
Bruno Haible [Sun, 16 Aug 2020 16:39:33 +0000 (18:39 +0200)]
setenv: Use tree code also with clang.

* lib/setenv.c (USE_TSEARCH): Treat clang like GCC.

4 years agomath: Optimize signbit also on clang.
Bruno Haible [Sun, 16 Aug 2020 16:39:29 +0000 (18:39 +0200)]
math: Optimize signbit also on clang.

* lib/math.in.h (gl_signbitf, gl_signbitd, gl_signbitl): Optimize also
on clang.

4 years agoavltreehash-list, rbtreehash-list: Optimize also on clang.
Bruno Haible [Sun, 16 Aug 2020 16:36:57 +0000 (18:36 +0200)]
avltreehash-list, rbtreehash-list: Optimize also on clang.

* lib/gl_anytreehash_list1.h (add_nodes_to_buckets): Use
__builtin_expect also on clang.

4 years agoFix "warning: 'WSASocketA' is deprecated: Use WSASocketW() instead".
Bruno Haible [Sun, 16 Aug 2020 11:00:59 +0000 (13:00 +0200)]
Fix "warning: 'WSASocketA' is deprecated: Use WSASocketW() instead".

* lib/socket.c: Use WSASocketW, not WSASocketA.

4 years agoFix "warning: format specifies type 'unsigned long'".
Bruno Haible [Sun, 16 Aug 2020 11:00:57 +0000 (13:00 +0200)]
Fix "warning: format specifies type 'unsigned long'".

* tests/test-nonblocking-writer.h (main_writer_loop): Cast dbgfprintf
argument to match the format directive.

4 years agoFix "warning: no case matching constant switch condition '0'".
Bruno Haible [Sun, 16 Aug 2020 11:00:54 +0000 (13:00 +0200)]
Fix "warning: no case matching constant switch condition '0'".

* tests/test-fcntl.c (check_flags): Add a 'default' case.

4 years agoFix "warning: integer overflow in expression".
Bruno Haible [Sun, 16 Aug 2020 11:00:51 +0000 (13:00 +0200)]
Fix "warning: integer overflow in expression".

* tests/test-strtol.c (main): Use an 'unsigned long' expression to
remove a 'long' overflow.

4 years agoFix "warning: "getpagesize" redefined".
Bruno Haible [Sun, 16 Aug 2020 11:00:48 +0000 (13:00 +0200)]
Fix "warning: "getpagesize" redefined".

* tests/test-getcwd.c (getpagesize): Don't redefine if defined as a
macro.

4 years agoFix "warning: implicitly declaring library function 'strncasecmp'".
Bruno Haible [Sun, 16 Aug 2020 11:00:46 +0000 (13:00 +0200)]
Fix "warning: implicitly declaring library function 'strncasecmp'".

* lib/strptime.c: Include <strings.h>.

4 years agoFix "warning: 'snprintf' macro redefined".
Bruno Haible [Sun, 16 Aug 2020 11:00:43 +0000 (13:00 +0200)]
Fix "warning: 'snprintf' macro redefined".

* lib/strerror_r.c (snprintf): Undefine before redefining.

4 years agoFix "warning: address of array 'locale' will always evaluate to 'true'".
Bruno Haible [Sun, 16 Aug 2020 11:00:40 +0000 (13:00 +0200)]
Fix "warning: address of array 'locale' will always evaluate to 'true'".

* lib/nl_langinfo.c (ctype_codeset): Remove redundant NULL test.

4 years agoFix "warning: '__stat64' macro redefined".
Bruno Haible [Sun, 16 Aug 2020 11:00:38 +0000 (13:00 +0200)]
Fix "warning: '__stat64' macro redefined".

* lib/glob.c (__stat64): Undefine also on MSVC/clang.

4 years agoFix "warning: 'format' attribute argument not supported: rpl_printf".
Bruno Haible [Sun, 16 Aug 2020 11:00:35 +0000 (13:00 +0200)]
Fix "warning: 'format' attribute argument not supported: rpl_printf".

* lib/stdio.in.h (printf): Treat clang like GCC.

4 years agoFix "warning: attribute declaration must precede definition" with clang.
Bruno Haible [Sun, 16 Aug 2020 11:00:17 +0000 (13:00 +0200)]
Fix "warning: attribute declaration must precede definition" with clang.

* lib/math.in.h (acosl, asinl, atanl, ceill, cosl, expl, fabsf, fabsl,
floorl, fmodl, frexpf, frexpl, hypotf, hypotl, ldexpf, ldexpl, logl,
log10l, modfl, sinl, sqrtl, tanl): Disable _GL_CXXALIASWARN invocation
on non-glibc systems.
* lib/netdb.in.h (gai_strerror): Likewise.
* lib/stdio.in.h (snprintf, vfscanf, vscanf, vsnprintf): Likewise.
* lib/sys_stat.in.h (fstat): Likewise.
* lib/utime.in.h (utime): Likewise.

4 years agoFix undesired warnings.
Bruno Haible [Sun, 16 Aug 2020 11:00:05 +0000 (13:00 +0200)]
Fix undesired warnings.

* lib/sys_select.in.h: Disable all _GL_WARN_ON_USE invocations with
clang.

4 years agoC++ tests: Fix link errors on MSVC (regression from 2020-05-31).
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.

4 years agoDon't use Autoconf quadrigraphs.
Bruno Haible [Sun, 16 Aug 2020 10:47:55 +0000 (12:47 +0200)]
Don't use Autoconf quadrigraphs.

* m4/alloca.m4 (_AC_LIBOBJ_ALLOCA): Use '#' instead of the corresponding
Autoconf quadrigraph.
* m4/free.m4 (gl_FUNC_FREE): Likewise.
* m4/getloadavg.m4 (gl_PREREQ_GETLOADAVG): Likewise.
* m4/largefile.m4 (_AC_SYS_LARGEFILE_TEST_INCLUDES,
_AC_SYS_LARGEFILE_MACRO_VALUE): Likewise.
* m4/longlong.m4 (AC_TYPE_LONG_LONG_INT): Likewise.
* m4/math_h.m4 (gl_MATH_H): Likewise.
* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Likewise.

4 years agoFix quoting of AC_LANG_PROGRAM arguments.
Bruno Haible [Sun, 16 Aug 2020 10:28:42 +0000 (12:28 +0200)]
Fix quoting of AC_LANG_PROGRAM arguments.

* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Quote the AC_LANG_PROGRAM
arguments through [[...]].
* m4/fpending.m4 (gl_FUNC_FPENDING): Likewise.
* m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise.
* m4/fseeko.m4 (gl_FUNC_FSEEKO): Likewise.
* m4/ld-output-def.m4 (gl_LD_OUTPUT_DEF): Likewise.
* m4/ld-version-script.m4 (gl_LD_VERSION_SCRIPT): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/mountlist.m4 (gl_MOUNTLIST): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Likewise.
* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Likewise.
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Likewise.
* m4/wcstok.m4 (gl_FUNC_WCSTOK): Likewise.
* m4/wctype_h.m4 (gl_WCTYPE_H): Likewise.

4 years agoAssume autoconf >= 2.64.
Bruno Haible [Sun, 16 Aug 2020 10:12:32 +0000 (12:12 +0200)]
Assume autoconf >= 2.64.

* gnulib-tool (DEFAULT_AUTOCONF_MINVERSION): Set to 2.64.
* DEPENDENCIES: Require Autoconf 2.64 or newer.
* NEWS: Mention the changed requirement.
* m4/00gnulib.m4 (_m4_divert_diversion, AC_DEFUN_ONCE): Remove macros.
* m4/gnulib-common.m4 (AS_VAR_IF, AS_VAR_COPY): Remove macros.
* m4/absolute-header.m4 (gl_ABSOLUTE_HEADER): Quote pushdef'ed
variables.
* m4/include_next.m4 (gl_NEXT_HEADERS_INTERNAL): Likewise.
* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Likewise.
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Likewise.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS(C), gl_UNKNOWN_WARNINGS_ARE_ERRORS(C++),
gl_UNKNOWN_WARNINGS_ARE_ERRORS(Objective C)): Define through AC_DEFUN.
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C), gl_MANYWARN_ALL_GCC(C++)):
Likewise.
* m4/iconv.m4 (AM_ICONV): Define through AC_DEFUN_ONCE directly.
* m4/libunistring.m4 (gl_LIBUNISTRING): Likewise.
* m4/configmake.m4: Update comment.

4 years agosys_ioctl: Simplify.
Bruno Haible [Sun, 16 Aug 2020 09:00:36 +0000 (11:00 +0200)]
sys_ioctl: Simplify.

* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Remove confusing use of
AC_INCLUDES_DEFAULT.

4 years agoFix quoting of AC_LANG_SOURCE arguments.
Bruno Haible [Sun, 16 Aug 2020 06:37:39 +0000 (08:37 +0200)]
Fix quoting of AC_LANG_SOURCE arguments.

* m4/printf.m4 (gl_PRINTF_ENOMEM): Fix an m4 quoting bug in the
GL_NOCRASH expansion.
* m4/locale-ar.m4 (gt_LOCALE_AR): Simplify m4 quoting.
* m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise.
* m4/locale-ja.m4 (gt_LOCALE_JA): Likewise.
* m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise.
* m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise.

4 years agonstrftime: be more predictable about errno
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.

4 years agocanonicalize: Fix a problem of the autoconf test on MSVC/clang.
Bruno Haible [Sat, 15 Aug 2020 16:59:30 +0000 (18:59 +0200)]
canonicalize: Fix a problem of the autoconf test on MSVC/clang.

* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Remove undesired file
from dependency analysis first.

4 years agoDetermine asm output option and filename suffix for MSVC/clang.
Bruno Haible [Sat, 15 Aug 2020 16:39:06 +0000 (18:39 +0200)]
Determine asm output option and filename suffix for MSVC/clang.

* m4/asm-underscore.m4 (gl_C_ASM): Distinguish clang from cl and
clang-cl.

4 years agodoc: Update for MSVC/clang.
Bruno Haible [Sat, 15 Aug 2020 15:52:24 +0000 (17:52 +0200)]
doc: Update for MSVC/clang.

* doc/*-functions/*printf.texi: Mention that MSVC/clang has two bugs
that MSVC 14 does not have.

4 years agoRevert autoupdate's revert.
Bruno Haible [Sat, 15 Aug 2020 15:54:45 +0000 (17:54 +0200)]
Revert autoupdate's revert.

* config/srclist.txt: Mark mktime.c as needing sync with glibc.

4 years agoautoupdate
Karl Berry [Sat, 15 Aug 2020 15:37:14 +0000 (08:37 -0700)]
autoupdate

4 years agofrexpl: Fix configuration test result on MSVC.
Bruno Haible [Sat, 15 Aug 2020 15:23:02 +0000 (17:23 +0200)]
frexpl: Fix configuration test result on MSVC.

* m4/frexpl.m4 (gl_FUNC_FREXPL_WORKS): Avoid a division by a constant
zero.

4 years agoSupport compiling without -loldnames on native Windows.
Bruno Haible [Sat, 15 Aug 2020 14:54:17 +0000 (16:54 +0200)]
Support compiling without -loldnames on native Windows.

* m4/gnulib-common.m4 (GL_MDA_DEFINES, _GL_MDA_DEFINES): New macros.
* m4/chown.m4 (AC_FUNC_CHOWN): In the test programs, use GL_MDA_DEFINES.
(gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise.
* m4/dup.m4 (gl_FUNC_DUP): Likewise.
* m4/dup2.m4 (gl_FUNC_DUP2): Likewise.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Likewise.
* m4/fchownat.m4 (gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Likewise.
* m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise.
* m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise.
* m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise.
* m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Likewise.
* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise.
* m4/freopen.m4 (gl_FUNC_FREOPEN): Likewise.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Likewise.
* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise.
* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise.
* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL, gl_FUNC_GETCWD_SIGNATURE):
Likewise.
* m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/lseek.m4 (gl_FUNC_LSEEK): Likewise.
* m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Likewise.
* m4/open-slash.m4 (gl_OPEN_TRAILING_SLASH_BUG): Likewise.
* m4/poll.m4 (gl_FUNC_POLL): Likewise.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise.
* m4/pread.m4 (gl_FUNC_PREAD): Likewise.
* m4/pselect.m4 (gl_FUNC_PSELECT): Likewise.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Likewise.
* m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise.
* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
* m4/pwrite.m4 (gl_FUNC_PWRITE): Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/select.m4 (gl_FUNC_SELECT): Likewise.
* m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise.
* m4/strncat.m4 (gl_FUNC_STRNCAT): Likewise.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise.
* m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/utimens.m4 (gl_UTIMENS): Likewise.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
* m4/utimes.m4 (gl_FUNC_UTIMES): Likewise.
* m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): On native Windows, don't
test for getcwd.
* m4/utime.m4 (gl_FUNC_UTIME): On native Windows, don't test for utime.
* m4/wcsdup.m4 (gl_FUNC_WCSDUP): To test for wcsdup, use a test program
with GL_MDA_DEFINES.
* lib/c++defs.h (_GL_CXXALIAS_MDA): New macro.
* lib/fcntl.in.h (creat, open):  On native Windows, use the underscore-
prefixed symbol.
* lib/search.in.h (lfind, lsearch): Likewise.
* lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
Likewise.
* lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
* lib/string.in.h (memccpy, strdup): Likewise.
* lib/sys_stat.in.h (chmod, umask): Likewise.
* lib/time.in.h (tzset): Likewise.
* lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
read, rmdir, swab, unlink, write): Likewise.
* lib/utime.in.h (utime): Likewise.
* lib/wchar.in.h (wcsdup): Likewise.
* lib/math.in.h (j0, j1, jn, y0, y1, yn):  Likewise.
(isfinite, isinf, isnan, signbit): On native Windows, don't define as an
rpl_-prefixed macro.
* lib/canonicalize-lgpl.c (__getcwd): On native Windows, use _getcwd.
* lib/close.c (close_nothrow): On native Windows, use _close.
* lib/creat.c (orig_creat): On native Windows, use _creat.
* lib/dup.c (dup_nothrow): On native Windows, use _dup.
* lib/dup2.c (dup2_nothrow): Use _dup2.
* lib/fdopen.c (fdopen_nothrow): On native Windows, use _fdopen.
* lib/getcwd-lgpl.c: On native Windows, use _getcwd.
* lib/getcwd.c (getcwd_nothrow): Use _getcwd also on mingw.
* lib/open.c (orig_open): On native Windows, use _open.
* lib/read.c (read_nothrow): Use _read.
* lib/rmdir.c: On native Windows, use _rmdir.
* lib/unlink.c: On native Windows, use _unlink.
* lib/write.c (write_nothrow): Use _write.
* lib/sys_select.in.h (close): With clang, don't attach a warning on an
undefined symbol.
* lib/sys_socket.in.h (close): Likewise.
* lib/sys_time.in.h (close): Likewise.
* tests/test-spawn-pipe-child.c: On native Windows, use _fdopen.

4 years agoFix "unknown pragma ignored" warnings with clang on native Windows.
Bruno Haible [Sat, 15 Aug 2020 08:27:30 +0000 (10:27 +0200)]
Fix "unknown pragma ignored" warnings with clang on native Windows.

* lib/cbrt.c: Don't use '#pragma fenv_access (off)' with clang.
* lib/cbrtf.c: Likewise.
* lib/ceil.c: Likewise.
* lib/floor.c: Likewise.
* lib/fma.c: Likewise.
* lib/fmod.c: Likewise.
* lib/rint.c: Likewise.
* lib/round.c: Likewise.
* lib/trunc.c: Likewise.
* tests/test-ceil2.c: Likewise.
* tests/test-ceilf2.c: Likewise.
* tests/test-floor2.c: Likewise.
* tests/test-floorf2.c: Likewise.
* tests/test-trunc2.c: Likewise.
* tests/test-truncf2.c: Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.

4 years agoFix compilation errors in C++ mode with clang on native Windows.
Bruno Haible [Sat, 15 Aug 2020 07:55:18 +0000 (09:55 +0200)]
Fix compilation errors in C++ mode with clang on native Windows.

* lib/pthread.in.h (pthread_*): Disable _GL_CXXALIASWARN invocation on
non-glibc systems.
* lib/sched.in.h (sched_yield): Likewise.

4 years agostdnoreturn: Work around problem with MSVC/clang.
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.

4 years agoutime-h: Generate an utime.h file always.
Bruno Haible [Fri, 14 Aug 2020 22:14:14 +0000 (00:14 +0200)]
utime-h: Generate an utime.h file always.

* modules/utime-h (Makefile.am): Generate utime.h always.
* m4/utime_h.m4 (gl_UTIME_H): Don't set UTIME_H. Don't define
GL_GENERATE_UTIME_H.

4 years agomktime, mktime-internal: Remove obsolete code.
Bruno Haible [Fri, 14 Aug 2020 19:13:16 +0000 (21:13 +0200)]
mktime, mktime-internal: Remove obsolete code.

* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Don't #undef putenv.

4 years agogetcwd: Remove obsolete code.
Bruno Haible [Fri, 14 Aug 2020 18:48:09 +0000 (20:48 +0200)]
getcwd: Remove obsolete code.

* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don't #undef mkdir.
* m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise.

4 years agotzset: Assume the function exists.
Bruno Haible [Fri, 14 Aug 2020 18:06:32 +0000 (20:06 +0200)]
tzset: Assume the function exists.

* lib/time.in.h (tzset): Assume HAVE_TZSET is 1.
* lib/tzset.c: Define rpl_tzset, not tzset. Assume HAVE_TZSET is 1.
* modules/tzset (configure.ac): Don't test HAVE_TZSET.
* m4/tzset.m4 (gl_FUNC_TZSET): Don't test for tzset. Don't set
HAVE_TZSET.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Don't initialize HAVE_TZSET.
* modules/time (Makefile.am): Don't substitute HAVE_TZSET.

4 years agonstrftime: Assume tzset exists.
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.

4 years agomktime, mktime-internal: Assume tzset exists.
Bruno Haible [Fri, 14 Aug 2020 18:02:07 +0000 (20:02 +0200)]
mktime, mktime-internal: Assume tzset exists.

* lib/mktime.c (my_tzset): Assume HAVE_TZSET is 1.
* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Don't test for tzset.

4 years agostrdup: Assume the function exists.
Bruno Haible [Fri, 14 Aug 2020 17:51:56 +0000 (19:51 +0200)]
strdup: Assume the function exists.

* m4/strdup.m4 (gl_FUNC_STRDUP, gl_FUNC_STRDUP_POSIX): Don't test
whether strdup exists.
* modules/strdup (Files): Remove lib/strdup.c.
(configure.ac): Don't compile strdup.c.
* modules/strdup-posix (Depends-on, configure.ac): Don't test
ac_cv_func_strdup.
* doc/posix-functions/strdup.texi: Update.
* lib/unistr/u8-strdup.c: Assume HAVE_STRDUP is 1.
* modules/unistr/u8-strdup (Files): Remove lib/unistr/u-strdup.h.
(Depends-on): Remove unistr/u8-strlen.

4 years agosys_random: Work around an uClibc bug.
Bruno Haible [Thu, 13 Aug 2020 15:49:35 +0000 (17:49 +0200)]
sys_random: Work around an uClibc bug.

Reported by akater <nuclearspace@gmail.com>
via Stefan Kangas <stefan@marxist.se>
in <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42236>.

* lib/sys_random.in.h: On uClibc, include <stddef.h> first.
* m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Update comment.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Likewise.
* doc/glibc-headers/sys_random.texi: Mention the uClibc bug.

4 years agoAvoid implicit conversion from 'unsigned int' to 'int' in initializers.
Bruno Haible [Thu, 13 Aug 2020 00:06:09 +0000 (02:06 +0200)]
Avoid implicit conversion from 'unsigned int' to 'int' in initializers.

Reported by Florian Weimer in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00086.html>.

* lib/gen-uni-tables.c (output_predicate): Change the element type of
the level3 array to 'unsigned int'.
* lib/unictype/bitmap.h (bitmap_lookup): Access an 'unsigned int'.
* lib/unictype/categ_*.h: Regenerated.
* lib/unictype/ctype_*.h: Regenerated.
* lib/unictype/pr_*.h: Regenerated.
* lib/unictype/sy_*.h: Regenerated.
* lib/unicase/cased.h: Regenerated.
* lib/unicase/ignorable.h: Regenerated.

4 years agostdint: port intptr_t to more-recent MinGW
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.

4 years agothread-optim: Export function-like macros only.
Bruno Haible [Wed, 12 Aug 2020 17:59:47 +0000 (19:59 +0200)]
thread-optim: Export function-like macros only.

Suggested by Paul Eggert.

* lib/thread-optim.h (gl_multithreaded): New macro.
(IF_MT_DECL, IF_MT): Remove macros.
* doc/multithread.texi (Multithreading Optimizations): Add a small
example.
* lib/fatal-signal.c: Update all uses.
* lib/clean-temp.c: Likewise.
* lib/localename.c: Likewise.
* modules/localename (Depends-on): Add stdbool.

4 years agoRevert autoupdate's revert.
Bruno Haible [Wed, 12 Aug 2020 18:23:00 +0000 (20:23 +0200)]
Revert autoupdate's revert.

* config/srclist.txt: Mark regex.h as needing sync with glibc.

4 years agoautoupdate
Karl Berry [Wed, 12 Aug 2020 17:12:13 +0000 (10:12 -0700)]
autoupdate

4 years agothread-optim: Fix a compiler warning.
Bruno Haible [Wed, 12 Aug 2020 00:42:32 +0000 (02:42 +0200)]
thread-optim: Fix a compiler warning.

* lib/thread-optim.h (IF_MT_DECL): Define differently.

4 years agoUse __restrict also on clang.
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.

4 years agoUse flexible array syntax also on clang.
Bruno Haible [Tue, 11 Aug 2020 19:59:15 +0000 (21:59 +0200)]
Use flexible array syntax also on clang.

* lib/cdefs.h (__flexarr, __glibc_c99_flexarr_available): For clang,
define like for GCC 3.

4 years agofcntl: On native Windows, use _setmode, not setmode.
Bruno Haible [Tue, 11 Aug 2020 19:25:45 +0000 (21:25 +0200)]
fcntl: On native Windows, use _setmode, not setmode.

* lib/fcntl.c (dupfd): Use _setmode, not setmode.
* lib/binary-io.h: Update comment.
* tests/test-cloexec.c: Call set_binary_mode, not setmode.
* tests/test-dup2.c: Likewise.
* tests/test-dup-safer.c: Likewise.
* tests/test-fcntl.c: Likewise.

4 years agoexecute, spawn-pipe: Use _spawnvpe, not spawnvpe.
Bruno Haible [Tue, 11 Aug 2020 18:55:52 +0000 (20:55 +0200)]
execute, spawn-pipe: Use _spawnvpe, not spawnvpe.

* lib/execute.c (execute): Use _spawnvpe, not spawnvpe.
* lib/spawn-pipe.c (create_pipe): Likewise.
* tests/test-nonblocking-pipe-main.c (main): Likewise.
* tests/test-nonblocking-socket-main.c (main): Likewise.
* lib/wait-process.c: Update comment.
* doc/posix-functions/fork.texi: Update.

4 years agoasyncsafe-spin: Use GCC built-ins also on clang.
Bruno Haible [Tue, 11 Aug 2020 17:11:41 +0000 (19:11 +0200)]
asyncsafe-spin: Use GCC built-ins also on clang.

* lib/asyncsafe-spin.c (asyncsafe_spin_init, do_lock, do_unlock): Use
the newer GCC built-ins also on clang.

4 years agoUse expression statements also on clang.
Bruno Haible [Tue, 11 Aug 2020 16:36:25 +0000 (18:36 +0200)]
Use expression statements also on clang.

* lib/cdefs.h (__extension__): Don't define to empty on clang.
* lib/obstack.h (__extension__): Likewise.
(obstack_object_size, obstack_room, obstack_make_room, obstack_empty_p,
obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow,
obstack_int_grow, obstack_ptr_grow_fast, obstack_int_grow_fast,
obstack_blank, obstack_alloc, obstack_copy, obstack_copy0,
obstack_finish, obstack_free): Enable as optimized macros also on clang.
* lib/fpucw.h (fpucw_t etc.): Enable the definitions also on clang.

4 years agoUse many __attribute__s with 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.

4 years agoc-ldtoastr tests: Fix test failure.
Bruno Haible [Mon, 10 Aug 2020 17:40:07 +0000 (19:40 +0200)]
c-ldtoastr tests: Fix test failure.

* tests/test-c-ldtoastr.c (main): Support platforms where 'long double'
is longer than 'double'.

4 years agoRevert autoupdate's revert.
Bruno Haible [Mon, 10 Aug 2020 17:44:24 +0000 (19:44 +0200)]
Revert autoupdate's revert.

* config/srclist.txt: Mark intprops.h as needing sync with glibc.

4 years agoautoupdate
Karl Berry [Mon, 10 Aug 2020 15:16:37 +0000 (08:16 -0700)]
autoupdate

4 years agostring: Fix build error in C++ mode with clang (regression from today).
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.

4 years agoftruncate: Use _chsize, not chsize.
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.

4 years agoSilence warnings from clang 10 with -Wimplicit-fallthrough.
Bruno Haible [Sun, 9 Aug 2020 18:09:36 +0000 (20:09 +0200)]
Silence warnings from clang 10 with -Wimplicit-fallthrough.

* lib/dfa.c (FALLTHROUGH): Use __attribute__ __fallthrough__ also on
clang >= 10.
* lib/fnmatch.c (FALLTHROUGH): Likewise.
* lib/fts.c (FALLTHROUGH): Likewise.
* tests/macros.h (FALLTHROUGH): Likewise.
* lib/regex_internal.h (FALLTHROUGH): Likewise.
* config/srclist.txt: Mark it as needing sync with glibc.

4 years agostdbool tests: Enable the stricter tests also on clang.
Bruno Haible [Sun, 9 Aug 2020 16:55:26 +0000 (18:55 +0200)]
stdbool tests: Enable the stricter tests also on clang.

* tests/test-stdbool.c (ADDRESS_CHECK_OKAY): Define also on clang.
(e): Enable the address-to-bool conversion test also on clang.

4 years agocount-one-bits: Use __builtin_popcount{,l,ll} on clang.
Bruno Haible [Sun, 9 Aug 2020 16:33:17 +0000 (18:33 +0200)]
count-one-bits: Use __builtin_popcount{,l,ll} on clang.

* lib/count-one-bits.h (COUNT_ONE_BITS): Use the GCC built-in.

4 years agoUse attribute __aligned__ with clang.
Bruno Haible [Sun, 9 Aug 2020 16:12:36 +0000 (18:12 +0200)]
Use attribute __aligned__ with clang.

* lib/stdalign.in.h (_Alignas): Treat clang like GCC.
* lib/stddef.in.h (_GL_STDDEF_ALIGNAS): Likewise.

4 years agoUse __alignof__ with clang.
Bruno Haible [Sun, 9 Aug 2020 13:58:10 +0000 (15:58 +0200)]
Use __alignof__ with clang.

* m4/stddef_h.m4 (gl_STDDEF_H): Test the alignment of max_align_t also
on clang.
* lib/alignof.h (alignof_type): Use __alignof__ also on clang.
* lib/stdalign.in.h (_Alignof): Don't activate the GCC workaround on
clang.
* lib/malloca.h (sa_alignof): Use __alignof__ also on clang.
* lib/bitset/list.c (lbitset_elt_alloc): Use __alignof__ also on clang.
* lib/bitset/table.c (tbitset_elt_alloc): Likewise.
* tests/test-stddef.c: Very the behaviour of __alignof__ also on clang.

4 years agoignore-value: Simplify on clang.
Bruno Haible [Sun, 9 Aug 2020 13:07:28 +0000 (15:07 +0200)]
ignore-value: Simplify on clang.

* lib/ignore-value.h (ignore_value): With clang, no need to use the GCC
workaround.

4 years agoUse __typeof__ with clang.
Bruno Haible [Sun, 9 Aug 2020 13:01:23 +0000 (15:01 +0200)]
Use __typeof__ with clang.

* m4/stdint.m4 (gl_STDINT_H): Check for SIZE_MAX also on
"clang -std=gnu99".
* lib/intprops.h (_GL_HAVE___TYPEOF__): Define to 1 also on clang.
* tests/test-stdint.c (verify_same_types): Enable the check also on
clang.

4 years agoAdd ability to emit user-defined warnings and errors with clang.
Bruno Haible [Sun, 9 Aug 2020 12:51:56 +0000 (14:51 +0200)]
Add ability to emit user-defined warnings and errors with clang.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_ATTRIBUTE_ERROR,
_GL_ATTRIBUTE_WARNING using an attribute for clang.
* lib/warn-on-use.h (_GL_WARN_ON_USE, _GL_WARN_ON_USE_ATTRIBUTE,
_GL_WARN_ON_USE_CXX): Define using an attribute for clang.
* lib/cdefs.h (__warndecl, __warnattr, __errordecl): Define using an
attribute for clang.

4 years agointprops: Fix typo in comment.
Bruno Haible [Sun, 9 Aug 2020 11:28:36 +0000 (13:28 +0200)]
intprops: Fix typo in comment.

* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P): Fix typo in comment.

4 years agoUse __builtin_signbit* with clang.
Bruno Haible [Sun, 9 Aug 2020 10:36:37 +0000 (12:36 +0200)]
Use __builtin_signbit* with clang.

* lib/math.in.h (signbit): Use __builtin_signbit{,f,l} also on clang.
* m4/signbit.m4 (gl_SIGNBIT): Use __builtin_signbit{,f,l} also on clang.
Set REPLACE_SIGNBIT_USING_BUILTINS, not REPLACE_SIGNBIT_USING_GCC.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize
REPLACE_SIGNBIT_USING_BUILTINS, not REPLACE_SIGNBIT_USING_GCC.
* modules/math (Makefile.am): Substitute REPLACE_SIGNBIT_USING_BUILTINS,
not REPLACE_SIGNBIT_USING_GCC.

4 years agoUse __builtin_isnan with clang.
Bruno Haible [Sun, 9 Aug 2020 10:09:17 +0000 (12:09 +0200)]
Use __builtin_isnan with clang.

* lib/isnanf-nolibm.h (isnanf): Use the GCC built-in __builtin_isnan,
not __builtin_isnanf. Also on clang.
* m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_ISNANF_WORKS): Use the GCC
built-in __builtin_isnan, not __builtin_isnanf. Also on clang.
* lib/isnand-nolibm.h (isnand): With clang, use the GCC built-in.
* m4/isnand.m4 (gl_HAVE_ISNAND_IN_LIBM): With clang, use the GCC
built-in.
* lib/isnanl-nolibm.h (isnanf): Use the GCC built-in __builtin_isnan,
not __builtin_isnanl. Also on clang.
* m4/isnanl.m4 (gl_HAVE_ISNANL_NO_LIBM, gl_FUNC_ISNANL_WORKS): Use the
GCC built-in __builtin_isnan, not __builtin_isnanl. Also on clang.
* lib/math.in.h (__has_builtin): Remove macro.
(isnanf, gl_isnan_f): Use the GCC built-in __builtin_isnan, not
__builtin_isnanf. Also on clang.
(isnand, gl_isnan_d): With clang, use the GCC built-in.
(isnanl, gl_isnan_l): Use the GCC built-in __builtin_isnan, not
__builtin_isnanl. Also on clang.
(isnan): Use the GCC built-in __builtin_isnan in all three cases. Also
on clang.

4 years agothread-optim: Fix logic error.
Bruno Haible [Sun, 9 Aug 2020 09:31:48 +0000 (11:31 +0200)]
thread-optim: Fix logic error.

Reported by Paul Eggert.

* lib/thread-optim.h (IF_MT): Fix logic error.

4 years agolocalename: Use module 'thread-optim'.
Bruno Haible [Sat, 8 Aug 2020 20:11:50 +0000 (22:11 +0200)]
localename: Use module 'thread-optim'.

* lib/localename.c: Include thread-optim.h.
(struniq): Use IF_MT macro.
* modules/localename (Depends-on): Add thread-optim.

4 years agoclean-temp: Use module 'thread-optim'.
Bruno Haible [Sat, 8 Aug 2020 20:09:09 +0000 (22:09 +0200)]
clean-temp: Use module 'thread-optim'.

* lib/clean-temp.c: Include thread-optim.h.
(register_temporary_file, unregister_temporary_file, create_temp_dir,
register_temp_file, unregister_temp_file, register_temp_subdir,
unregister_temp_subdir, cleanup_temp_dir_contents, register_fd,
close_temp, fclose_variant_temp): Use IF_MT macro.
* modules/clean-temp (Depends-on): Add thread-optim.

4 years agofatal-signal: Use module 'thread-optim'.
Bruno Haible [Sat, 8 Aug 2020 20:05:25 +0000 (22:05 +0200)]
fatal-signal: Use module 'thread-optim'.

* lib/fatal-signal.c: Include thread-optim.h.
(at_fatal_signal, block_fatal_signals, unblock_fatal_signals): Use IF_MT
macro.
* modules/fatal-signal (Depends-on): Add thread-optim.

4 years agoNew module 'thread-optim'.
Bruno Haible [Sat, 8 Aug 2020 17:47:28 +0000 (19:47 +0200)]
New module 'thread-optim'.

* lib/thread-optim.h: New file.
* modules/thread-optim: New file.
* doc/multithread.texi (Multithreading Optimizations): New section.

4 years agodoc: more updates for glibc 2.32
Paul Eggert [Fri, 7 Aug 2020 22:26:27 +0000 (15:26 -0700)]
doc: more updates for glibc 2.32

* doc/glibc-functions/lchmod.texi, doc/posix-functions/faccessat.texi:
* doc/posix-functions/fchmodat.texi: Update.

4 years agodoc: Update for glibc 2.32.
Bruno Haible [Fri, 7 Aug 2020 21:02:21 +0000 (23:02 +0200)]
doc: Update for glibc 2.32.

* doc/glibc-functions/__libc_single_threaded.texi: New file.
* doc/glibc-functions/pthread_attr_getsigmask_np.texi: New file.
* doc/glibc-functions/pthread_attr_setsigmask_np.texi: New file.
* doc/glibc-functions/sigabbrev_np.texi: New file.
* doc/glibc-functions/sigdescr_np.texi: New file.
* doc/glibc-functions/strerrordesc_np.texi: New file.
* doc/glibc-functions/strerrorname_np.texi: New file.
* doc/gnulib.texi: Include them.
(Glibc sys/single_threaded.h): New section.
* doc/pastposix-functions/h_errno.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.

4 years agoalloca: No need to compile alloca.c with clang.
Bruno Haible [Fri, 7 Aug 2020 12:55:22 +0000 (14:55 +0200)]
alloca: No need to compile alloca.c with clang.

* lib/alloca.c: Skip all code with clang.

4 years agoUse __builtin_alloca with clang.
Bruno Haible [Fri, 7 Aug 2020 11:19:48 +0000 (13:19 +0200)]
Use __builtin_alloca with clang.

* lib/alloca.in.h (alloca): Define as __builtin_alloca on clang.

4 years agoUse __builtin_assume with clang.
Bruno Haible [Fri, 7 Aug 2020 00:12:09 +0000 (02:12 +0200)]
Use __builtin_assume with clang.

* lib/verify.h (_GL_HAS_BUILTIN_ASSUME): New macro.
(assume): Use __builtin_assume when available.

4 years agolibgmp: add <gmp/gmp.h> support
Paul Eggert [Thu, 6 Aug 2020 21:53:08 +0000 (14:53 -0700)]
libgmp: add <gmp/gmp.h> support

* m4/libgmp.m4 (gl_LIBGMP):
* modules/libgmp (configure.ac, Makefile.am):
Support platforms requiring ‘#include <gmp/gmp.h>’ instead of
‘#include <gmp.h>’.

4 years agoConsider that clang defines __OPTIMIZE__ like GCC does.
Bruno Haible [Thu, 6 Aug 2020 18:55:13 +0000 (20:55 +0200)]
Consider that clang defines __OPTIMIZE__ like GCC does.

* lib/streq.h: Define the inline functions also on clang.
* lib/c-strcaseeq.h: Likewise.
* lib/c++defs.h (_GL_CXXALIASWARN_2, _GL_CXXALIASWARN1_2): Don't enable
the GCC workaround to clang.

4 years agosafe-alloc: Remove unused code.
Bruno Haible [Thu, 6 Aug 2020 18:41:33 +0000 (20:41 +0200)]
safe-alloc: Remove unused code.

* lib/safe-alloc.h (__GNUC_PREREQ): Remove macro.

4 years agoUse __builtin_expect with clang everywhere.
Bruno Haible [Thu, 6 Aug 2020 18:34:29 +0000 (20:34 +0200)]
Use __builtin_expect with clang everywhere.

* lib/cdefs.h (__glibc_unlikely, __glibc_likely): Use the GCC built-in
also on clang.

4 years agoUse __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang everywhere.
Bruno Haible [Wed, 5 Aug 2020 17:57:21 +0000 (19:57 +0200)]
Use __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang everywhere.

* lib/count-trailing-zeros.h (COUNT_TRAILING_ZEROS): Use the GCC
built-in also on clang.
* lib/ffs.c: With clang, use the GCC built-in, not <intrin.h>.
* lib/ffsl.h: Likewise. Assume GCC_BUILTIN is defined.