summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-02-22 23:07:02 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-02-22 23:07:29 -0800
commit19fc364cf851d95d7549b81189287f8ed846e51d (patch)
tree2f141a9b877bc086cd134651d24fc24dd9b85cb7
parent04be2b7a29d65d9a08e64e8e56e594c91749598c (diff)
downloadautoconf-19fc364cf851d95d7549b81189287f8ed846e51d.tar.gz
AC_C_RESTRICT: port better to non-GCC + glibc
Problem reported by Dwight Guth in: http://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html * lib/autoconf/c.m4 (AC_C_RESTRICT): Prefer __restrict__ to __restrict. Also, fix and update some comments.
-rw-r--r--lib/autoconf/c.m416
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 5b25c623..fe87dbfa 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1855,8 +1855,10 @@ AN_IDENTIFIER([restrict], [AC_C_RESTRICT])
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:
+ # http://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;
@@ -1876,13 +1878,13 @@ 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 Sun C++: it does not support _Restrict or
+/* Work around a bug in Sun C++ 5.13: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
- "#define restrict _Restrict" or "#define restrict __restrict__" in the
- previous line. Perhaps some future version of Sun C++ will work with
- restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
+ "#define restrict _Restrict" or "#define restrict __restrict__".
+ Perhaps some future version of Sun C++ will work with restrict;
+ if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__