[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] AC_C_RESTRICT: update from Autoconf
From: |
Paul Eggert |
Subject: |
[PATCH 3/8] AC_C_RESTRICT: update from Autoconf |
Date: |
Fri, 11 Dec 2020 17:36:38 -0800 |
* m4/gnulib-common.m4 (gl_PROG_CC_C99): Use Autoconf 2.70
as a prerequisite, not 2.69c, since 2.70 is now out.
(AC_C_RESTRICT): Define only for 2.70 or earlier.
Try __restrict__ before __restrict.
---
ChangeLog | 6 ++++++
m4/gnulib-common.m4 | 23 ++++++++++++-----------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9a72ec11..67b06f9af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2020-12-11 Paul Eggert <eggert@cs.ucla.edu>
+ AC_C_RESTRICT: update from Autoconf
+ * m4/gnulib-common.m4 (gl_PROG_CC_C99): Use Autoconf 2.70
+ as a prerequisite, not 2.69c, since 2.70 is now out.
+ (AC_C_RESTRICT): Define only for 2.70 or earlier.
+ Try __restrict__ before __restrict.
+
extensions: update from Autoconf
* m4/extensions.m4 (AC_CHECK_INCLUDES_DEFAULT):
Provide a default implementation for Autoconf 2.69 or earlier.
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 8a40713c0..2c0ae9bef 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 62
+# gnulib-common.m4 serial 63
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -489,9 +489,9 @@ AC_DEFUN([gl_PROG_CC_C99],
dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the
substituted
dnl value of CC will contain the C99 enabling options twice. But this is only
dnl a cosmetic problem.
- dnl With Autoconf >= 2.69c, use AC_PROG_CC since it implies AC_PROG_CC_C99;
+ dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99;
dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete."
- m4_version_prereq([2.69c],
+ m4_version_prereq([2.70],
[AC_REQUIRE([AC_PROG_CC])],
[AC_REQUIRE([AC_PROG_CC_C99])])
])
@@ -567,16 +567,16 @@ Amsterdam
])
# AC_C_RESTRICT
-# This definition is copied from post-2.69 Autoconf and overrides the
-# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed
-# once autoconf >= 2.70 can be assumed. It's painful to check version
-# numbers, and in practice this macro is more up-to-date than Autoconf
-# is, so override Autoconf unconditionally.
+# This definition is copied from post-2.70 Autoconf and overrides the
+# AC_C_RESTRICT macro from autoconf 2.60..2.70.
+m4_version_prereq([2.70.1], [], [
AC_DEFUN([AC_C_RESTRICT],
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
[ac_cv_c_restrict=no
- # The order here caters to the fact that C++ does not require restrict.
- for ac_kw in __restrict __restrict__ _Restrict restrict; do
+ # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see:
+ # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html
+ # Put 'restrict' last, because C++ lacks it.
+ for ac_kw in __restrict__ __restrict _Restrict restrict; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[typedef int *int_ptr;
@@ -596,7 +596,7 @@ AC_DEFUN([AC_C_RESTRICT],
AH_VERBATIM([restrict],
[/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
- supported directly. */
+ supported only directly. */
#undef restrict
/* Work around a bug in older versions of Sun C++, which did not
#define __restrict__ or support _Restrict or __restrict__
@@ -614,6 +614,7 @@ AC_DEFUN([AC_C_RESTRICT],
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
esac
])# AC_C_RESTRICT
+])
# gl_BIGENDIAN
# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
--
2.28.0
- [PATCH 1/8] alloca: update from Autoconf, Paul Eggert, 2020/12/11
- [PATCH 4/8] largefile: just use 2.70, Paul Eggert, 2020/12/11
- [PATCH 3/8] AC_C_RESTRICT: update from Autoconf,
Paul Eggert <=
- [PATCH 5/8] pid_t.m4: just use 2.70, Paul Eggert, 2020/12/11
- [PATCH 2/8] extensions: update from Autoconf, Paul Eggert, 2020/12/11
- [PATCH 6/8] stdint: port to Autoconf 2.70, Paul Eggert, 2020/12/11
- [PATCH 8/8] vararrays: just use 2.70, Paul Eggert, 2020/12/11
- [PATCH 7/8] sys_types: just use 2.70, Paul Eggert, 2020/12/11