1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 06:20:43 -08:00

Update from Gnulib

This incorporates:
2020-07-07 dup2: remove support for some very old platforms
2020-07-07 memchr: remove support for some very old platforms
2020-07-04 getumask: new module
2020-07-03 getrandom: fix compilation error on native Windows
2020-07-03 lchmod: simplify after 2020-02-22 change
2020-07-01 manywarnings: improve port to GCC 10.1
2020-06-28 getrandom: fix compilation errors on older versions of mingw
2020-06-29 alloca-opt: fix warning on mingw
* lib/alloca.in.h, lib/dup2.c, lib/getrandom.c, lib/string.in.h:
* lib/sys_stat.in.h, lib/unistd.in.h, m4/dup2.m4, m4/getrandom.m4:
* m4/lchmod.m4, m4/manywarnings.m4, m4/string_h.m4, m4/sys_stat_h.m4:
* m4/unistd_h.m4: Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
This commit is contained in:
Paul Eggert 2020-07-09 16:35:48 -07:00
parent 814e3b0b17
commit 0fc8671d10
15 changed files with 187 additions and 377 deletions

View file

@ -35,13 +35,16 @@
*/ */
#ifndef alloca #ifndef alloca
# ifdef __GNUC__
/* Some version of mingw have an <alloca.h> that causes trouble when /* Some version of mingw have an <alloca.h> that causes trouble when
included after 'alloca' gets defined as a macro. As a workaround, include included after 'alloca' gets defined as a macro. As a workaround,
this <alloca.h> first and define 'alloca' as a macro afterwards. */ include this <alloca.h> first and define 'alloca' as a macro afterwards
# if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ if needed. */
# if defined __GNUC__ && (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
# include_next <alloca.h> # include_next <alloca.h>
# endif # endif
#endif
#ifndef alloca
# ifdef __GNUC__
# define alloca __builtin_alloca # define alloca __builtin_alloca
# elif defined _AIX # elif defined _AIX
# define alloca __alloca # define alloca __alloca

View file

@ -25,11 +25,9 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#if HAVE_DUP2 #undef dup2
# undef dup2 #if defined _WIN32 && ! defined __CYGWIN__
# if defined _WIN32 && ! defined __CYGWIN__
/* Get declarations of the native Windows API functions. */ /* Get declarations of the native Windows API functions. */
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
@ -105,7 +103,7 @@ ms_windows_dup2 (int fd, int desired_fd)
# define dup2 ms_windows_dup2 # define dup2 ms_windows_dup2
# elif defined __KLIBC__ #elif defined __KLIBC__
# include <InnoTekLIBC/backend.h> # include <InnoTekLIBC/backend.h>
@ -156,14 +154,14 @@ klibc_dup2 (int fd, int desired_fd)
} }
# define dup2 klibc_dup2 # define dup2 klibc_dup2
# endif #endif
int int
rpl_dup2 (int fd, int desired_fd) rpl_dup2 (int fd, int desired_fd)
{ {
int result; int result;
# ifdef F_GETFL #ifdef F_GETFL
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
On Cygwin 1.5.x, dup2 (1, 1) returns 0. On Cygwin 1.5.x, dup2 (1, 1) returns 0.
On Cygwin 1.7.17, dup2 (1, -1) dumps core. On Cygwin 1.7.17, dup2 (1, -1) dumps core.
@ -176,60 +174,16 @@ rpl_dup2 (int fd, int desired_fd)
fd = desired_fd; fd = desired_fd;
if (fd == desired_fd) if (fd == desired_fd)
return fcntl (fd, F_GETFL) == -1 ? -1 : fd; return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
# endif #endif
result = dup2 (fd, desired_fd); result = dup2 (fd, desired_fd);
/* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
if (result == -1 && errno == EMFILE) if (result == -1 && errno == EMFILE)
errno = EBADF; errno = EBADF;
# if REPLACE_FCHDIR #if REPLACE_FCHDIR
if (fd != desired_fd && result != -1) if (fd != desired_fd && result != -1)
result = _gl_register_dup (fd, result); result = _gl_register_dup (fd, result);
# endif #endif
return result; return result;
} }
#else /* !HAVE_DUP2 */
/* On older platforms, dup2 did not exist. */
# ifndef F_DUPFD
static int
dupfd (int fd, int desired_fd)
{
int duplicated_fd = dup (fd);
if (duplicated_fd < 0 || duplicated_fd == desired_fd)
return duplicated_fd;
else
{
int r = dupfd (fd, desired_fd);
int e = errno;
close (duplicated_fd);
errno = e;
return r;
}
}
# endif
int
dup2 (int fd, int desired_fd)
{
int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
if (result == -1 || fd == desired_fd)
return result;
close (desired_fd);
# ifdef F_DUPFD
result = fcntl (fd, F_DUPFD, desired_fd);
# if REPLACE_FCHDIR
if (0 <= result)
result = _gl_register_dup (fd, result);
# endif
# else
result = dupfd (fd, desired_fd);
# endif
if (result == -1 && (errno == EMFILE || errno == EINVAL))
errno = EBADF;
return result;
}
#endif /* !HAVE_DUP2 */

View file

@ -32,7 +32,7 @@
# if HAVE_BCRYPT_H # if HAVE_BCRYPT_H
# include <bcrypt.h> # include <bcrypt.h>
# else # else
# include <ntdef.h> /* NTSTATUS */ # define NTSTATUS LONG
typedef void * BCRYPT_ALG_HANDLE; typedef void * BCRYPT_ALG_HANDLE;
# define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002 # define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
# if HAVE_LIB_BCRYPT # if HAVE_LIB_BCRYPT

View file

@ -325,6 +325,7 @@ GNULIB_GETPASS = @GNULIB_GETPASS@
GNULIB_GETRANDOM = @GNULIB_GETRANDOM@ GNULIB_GETRANDOM = @GNULIB_GETRANDOM@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@
GNULIB_GETUMASK = @GNULIB_GETUMASK@
GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@ GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@
GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_GRANTPT = @GNULIB_GRANTPT@
@ -548,7 +549,6 @@ HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
HAVE_DIRENT_H = @HAVE_DIRENT_H@ HAVE_DIRENT_H = @HAVE_DIRENT_H@
HAVE_DPRINTF = @HAVE_DPRINTF@ HAVE_DPRINTF = @HAVE_DPRINTF@
HAVE_DUP2 = @HAVE_DUP2@
HAVE_DUP3 = @HAVE_DUP3@ HAVE_DUP3 = @HAVE_DUP3@
HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@
@ -578,6 +578,7 @@ HAVE_GETPASS = @HAVE_GETPASS@
HAVE_GETRANDOM = @HAVE_GETRANDOM@ HAVE_GETRANDOM = @HAVE_GETRANDOM@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
HAVE_GETUMASK = @HAVE_GETUMASK@
HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_GRANTPT = @HAVE_GRANTPT@
HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
@ -592,7 +593,6 @@ HAVE_MAKEINFO = @HAVE_MAKEINFO@
HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSLEN = @HAVE_MBSLEN@
HAVE_MBTOWC = @HAVE_MBTOWC@ HAVE_MBTOWC = @HAVE_MBTOWC@
HAVE_MEMCHR = @HAVE_MEMCHR@
HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDIRAT = @HAVE_MKDIRAT@
HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKDTEMP = @HAVE_MKDTEMP@
@ -1132,7 +1132,6 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -2833,7 +2832,6 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
-e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
-e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@ -3017,6 +3015,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
-e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
-e 's/@''GNULIB_GETUMASK''@/$(GNULIB_GETUMASK)/g' \
-e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
-e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \
-e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \
@ -3030,6 +3029,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \
-e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \
-e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \
-e 's|@''HAVE_GETUMASK''@|$(HAVE_GETUMASK)|g' \
-e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \
@ -3338,7 +3338,6 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
< $(srcdir)/unistd.in.h | \ < $(srcdir)/unistd.in.h | \
sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
-e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
-e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
-e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
-e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \

View file

@ -134,11 +134,6 @@ _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
# else # else
# if ! @HAVE_MEMCHR@
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
/* On some systems, this function is defined as an overloaded function: /* On some systems, this function is defined as an overloaded function:
extern "C" { const void * std::memchr (const void *, int, size_t); } extern "C" { const void * std::memchr (const void *, int, size_t); }
extern "C++" { void * std::memchr (void *, int, size_t); } */ extern "C++" { void * std::memchr (void *, int, size_t); } */

View file

@ -515,6 +515,23 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
#endif #endif
#if @GNULIB_GETUMASK@
# if !@HAVE_GETUMASK@
_GL_FUNCDECL_SYS (getumask, mode_t, (void));
# endif
_GL_CXXALIAS_SYS (getumask, mode_t, (void));
# if @HAVE_GETUMASK@
_GL_CXXALIASWARN (getumask);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getumask
# if HAVE_RAW_DECL_GETUMASK
_GL_WARN_ON_USE (getumask, "getumask is not portable - "
"use gnulib module getumask for portability");
# endif
#endif
#if @GNULIB_LCHMOD@ #if @GNULIB_LCHMOD@
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
denotes a symbolic link. */ denotes a symbolic link. */

View file

@ -408,9 +408,6 @@ _GL_WARN_ON_USE (dup, "dup is unportable - "
_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
# else # else
# if !@HAVE_DUP2@
_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
# endif
_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
# endif # endif
_GL_CXXALIASWARN (dup2); _GL_CXXALIASWARN (dup2);

View file

@ -1,4 +1,4 @@
#serial 25 #serial 26
dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc. dnl Copyright (C) 2002, 2005, 2007, 2009-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -8,15 +8,6 @@ AC_DEFUN([gl_FUNC_DUP2],
[ [
AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [
AC_CHECK_FUNCS_ONCE([dup2])
if test $ac_cv_func_dup2 = no; then
HAVE_DUP2=0
fi
], [
AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.])
])
if test $HAVE_DUP2 = 1; then
AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
[AC_RUN_IFELSE([ [AC_RUN_IFELSE([
AC_LANG_PROGRAM( AC_LANG_PROGRAM(
@ -69,7 +60,6 @@ AC_DEFUN([gl_FUNC_DUP2],
result |= 64; result |= 64;
else if (dup2 (fd, fd + 1) == -1) else if (dup2 (fd, fd + 1) == -1)
result |= 128; result |= 128;
close (fd); close (fd);
} }
return result;]]) return result;]])
@ -100,16 +90,13 @@ AC_DEFUN([gl_FUNC_DUP2],
AC_CHECK_FUNCS([setdtablesize]) AC_CHECK_FUNCS([setdtablesize])
;; ;;
esac esac
fi
dnl Replace dup2() for supporting the gnulib-defined fchdir() function, dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
dnl to keep fchdir's bookkeeping up-to-date. dnl to keep fchdir's bookkeeping up-to-date.
m4_ifdef([gl_FUNC_FCHDIR], [ m4_ifdef([gl_FUNC_FCHDIR], [
gl_TEST_FCHDIR gl_TEST_FCHDIR
if test $HAVE_FCHDIR = 0; then if test $HAVE_FCHDIR = 0; then
if test $HAVE_DUP2 = 1; then
REPLACE_DUP2=1 REPLACE_DUP2=1
fi fi
fi
]) ])
]) ])

View file

@ -1,4 +1,4 @@
# getrandom.m4 serial 6 # getrandom.m4 serial 7
dnl Copyright 2020 Free Software Foundation, Inc. dnl Copyright 2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -36,7 +36,9 @@ AC_DEFUN([gl_FUNC_GETRANDOM],
case "$host_os" in case "$host_os" in
mingw*) mingw*)
AC_CHECK_HEADERS([bcrypt.h]) AC_CHECK_HEADERS([bcrypt.h], [], [],
[[#include <windows.h>
]])
AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present], AC_CACHE_CHECK([whether the bcrypt library is guaranteed to be present],
[gl_cv_lib_assume_bcrypt], [gl_cv_lib_assume_bcrypt],
[AC_COMPILE_IFELSE( [AC_COMPILE_IFELSE(

View file

@ -240,7 +240,7 @@ AC_DEFUN([gl_INIT],
gl_DIRENT_H gl_DIRENT_H
gl_DOUBLE_SLASH_ROOT gl_DOUBLE_SLASH_ROOT
gl_FUNC_DUP2 gl_FUNC_DUP2
if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then if test $REPLACE_DUP2 = 1; then
AC_LIBOBJ([dup2]) AC_LIBOBJ([dup2])
gl_PREREQ_DUP2 gl_PREREQ_DUP2
fi fi
@ -465,6 +465,7 @@ AC_DEFUN([gl_INIT],
gl_SYS_TYPES_H gl_SYS_TYPES_H
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
gl_FUNC_GEN_TEMPNAME gl_FUNC_GEN_TEMPNAME
gl_MODULE_INDICATOR([tempname])
gl_HEADER_TIME_H gl_HEADER_TIME_H
gl_TIME_R gl_TIME_R
if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then

View file

@ -1,4 +1,4 @@
#serial 7 #serial 8
dnl Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc. dnl Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
@ -26,6 +26,5 @@ AC_DEFUN([gl_FUNC_LCHMOD],
# Prerequisites of lib/lchmod.c. # Prerequisites of lib/lchmod.c.
AC_DEFUN([gl_PREREQ_LCHMOD], AC_DEFUN([gl_PREREQ_LCHMOD],
[ [
AC_REQUIRE([AC_C_INLINE])
: :
]) ])

View file

@ -1,4 +1,4 @@
# manywarnings.m4 serial 19 # manywarnings.m4 serial 20
dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -21,7 +21,7 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
*" $gl_warn_item "*) *" $gl_warn_item "*)
;; ;;
*) *)
gl_warn_set="$gl_warn_set $gl_warn_item" gl_AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
;; ;;
esac esac
done done
@ -49,12 +49,12 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC])
if test -n "$GCC"; then if test -n "$GCC"; then
dnl Check if -W -Werror -Wno-missing-field-initializers is supported dnl Check if -Wextra -Werror -Wno-missing-field-initializers is supported
dnl with the current $CC $CFLAGS $CPPFLAGS. dnl with the current $CC $CFLAGS $CPPFLAGS.
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported], AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
[gl_cv_cc_nomfi_supported], [gl_cv_cc_nomfi_supported],
[gl_save_CFLAGS="$CFLAGS" [gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" CFLAGS="$CFLAGS -Wextra -Werror -Wno-missing-field-initializers"
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])], [AC_LANG_PROGRAM([[]], [[]])],
[gl_cv_cc_nomfi_supported=yes], [gl_cv_cc_nomfi_supported=yes],
@ -68,7 +68,7 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed], AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
[gl_cv_cc_nomfi_needed], [gl_cv_cc_nomfi_needed],
[gl_save_CFLAGS="$CFLAGS" [gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -W -Werror" CFLAGS="$CFLAGS -Wextra -Werror"
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(
[[int f (void) [[int f (void)
@ -105,153 +105,41 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
# To compare this list to your installed GCC's, run this Bash command: # To compare this list to your installed GCC's, run this Bash command:
# #
# comm -3 \ # comm -3 \
# <((sed -n 's/^ *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \ # <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \ # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
# <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort) # <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
gl_manywarn_set= $1=
for gl_manywarn_item in -fno-common \ for gl_manywarn_item in -fanalyzer -fno-common \
-W \
-Wabsolute-value \
-Waddress \
-Waddress-of-packed-member \
-Waggressive-loop-optimizations \
-Wall \ -Wall \
-Wanalyzer-double-fclose \
-Wanalyzer-double-free \
-Wanalyzer-exposure-through-output-file \
-Wanalyzer-file-leak \
-Wanalyzer-free-of-non-heap \
-Wanalyzer-malloc-leak \
-Wanalyzer-null-argument \
-Wanalyzer-null-dereference \
-Wanalyzer-possible-null-argument \
-Wanalyzer-possible-null-dereference \
-Wanalyzer-stale-setjmp-buffer \
-Wanalyzer-tainted-array-index \
-Wanalyzer-too-complex \
-Wanalyzer-unsafe-call-within-signal-handler \
-Wanalyzer-use-after-free \
-Wanalyzer-use-of-pointer-in-stale-stack-frame \
-Warith-conversion \ -Warith-conversion \
-Wattribute-warning \
-Wattributes \
-Wbad-function-cast \ -Wbad-function-cast \
-Wbool-compare \
-Wbool-operation \
-Wbuiltin-declaration-mismatch \
-Wbuiltin-macro-redefined \
-Wcannot-profile \
-Wcast-align \
-Wcast-align=strict \ -Wcast-align=strict \
-Wcast-function-type \
-Wchar-subscripts \
-Wclobbered \
-Wcomment \
-Wcomments \
-Wcoverage-mismatch \
-Wcpp \
-Wdangling-else \
-Wdate-time \ -Wdate-time \
-Wdeprecated \
-Wdeprecated-declarations \
-Wdesignated-init \
-Wdisabled-optimization \ -Wdisabled-optimization \
-Wdiscarded-array-qualifiers \
-Wdiscarded-qualifiers \
-Wdiv-by-zero \
-Wdouble-promotion \ -Wdouble-promotion \
-Wduplicated-branches \ -Wduplicated-branches \
-Wduplicated-cond \ -Wduplicated-cond \
-Wduplicate-decl-specifier \
-Wempty-body \
-Wendif-labels \
-Wenum-compare \
-Wenum-conversion \
-Wexpansion-to-defined \
-Wextra \ -Wextra \
-Wformat-contains-nul \
-Wformat-diag \
-Wformat-extra-args \
-Wformat-nonliteral \
-Wformat-security \
-Wformat-signedness \ -Wformat-signedness \
-Wformat-y2k \
-Wformat-zero-length \
-Wframe-address \
-Wfree-nonheap-object \
-Whsa \
-Wif-not-aligned \
-Wignored-attributes \
-Wignored-qualifiers \
-Wimplicit \
-Wimplicit-function-declaration \
-Wimplicit-int \
-Wincompatible-pointer-types \
-Winit-self \ -Winit-self \
-Winline \ -Winline \
-Wint-conversion \
-Wint-in-bool-context \
-Wint-to-pointer-cast \
-Winvalid-memory-model \
-Winvalid-pch \ -Winvalid-pch \
-Wlogical-not-parentheses \
-Wlogical-op \ -Wlogical-op \
-Wmain \
-Wmaybe-uninitialized \
-Wmemset-elt-size \
-Wmemset-transposed-args \
-Wmisleading-indentation \
-Wmissing-attributes \
-Wmissing-braces \
-Wmissing-declarations \ -Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-include-dirs \ -Wmissing-include-dirs \
-Wmissing-parameter-type \
-Wmissing-profile \
-Wmissing-prototypes \ -Wmissing-prototypes \
-Wmultichar \
-Wmultistatement-macros \
-Wnarrowing \
-Wnested-externs \ -Wnested-externs \
-Wnonnull \
-Wnonnull-compare \
-Wnull-dereference \ -Wnull-dereference \
-Wodr \
-Wold-style-declaration \
-Wold-style-definition \ -Wold-style-definition \
-Wopenmp-simd \ -Wopenmp-simd \
-Woverflow \
-Woverlength-strings \ -Woverlength-strings \
-Woverride-init \
-Wpacked \ -Wpacked \
-Wpacked-bitfield-compat \
-Wpacked-not-aligned \
-Wparentheses \
-Wpointer-arith \ -Wpointer-arith \
-Wpointer-compare \
-Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
-Wpsabi \
-Wrestrict \
-Wreturn-local-addr \
-Wreturn-type \
-Wscalar-storage-order \
-Wsequence-point \
-Wshadow \ -Wshadow \
-Wshift-count-negative \
-Wshift-count-overflow \
-Wshift-negative-value \
-Wsizeof-array-argument \
-Wsizeof-pointer-div \
-Wsizeof-pointer-memaccess \
-Wstack-protector \ -Wstack-protector \
-Wstrict-aliasing \
-Wstrict-overflow \ -Wstrict-overflow \
-Wstrict-prototypes \ -Wstrict-prototypes \
-Wstring-compare \
-Wstringop-truncation \
-Wsuggest-attribute=cold \ -Wsuggest-attribute=cold \
-Wsuggest-attribute=const \ -Wsuggest-attribute=const \
-Wsuggest-attribute=format \ -Wsuggest-attribute=format \
@ -260,95 +148,63 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
-Wsuggest-attribute=pure \ -Wsuggest-attribute=pure \
-Wsuggest-final-methods \ -Wsuggest-final-methods \
-Wsuggest-final-types \ -Wsuggest-final-types \
-Wswitch \
-Wswitch-bool \
-Wswitch-outside-range \
-Wswitch-unreachable \
-Wsync-nand \ -Wsync-nand \
-Wsystem-headers \ -Wsystem-headers \
-Wtautological-compare \
-Wtrampolines \ -Wtrampolines \
-Wtrigraphs \
-Wtype-limits \
-Wuninitialized \ -Wuninitialized \
-Wunknown-pragmas \ -Wunknown-pragmas \
-Wunsafe-loop-optimizations \ -Wunsafe-loop-optimizations \
-Wunused \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-function \
-Wunused-label \
-Wunused-local-typedefs \
-Wunused-macros \ -Wunused-macros \
-Wunused-parameter \
-Wunused-result \
-Wunused-value \
-Wunused-variable \
-Wvarargs \
-Wvariadic-macros \ -Wvariadic-macros \
-Wvector-operation-performance \ -Wvector-operation-performance \
-Wvla \ -Wvla \
-Wvolatile-register-var \
-Wwrite-strings \ -Wwrite-strings \
-Wzero-length-bounds \
\ \
; do ; do
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" gl_AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
done done
# gcc --help=warnings outputs an unusual form for these options; list # gcc --help=warnings outputs an unusual form for these options; list
# them here so that the above 'comm' command doesn't report a false match. # them here so that the above 'comm' command doesn't report a false match.
# Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal. gl_AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
# Also, AC_COMPUTE_INT requires it to fit in a long; it is 2**63 on gl_AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
# the only platforms where it does not fit in a long, so make that gl_AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
# a special case. gl_AS_VAR_APPEND([$1], [' -Wformat=2'])
AC_MSG_CHECKING([max safe object size]) gl_AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
AC_COMPUTE_INT([gl_alloc_max], gl_AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
[LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1) gl_AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
? -1 gl_AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
: PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1], gl_AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
[[#include <limits.h>
#include <stddef.h>
#include <stdint.h>
]],
[gl_alloc_max=2147483647])
case $gl_alloc_max in
-1) gl_alloc_max=9223372036854775807;;
esac
AC_MSG_RESULT([$gl_alloc_max])
gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
gl_manywarn_set="$gl_manywarn_set -Wattribute-alias=2"
gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2"
gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031"
# These are needed for older GCC versions. # These are needed for older GCC versions.
if test -n "$GCC"; then if test -n "$GCC"; then
case `($CC --version) 2>/dev/null` in case `($CC --version) 2>/dev/null` in
'gcc (GCC) '[[0-3]].* | \ 'gcc (GCC) '[[0-3]].* | \
'gcc (GCC) '4.[[0-7]].*) 'gcc (GCC) '4.[[0-7]].*)
gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option" gl_AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
gl_manywarn_set="$gl_manywarn_set -funit-at-a-time" gl_AS_VAR_APPEND([$1], [' -funit-at-a-time'])
;; ;;
esac esac
fi fi
# Disable specific options as needed. # Disable specific options as needed.
if test "$gl_cv_cc_nomfi_needed" = yes; then if test "$gl_cv_cc_nomfi_needed" = yes; then
gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" gl_AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
fi fi
if test "$gl_cv_cc_uninitialized_supported" = no; then if test "$gl_cv_cc_uninitialized_supported" = no; then
gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized" gl_AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
fi fi
$1=$gl_manywarn_set # Some warnings have too many false alarms in GCC 10.1.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93695
gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-double-free'])
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94458
gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94851
gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-null-dereference'])
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95758
gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-use-after-free'])
AC_LANG_POP([C]) AC_LANG_POP([C])
]) ])

View file

@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 23 # serial 24
# Written by Paul Eggert. # Written by Paul Eggert.
@ -87,7 +87,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO])
HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])

View file

@ -1,4 +1,4 @@
# sys_stat_h.m4 serial 33 -*- Autoconf -*- # sys_stat_h.m4 serial 34 -*- Autoconf -*-
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -46,8 +46,8 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
dnl Check for declarations of anything we want to poison if the dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat ]], [fchmodat fstat fstatat futimens getumask lchmod lstat
mknod mknodat stat utimensat]) mkdirat mkfifo mkfifoat mknod mknodat stat utimensat])
AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_C_RESTRICT])
]) ])
@ -68,6 +68,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK])
GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
@ -82,6 +83,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK])
HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 80 # unistd_h.m4 serial 81
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -120,7 +120,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
dnl Assume proper GNU behavior unless another module says otherwise. dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE])
HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_DUP3=1; AC_SUBST([HAVE_DUP3])
HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS])
HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])