From 74bc3e8b30a125198d56fb9c13129cf9be148c91 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 15 Mar 2018 23:56:03 +0100 Subject: [PATCH] glob: Fix compilation error in C++ mode. * lib/glob.in.h (_Restrict_): Define, like in regex.h and spawn.in.h. --- ChangeLog | 5 +++++ lib/glob.in.h | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7c8d6bbbc6..45628e09be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-03-15 Bruno Haible + + 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 host-cpu-c-abi: Support for RISC-V CPU. diff --git a/lib/glob.in.h b/lib/glob.in.h index 4d71ef8650..cc3f48c43a 100644 --- a/lib/glob.in.h +++ b/lib/glob.in.h @@ -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 -- 2.39.5