changeset 39278:8090d30c7a92

glob: Fix compilation error in C++ mode. * lib/glob.in.h (_Restrict_): Define, like in regex.h and spawn.in.h.
author Bruno Haible <bruno@clisp.org>
date Thu, 15 Mar 2018 23:56:03 +0100
parents 27933959db65
children 4aeecac881b3
files ChangeLog lib/glob.in.h
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 15 22:26:09 2018 +0100
+++ b/ChangeLog	Thu Mar 15 23:56:03 2018 +0100
@@ -1,3 +1,8 @@
+2018-03-15  Bruno Haible  <bruno@clisp.org>
+
+	glob: Fix compilation error in C++ mode.
+	* lib/glob.in.h (_Restrict_): Define, like in regex.h and spawn.in.h.
+
 2018-03-15  Bruno Haible  <bruno@clisp.org>
 
 	host-cpu-c-abi: Support for RISC-V CPU.
--- a/lib/glob.in.h	Thu Mar 15 22:26:09 2018 +0100
+++ b/lib/glob.in.h	Thu Mar 15 23:56:03 2018 +0100
@@ -33,6 +33,21 @@
 # define __USE_GNU    1
 #endif
 
+/* 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__)
+#  define _Restrict_ __restrict
+# else
+#  define _Restrict_
+# endif
+#endif
+
 
 #define glob rpl_glob
 #define globfree rpl_globfree