]> Savannah Git Hosting - gnulib.git/commitdiff
glob, spawn: Use improved '_Restrict_' definition.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Feb 2020 13:24:04 +0000 (14:24 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Feb 2020 13:24:44 +0000 (14:24 +0100)
* lib/glob.in.h (_Restrict_): Use same definition as in lib/regex.h.
* lib/spawn.in.h (_Restrict_, _Restrict_arr_): Likewise.

ChangeLog
lib/glob.in.h
lib/spawn.in.h

index 5b5b35d227979ae19a5d780b4c576a35f3156c1c..d26227b22c7ac5478cba0114759f544c54ba60a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-23  Bruno Haible  <bruno@clisp.org>
+
+       glob, spawn: Use improved '_Restrict_' definition.
+       * lib/glob.in.h (_Restrict_): Use same definition as in lib/regex.h.
+       * lib/spawn.in.h (_Restrict_, _Restrict_arr_): Likewise.
+
 2020-02-23  Bruno Haible  <bruno@clisp.org>
 
        crypto/gc: Use 'restrict'.
index 1072588ea0ea42ff23657f6e324c15a998a03fb1..7061a253a0996a90ef1871e106ddc421237497e4 100644 (file)
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
+/* For plain 'restrict', use glibc's __restrict if defined.
+   Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
    "restrict", and "configure" may have defined "restrict".
    Other compilers use __restrict, __restrict__, and _Restrict, and
    'configure' might #define 'restrict' to those words, so pick a
    different name.  */
 #ifndef _Restrict_
-# if 199901L <= __STDC_VERSION__
-#  define _Restrict_ restrict
-# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
 #  define _Restrict_ __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _Restrict_ restrict
 # else
 #  define _Restrict_
 # endif
index 4878acb8f86f5c2c04827d0bb6001dec44191b7c..c4dd01aa35f4d53640472d7ead107530ce280d16 100644 (file)
 # define __THROW
 #endif
 
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
+/* For plain 'restrict', use glibc's __restrict if defined.
+   Otherwise, GCC 2.95 and later have "__restrict"; C99 compilers have
    "restrict", and "configure" may have defined "restrict".
    Other compilers use __restrict, __restrict__, and _Restrict, and
    'configure' might #define 'restrict' to those words, so pick a
    different name.  */
 #ifndef _Restrict_
-# if 199901L <= __STDC_VERSION__
-#  define _Restrict_ restrict
-# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
+# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
 #  define _Restrict_ __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _Restrict_ restrict
 # else
 #  define _Restrict_
 # endif
 #endif
-/* gcc 3.1 and up support the [restrict] syntax.  Don't trust
-   sys/cdefs.h's definition of __restrict_arr, though, as it
-   mishandles gcc -ansi -pedantic.  */
+/* For [restrict], use glibc's __restrict_arr if available.
+   Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict].  */
 #ifndef _Restrict_arr_
-# if ((199901L <= __STDC_VERSION__                                      \
-       || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__))     \
-           && !defined __STRICT_ANSI__))                                        \
-      && !defined __GNUG__)
+# ifdef __restrict_arr
+#  define _Restrict_arr_ __restrict_arr
+# elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \
+        && !defined __GNUG__)
 #  define _Restrict_arr_ _Restrict_
 # else
 #  define _Restrict_arr_