]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* NEWS: Document that AC_C_RESTRICT checks 'restrict' last.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 May 2007 16:54:55 +0000 (16:54 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 May 2007 16:54:55 +0000 (16:54 +0000)
* doc/autoconf.texi (C Compiler): Likewise.

2007-05-14  Noah Misch  <noah@cs.caltech.edu>

* lib/autoconf/c.m4 (AC_C_RESTRICT): Check `restrict' last.

* doc/autoconf.texi (Caching Results): The CACHE-ID variable

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/c.m4

index 2ad87825ea7ee6e164d7bf31aace8182b0f04293..0f2a6908f4d30e2c7cb6f8d521f1dae8920a7ad3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,18 @@
+2007-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: Document that AC_C_RESTRICT checks 'restrict' last.
+       * doc/autoconf.texi (C Compiler): Likewise.
+
+2007-05-14  Noah Misch  <noah@cs.caltech.edu>
+
+       * lib/autoconf/c.m4 (AC_C_RESTRICT): Check `restrict' last.
+
 2007-05-09  Stepan Kasal  <kasal@ucw.cz>
 
        * doc/autoconf.texi: Direntry for "autoconf Invocation"
        renamed to "autoconf-invocation"
 
-       * doc/autoconf.texi (Caching Results): The CACHE-ID variable 
+       * doc/autoconf.texi (Caching Results): The CACHE-ID variable
        in the examples should not use the internal "ac_" prefix.
 
 2007-05-05  Noah Misch  <noah@cs.caltech.edu>
diff --git a/NEWS b/NEWS
index a07ee210858a4d1da9978aa8d9e1efa92b015a27..ca4615b0bc8348eb3e09422395039498be4c6d07 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
 
 ** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
 
+** AC_C_RESTRICT now prefers to #define 'restrict' to a variant spelling
+   like '__restrict' if the variant spelling is available, as this is
+   more likely to work when mixing C and C++ code.
+
 ** AC_CHECK_ALIGNOF's type argument T is now documented better: it must
    be a string of tokens such that "T y;" is a valid member declaration
    in a struct.
index 9abfb940200a2952baa023f02d132c15ecd92817..dd0701dfbc20f67eaf2044752a863618eeacb01e 100644 (file)
@@ -6544,10 +6544,12 @@ New programs need not use this macro.
 @defmac AC_C_RESTRICT
 @acindex{C_RESTRICT}
 @cvindex restrict
-If the C compiler recognizes the @code{restrict} keyword, don't do anything.
-If it recognizes only a variant spelling (@code{__restrict},
-@code{__restrict__}, or @code{_Restrict}), then define
-@code{restrict} to that.
+If the C compiler recognizes a variant spelling for the @code{restrict}
+keyword (@code{__restrict}, @code{__restrict__}, or @code{_Restrict}),
+then define @code{restrict} to that; this is more likely to do the right
+thing with compilers that support language variants where plain
+@code{restrict} is not a keyword.  Otherwise, if the C compiler
+recognizes the @code{restrict} keyword, don't do anything.
 Otherwise, define @code{restrict} to be empty.
 Thus, programs may simply use @code{restrict} as if every C compiler
 supported it; for those that do not, the makefile
index 21d64a1a713fcb30a2a34e8ede727aacd9700ff7..7d816b5d82f7c702008052b87ae90196dc00f527 100644 (file)
@@ -1647,9 +1647,10 @@ fi
 # http://autoconf-archive.cryp.to/acx_restrict.html
 #
 # Determine whether the C/C++ compiler supports the "restrict" keyword
-# introduced in ANSI C99, or an equivalent.  Do nothing if the compiler
-# accepts it.  Otherwise, if the compiler supports an equivalent,
-# define "restrict" to be that.  Here are some variants:
+# introduced in ANSI C99, or an equivalent.  Define "restrict" to the alternate
+# spelling, if any; these are more likely to work in both C and C++ compilers of
+# the same family, and in the presence of varying compiler options.  If only
+# plain "restrict" works, do nothing.  Here are some variants:
 # - GCC supports both __restrict and __restrict__
 # - older DEC Alpha C compilers support only __restrict
 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
@@ -1660,7 +1661,7 @@ AC_DEFUN([AC_C_RESTRICT],
   [ac_cv_c_restrict=no
    # Try the official restrict keyword, then gcc's __restrict, and
    # the less common variants.
-   for ac_kw in restrict __restrict __restrict__ _Restrict; do
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
       [[typedef int * int_ptr;
         int foo (int_ptr $ac_kw ip) {