]> git.eshelyaron.com Git - emacs.git/commitdiff
Update from Gnulib by running admin/merge-gnulib
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 31 Jan 2024 01:22:50 +0000 (17:22 -0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jan 2024 20:16:16 +0000 (21:16 +0100)
(cherry picked from commit dd177b7b88c81ab71e1d5a97b872d85d524fee9b)

lib/cdefs.h
lib/gnulib.mk.in
lib/string.in.h
lib/time.in.h
m4/copy-file-range.m4
m4/gettime.m4
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/memset_explicit.m4
m4/string_h.m4
m4/time_h.m4

index 87ddce319dc6227904b20368efcbcfb7750a8c4b..d38382ad9d80f11f2c6bd255d502f87c63fe26d0 100644 (file)
@@ -42,8 +42,8 @@
 #if (defined __has_attribute \
      && (!defined __clang_minor__ \
          || (defined __apple_build_version__ \
-             ? 6000000 <= __apple_build_version__ \
-             : 3 < __clang_major__ + (5 <= __clang_minor__))))
+             ? 7000000 <= __apple_build_version__ \
+             : 5 <= __clang_major__)))
 # define __glibc_has_attribute(attr) __has_attribute (attr)
 #else
 # define __glibc_has_attribute(attr) 0
index fcf2b186038cc84076c7f851cbac8b8f53c83770..e10aab5fc8d3069e3a2d38219b9f4d47398f8179 100644 (file)
@@ -1185,6 +1185,7 @@ REPLACE_MB_CUR_MAX = @REPLACE_MB_CUR_MAX@
 REPLACE_MEMCHR = @REPLACE_MEMCHR@
 REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MEMPCPY = @REPLACE_MEMPCPY@
+REPLACE_MEMSET_EXPLICIT = @REPLACE_MEMSET_EXPLICIT@
 REPLACE_MKDIR = @REPLACE_MKDIR@
 REPLACE_MKFIFO = @REPLACE_MKFIFO@
 REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@
@@ -1271,6 +1272,7 @@ REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@
 REPLACE_TIME = @REPLACE_TIME@
 REPLACE_TIMEGM = @REPLACE_TIMEGM@
 REPLACE_TIMESPEC_GET = @REPLACE_TIMESPEC_GET@
+REPLACE_TIMESPEC_GETRES = @REPLACE_TIMESPEC_GETRES@
 REPLACE_TMPFILE = @REPLACE_TMPFILE@
 REPLACE_TRUNCATE = @REPLACE_TRUNCATE@
 REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
@@ -3560,6 +3562,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_MEMPCPY''@|$(REPLACE_MEMPCPY)|g' \
+             -e 's|@''REPLACE_MEMSET_EXPLICIT''@|$(REPLACE_MEMSET_EXPLICIT)|g' \
              -e 's|@''REPLACE_FREE''@|$(REPLACE_FREE)|g' \
              -e 's|@''REPLACE_STPCPY''@|$(REPLACE_STPCPY)|g' \
              -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
@@ -3892,6 +3895,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \
              -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
              -e 's|@''REPLACE_TIMESPEC_GET''@|$(REPLACE_TIMESPEC_GET)|g' \
+             -e 's|@''REPLACE_TIMESPEC_GETRES''@|$(REPLACE_TIMESPEC_GETRES)|g' \
              -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \
              -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
              -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
index 01ea3e3913b1ee99fe42446d3b42ae80baa2b381..44ec2e7ecdb5070ddf684d739f298e37cceedb17 100644 (file)
@@ -414,11 +414,21 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
 /* Overwrite a block of memory.  The compiler will not optimize
    effects away, even if the block is dead after the call.  */
 #if @GNULIB_MEMSET_EXPLICIT@
-# if ! @HAVE_MEMSET_EXPLICIT@
+# if @REPLACE_MEMSET_EXPLICIT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef memset_explicit
+#   define memset_explicit rpl_memset_explicit
+#  endif
+_GL_FUNCDECL_RPL (memset_explicit, void *,
+                  (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# else
+#  if !@HAVE_MEMSET_EXPLICIT@
 _GL_FUNCDECL_SYS (memset_explicit, void *,
                   (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
+# endif
 _GL_CXXALIASWARN (memset_explicit);
 #elif defined GNULIB_POSIXCHECK
 # undef memset_explicit
index 58e103af07c9ce62b9b6cc6ceefab5bdd3341918..ce28f1af25d812c246e36687f6f1ca25a4687ce5 100644 (file)
@@ -154,11 +154,21 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
 /* Set *TS to the current time resolution, and return BASE.
    Upon failure, return 0.  */
 # if @GNULIB_TIMESPEC_GETRES@
-#  if ! @HAVE_TIMESPEC_GETRES@
+#  if @REPLACE_TIMESPEC_GETRES@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef timespec_getres
+#    define timespec_getres rpl_timespec_getres
+#   endif
+_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base)
+                                        _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
+#  else
+#   if !@HAVE_TIMESPEC_GETRES@
 _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
                                         _GL_ARG_NONNULL ((1)));
-#  endif
+#   endif
 _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
+#  endif
 _GL_CXXALIASWARN (timespec_getres);
 # elif defined GNULIB_POSIXCHECK
 #  undef timespec_getres
index e91985495109ea1e2740ccaa98d5d6d58728ecc2..443e598ba55e895645add2d93cd6b12fb018e72e 100644 (file)
@@ -1,4 +1,4 @@
-# copy-file-range.m4
+# copy-file-range.m4 serial 5
 dnl Copyright 2019-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,22 +17,33 @@ AC_DEFUN([gl_FUNC_COPY_FILE_RANGE],
   dnl Programs that use copy_file_range must fall back on read+write
   dnl anyway, and there's little point to substituting the Gnulib stub
   dnl for a glibc stub.
-  AC_CACHE_CHECK([for copy_file_range], [gl_cv_func_copy_file_range],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <unistd.h>
-          ]],
-          [[ssize_t (*func) (int, off_t *, int, off_t *, size_t, unsigned)
-              = copy_file_range;
-            return func (0, 0, 0, 0, 0, 0) & 127;
-          ]])
-       ],
-       [gl_cv_func_copy_file_range=yes],
-       [gl_cv_func_copy_file_range=no])
-    ])
-
+  case "$host_os" in
+    *-gnu* | gnu*)
+      AC_CACHE_CHECK([for copy_file_range], [gl_cv_func_copy_file_range],
+        [AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <unistd.h>
+              ]],
+              [[ssize_t (*func) (int, off_t *, int, off_t *, size_t, unsigned)
+                  = copy_file_range;
+                return func (0, 0, 0, 0, 0, 0) & 127;
+              ]])
+           ],
+           [gl_cv_func_copy_file_range=yes],
+           [gl_cv_func_copy_file_range=no])
+        ])
+      gl_cv_onwards_func_copy_file_range="$gl_cv_func_copy_file_range"
+      ;;
+    *)
+      gl_CHECK_FUNCS_ANDROID([copy_file_range], [[#include <unistd.h>]])
+      gl_cv_func_copy_file_range="$ac_cv_func_copy_file_range"
+      ;;
+  esac
   if test "$gl_cv_func_copy_file_range" != yes; then
     HAVE_COPY_FILE_RANGE=0
+    case "$gl_cv_onwards_func_copy_file_range" in
+      future*) REPLACE_COPY_FILE_RANGE=1 ;;
+    esac
   else
     AC_DEFINE([HAVE_COPY_FILE_RANGE], 1,
       [Define to 1 if the function copy_file_range exists.])
index e450e6b9d0523ee4a69db99e5143d7d5f1264645..1ec018d51540ef4cbdc40bcc416a1c52f906a67d 100644 (file)
@@ -1,4 +1,4 @@
-# gettime.m4 serial 14
+# gettime.m4 serial 15
 dnl Copyright (C) 2002, 2004-2006, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,5 +64,5 @@ AC_DEFUN([gl_GETTIME_RES],
   dnl Prerequisites of lib/gettime-res.c.
   AC_REQUIRE([gl_CLOCK_TIME])
   AC_REQUIRE([gl_TIMESPEC])
-  AC_CHECK_FUNCS_ONCE([timespec_getres])
+  gl_CHECK_FUNCS_ANDROID([timespec_getres], [[#include <time.h>]])
 ])
index 03d10fa51ea70458f6a23f184902e7f7b6d69edd..00691c0d6c3a90da5e311c87679291465fd5bf0e 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 90
+# gnulib-common.m4 serial 91
 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -79,7 +79,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 #if (defined __has_attribute \
      && (!defined __clang_minor__ \
          || (defined __apple_build_version__ \
-             ? 6000000 <= __apple_build_version__ \
+             ? 7000000 <= __apple_build_version__ \
              : 5 <= __clang_major__)))
 # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
 #else
index 2e5b328e3d8b65bbd778c56d1ea8ce03125b09e0..7a7ebb0f34e83eb2e5aa15b8779efb67f6c9f4f8 100644 (file)
@@ -432,7 +432,8 @@ AC_DEFUN([gl_INIT],
   ])
   gl_STRING_MODULE_INDICATOR([memrchr])
   gl_FUNC_MEMSET_EXPLICIT
-  gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT], [test $HAVE_MEMSET_EXPLICIT = 0])
+  gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT],
+                 [test $HAVE_MEMSET_EXPLICIT = 0 || test $REPLACE_MEMSET_EXPLICIT = 1])
   AM_COND_IF([GL_COND_OBJ_MEMSET_EXPLICIT], [
     gl_PREREQ_MEMSET_EXPLICIT
   ])
index 6ac798d45572d71dc755cb03e74633e461fab830..19514ff917e65487d8fdf5995d55d43f58540435 100644 (file)
@@ -1,3 +1,4 @@
+# memset_explicit.m4 serial 2
 dnl Copyright 2022-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,9 +8,12 @@ AC_DEFUN([gl_FUNC_MEMSET_EXPLICIT],
 [
   AC_REQUIRE([gl_STRING_H_DEFAULTS])
 
-  AC_CHECK_FUNCS_ONCE([memset_explicit])
+  gl_CHECK_FUNCS_ANDROID([memset_explicit], [[#include <string.h>]])
   if test $ac_cv_func_memset_explicit = no; then
     HAVE_MEMSET_EXPLICIT=0
+    case "$gl_cv_onwards_func_memset_explicit" in
+      future*) REPLACE_MEMSET_EXPLICIT=1 ;;
+    esac
   fi
 ])
 
index 8b12101447f24def65455987038ac0a798cd72a4..9ea748cc7740a43cb97ebf059a27a4ef8d0af826 100644 (file)
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 38
+# serial 39
 
 # Written by Paul Eggert.
 
@@ -132,6 +132,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
   REPLACE_MEMCHR=0;             AC_SUBST([REPLACE_MEMCHR])
   REPLACE_MEMMEM=0;             AC_SUBST([REPLACE_MEMMEM])
   REPLACE_MEMPCPY=0;            AC_SUBST([REPLACE_MEMPCPY])
+  REPLACE_MEMSET_EXPLICIT=0;    AC_SUBST([REPLACE_MEMSET_EXPLICIT])
   REPLACE_STPCPY=0;             AC_SUBST([REPLACE_STPCPY])
   REPLACE_STPNCPY=0;            AC_SUBST([REPLACE_STPNCPY])
   REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
index 367f69efae6c5aa7e4cc0aa8a508630081153adc..32fade0f401a7eebc9c2fdeb9e5a24ed12fe323a 100644 (file)
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc.
 
-# serial 24
+# serial 25
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -175,5 +175,6 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
   REPLACE_TIME=0;                        AC_SUBST([REPLACE_TIME])
   REPLACE_TIMEGM=0;                      AC_SUBST([REPLACE_TIMEGM])
   REPLACE_TIMESPEC_GET=0;                AC_SUBST([REPLACE_TIMESPEC_GET])
+  REPLACE_TIMESPEC_GETRES=0;             AC_SUBST([REPLACE_TIMESPEC_GETRES])
   REPLACE_TZSET=0;                       AC_SUBST([REPLACE_TZSET])
 ])