summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-06-07 12:00:15 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-06-07 12:04:00 -0700
commita902156068ab071f93cc9bbd34cd320919b74064 (patch)
treea5330a33e9f3f363e3021e3ecf91cb98806f7584 /m4
parentf68d962ede0cc3d7758d3304e7411a10694acce8 (diff)
downloademacs-a902156068ab071f93cc9bbd34cd320919b74064.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4')
-rw-r--r--m4/copy-file-range.m418
-rw-r--r--m4/gnulib-common.m44
-rw-r--r--m4/limits-h.m421
-rw-r--r--m4/manywarnings.m495
-rw-r--r--m4/ssize_t.m428
-rw-r--r--m4/strtoll.m416
-rw-r--r--m4/warnings.m476
7 files changed, 159 insertions, 99 deletions
diff --git a/m4/copy-file-range.m4 b/m4/copy-file-range.m4
index d41f2c48313..fa6ab341091 100644
--- a/m4/copy-file-range.m4
+++ b/m4/copy-file-range.m4
@@ -39,21 +39,9 @@ AC_DEFUN([gl_FUNC_COPY_FILE_RANGE],
case $host_os in
linux*)
- AC_CACHE_CHECK([whether copy_file_range is known to work],
- [gl_cv_copy_file_range_known_to_work],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <linux/version.h>
- ]],
- [[#if LINUX_VERSION_CODE < KERNEL_VERSION (5, 3, 0)
- #error "copy_file_range is buggy"
- #endif
- ]])],
- [gl_cv_copy_file_range_known_to_work=yes],
- [gl_cv_copy_file_range_known_to_work=no])])
- if test "$gl_cv_copy_file_range_known_to_work" = no; then
- REPLACE_COPY_FILE_RANGE=1
- fi;;
+ # See copy-file-range.c comment re pre-5.3 Linux kernel bugs.
+ # We should be able to remove this hack in 2025.
+ REPLACE_COPY_FILE_RANGE=1;;
esac
fi
])
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index a2b53d33dca..2426eb63985 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1053,7 +1053,6 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
dnl -Wno-float-conversion >= 4.9 >= 3.9
dnl -Wno-float-equal >= 3 >= 3.9
dnl -Wimplicit-fallthrough >= 7 >= 3.9
- dnl -Wno-missing-field-initializers >= 4.0, < 11
dnl -Wno-pedantic >= 4.8 >= 3.9
dnl -Wno-sign-compare >= 3 >= 3.9
dnl -Wno-sign-conversion >= 4.3 >= 3.9
@@ -1079,9 +1078,6 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
#if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
-Wimplicit-fallthrough
#endif
- #if __GNUC__ >= 4 && __GNUC__ < 11 && !defined __clang__
- -Wno-missing-field-initializers
- #endif
#if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
-Wno-pedantic
#endif
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index ca0294e5500..6a5983ebc25 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -28,11 +28,22 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
]])],
[gl_cv_header_limits_width=yes],
[gl_cv_header_limits_width=no])])
- if test "$gl_cv_header_limits_width" = yes; then
- GL_GENERATE_LIMITS_H=false
- else
- GL_GENERATE_LIMITS_H=true
- fi
+ GL_GENERATE_LIMITS_H=true
+ AS_IF([test "$gl_cv_header_limits_width" = yes],
+ [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX],
+ [gl_cv_header_limits_ssize_max],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#include <limits.h>
+ #ifndef SSIZE_MAX
+ #error "SSIZE_MAX is not defined"
+ #endif
+ ]])],
+ [gl_cv_header_limits_ssize_max=yes],
+ [gl_cv_header_limits_ssize_max=no])])
+ if test "$gl_cv_header_limits_ssize_max" = yes; then
+ GL_GENERATE_LIMITS_H=false
+ fi])
])
dnl Unconditionally enables the replacement of <limits.h>.
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 13db996516d..a06f26f672e 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 23
+# manywarnings.m4 serial 24
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson
+AC_PREREQ([2.64])
+
# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
# --------------------------------------------------
# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
@@ -21,7 +23,7 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
*" $gl_warn_item "*)
;;
*)
- gl_AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
+ AS_VAR_APPEND([gl_warn_set], [" $gl_warn_item"])
;;
esac
done
@@ -47,40 +49,29 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
dnl gcc warning categories.
AC_REQUIRE([AC_PROG_CC])
AS_IF([test -n "$GCC"], [
- dnl Check if -Wextra -Werror -Wno-missing-field-initializers is supported
- dnl with the current $CC $CFLAGS $CPPFLAGS.
- AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
- [gl_cv_cc_nomfi_supported],
- [gl_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wextra -Werror -Wno-missing-field-initializers"
+ AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
+ [gl_cv_cc_nomfi_needed],
+ [gl_cv_cc_nomfi_needed=no
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wextra -Werror"
AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [gl_cv_cc_nomfi_supported=yes],
- [gl_cv_cc_nomfi_supported=no])
+ [AC_LANG_PROGRAM(
+ [[struct file_data { int desc, name; };
+ struct cmp { struct file_data file[1]; };
+ void f (struct cmp *r)
+ {
+ typedef struct { int a; int b; } s_t;
+ s_t s1 = { 0, };
+ struct cmp cmp = { .file[0].desc = r->file[0].desc + s1.a };
+ *r = cmp;
+ }
+ ]],
+ [[]])],
+ [],
+ [CFLAGS="$CFLAGS -Wno-missing-field-initializers"
+ AC_COMPILE_IFELSE([],
+ [gl_cv_cc_nomfi_needed=yes])])
CFLAGS="$gl_save_CFLAGS"
- ])
-
- AS_IF([test "$gl_cv_cc_nomfi_supported" = yes], [
- dnl Now check whether -Wno-missing-field-initializers is needed
- dnl for the { 0, } construct.
- AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
- [gl_cv_cc_nomfi_needed],
- [gl_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wextra -Werror"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[int f (void)
- {
- typedef struct { int a; int b; } s_t;
- s_t s1 = { 0, };
- return s1.b;
- }
- ]],
- [[]])],
- [gl_cv_cc_nomfi_needed=no],
- [gl_cv_cc_nomfi_needed=yes])
- CFLAGS="$gl_save_CFLAGS"
- ])
])
dnl Next, check if -Werror -Wuninitialized is useful with the
@@ -159,51 +150,51 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC(C)],
-Wwrite-strings \
\
; do
- gl_AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
+ AS_VAR_APPEND([$1], [" $gl_manywarn_item"])
done
# 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.
- gl_AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
- gl_AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
- gl_AS_VAR_APPEND([$1], [' -Wbidi-chars=any,ucn'])
- gl_AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
- gl_AS_VAR_APPEND([$1], [' -Wformat=2'])
- gl_AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
- gl_AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
- gl_AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
- gl_AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
- gl_AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
- gl_AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
+ AS_VAR_APPEND([$1], [' -Warray-bounds=2'])
+ AS_VAR_APPEND([$1], [' -Wattribute-alias=2'])
+ AS_VAR_APPEND([$1], [' -Wbidi-chars=any,ucn'])
+ AS_VAR_APPEND([$1], [' -Wformat-overflow=2'])
+ AS_VAR_APPEND([$1], [' -Wformat=2'])
+ AS_VAR_APPEND([$1], [' -Wformat-truncation=2'])
+ AS_VAR_APPEND([$1], [' -Wimplicit-fallthrough=5'])
+ AS_VAR_APPEND([$1], [' -Wshift-overflow=2'])
+ AS_VAR_APPEND([$1], [' -Wuse-after-free=3'])
+ AS_VAR_APPEND([$1], [' -Wunused-const-variable=2'])
+ AS_VAR_APPEND([$1], [' -Wvla-larger-than=4031'])
# These are needed for older GCC versions.
if test -n "$GCC" && gl_gcc_version=`($CC --version) 2>/dev/null`; then
case $gl_gcc_version in
'gcc (GCC) '[[0-3]].* | \
'gcc (GCC) '4.[[0-7]].*)
- gl_AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
- gl_AS_VAR_APPEND([$1], [' -funit-at-a-time'])
+ AS_VAR_APPEND([$1], [' -fdiagnostics-show-option'])
+ AS_VAR_APPEND([$1], [' -funit-at-a-time'])
;;
esac
case $gl_gcc_version in
'gcc (GCC) '[[0-9]].*)
- gl_AS_VAR_APPEND([$1], [' -fno-common'])
+ AS_VAR_APPEND([$1], [' -fno-common'])
;;
esac
fi
# Disable specific options as needed.
if test "$gl_cv_cc_nomfi_needed" = yes; then
- gl_AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
+ AS_VAR_APPEND([$1], [' -Wno-missing-field-initializers'])
fi
if test "$gl_cv_cc_uninitialized_supported" = no; then
- gl_AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
+ AS_VAR_APPEND([$1], [' -Wno-uninitialized'])
fi
# This warning have too many false alarms in GCC 11.2.1.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101713
- gl_AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
+ AS_VAR_APPEND([$1], [' -Wno-analyzer-malloc-leak'])
AC_LANG_POP([C])
])
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index 1c12c33ea09..52bd77d2aeb 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -1,23 +1,37 @@
-# ssize_t.m4 serial 5 (gettext-0.18.2)
+# ssize_t.m4 serial 6
dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
-dnl Test whether ssize_t is defined.
+dnl Define ssize_t if it does not already exist.
AC_DEFUN([gt_TYPE_SSIZE_T],
[
- AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
+ AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>]],
[[int x = sizeof (ssize_t *) + sizeof (ssize_t);
return !x;]])],
- [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
- if test $gt_cv_ssize_t = no; then
- AC_DEFINE([ssize_t], [int],
- [Define as a signed type of the same size as size_t.])
+ [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])])
+ if test $gl_cv_ssize_t = no; then
+ dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long',
+ dnl for consistency with the 64-bit size_t.
+ AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1];
+ ]])],
+ [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])])
+ if test $gl_cv_size_t_large = yes; then
+ gl_def_ssize_t='long long'
+ else
+ gl_def_ssize_t='long'
+ fi
+ AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t],
+ [Define as a signed type of the same size as size_t.])
fi
])
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
index ec09609cd42..a0cbc805bc9 100644
--- a/m4/strtoll.m4
+++ b/m4/strtoll.m4
@@ -1,4 +1,4 @@
-# strtoll.m4 serial 10
+# strtoll.m4 serial 11
dnl Copyright (C) 2002, 2004, 2006, 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -19,10 +19,16 @@ AC_DEFUN([gl_FUNC_STRTOLL],
char *term;
/* This test fails on Minix and native Windows. */
{
- const char input[] = "0x";
- (void) strtoll (input, &term, 16);
- if (term != input + 1)
- result |= 1;
+ static char const input[2][3] = {"0x", "0b"};
+ static int const base[] = {0, 2, 10};
+ int i, j;
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
+ {
+ (void) strtoll (input[i], &term, base[j]);
+ if (term != input[i] + 1)
+ result |= 1;
+ }
}
/* This test fails on pre-C23 platforms. */
{
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 063bc5ca64a..1a3107f846d 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,4 +1,4 @@
-# warnings.m4 serial 16
+# warnings.m4 serial 18
dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,14 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson
-# gl_AS_VAR_APPEND(VAR, VALUE)
-# ----------------------------
-# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
-m4_ifdef([AS_VAR_APPEND],
-[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
-[m4_define([gl_AS_VAR_APPEND],
-[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
-
+AC_PREREQ([2.64])
# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
# [PROGRAM = AC_LANG_PROGRAM()])
@@ -34,7 +27,7 @@ esac
m4_pushdef([gl_Positive], [$gl_positive])])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [
gl_save_compiler_FLAGS="$gl_Flags"
- gl_AS_VAR_APPEND(m4_defn([gl_Flags]),
+ AS_VAR_APPEND(m4_defn([gl_Flags]),
[" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["])
AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])],
[AS_VAR_SET([gl_Warn], [yes])],
@@ -97,7 +90,7 @@ AC_DEFUN([gl_UNKNOWN_WARNINGS_ARE_ERRORS_IMPL],
AC_DEFUN([gl_WARN_ADD],
[AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS(]_AC_LANG[)])
gl_COMPILER_OPTION_IF([$1],
- [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])],
+ [AS_VAR_APPEND(m4_if([$2], [], [[WARN_]_AC_LANG_PREFIX[FLAGS]], [[$2]]), [" $1"])],
[],
[$3])
m4_ifval([$2],
@@ -105,6 +98,67 @@ m4_ifval([$2],
[AC_SUBST([WARN_]_AC_LANG_PREFIX[FLAGS])])dnl
])
+
+# gl_CC_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CFLAG_INHIBIT_WARNINGS, to a $(CC) option
+# that reverts all preceding -W* options, if available.
+# This is expected to be '-w' at least on gcc, clang, AIX xlc, xlclang, Sun cc,
+# "compile cl" (MSVC), "compile clang-cl" (MSVC-compatible clang). Or it can be
+# empty.
+AC_DEFUN([gl_CC_INHIBIT_WARNINGS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
+ [gl_cv_cc_winhibit],
+ [rm -f conftest*
+ echo 'int dummy;' > conftest.c
+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null
+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+ gl_cv_cc_winhibit='-w'
+ else
+ gl_cv_cc_winhibit=none
+ fi
+ rm -f conftest*
+ ])
+ case "$gl_cv_cc_winhibit" in
+ none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
+ *) GL_CFLAG_INHIBIT_WARNINGS="$gl_cv_cc_winhibit" ;;
+ esac
+ AC_SUBST([GL_CFLAG_INHIBIT_WARNINGS])
+])
+
+# gl_CXX_INHIBIT_WARNINGS
+# sets and substitutes a variable GL_CXXFLAG_INHIBIT_WARNINGS, to a $(CC) option
+# that reverts all preceding -W* options, if available.
+AC_DEFUN([gl_CXX_INHIBIT_WARNINGS],
+[
+ dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX.
+ if test -n "$CXX" && test "$CXX" != no; then
+ AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
+ [gl_cv_cxx_winhibit],
+ [rm -f conftest*
+ echo 'int dummy;' > conftest.cc
+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null
+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then
+ gl_cv_cxx_winhibit='-w'
+ else
+ gl_cv_cxx_winhibit=none
+ fi
+ rm -f conftest*
+ ])
+ case "$gl_cv_cxx_winhibit" in
+ none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;
+ *) GL_CXXFLAG_INHIBIT_WARNINGS="$gl_cv_cxx_winhibit" ;;
+ esac
+ else
+ GL_CXXFLAG_INHIBIT_WARNINGS=''
+ fi
+ AC_SUBST([GL_CXXFLAG_INHIBIT_WARNINGS])
+])
+
+
# Local Variables:
# mode: autoconf
# End: