From: Bruno Haible Date: Sun, 16 Aug 2020 16:44:53 +0000 (+0200) Subject: Use __restrict also on clang. X-Git-Tag: v1.0~3731 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=f79f0b4f919a3270153a64b19d3189c15c939b5b;p=gnulib.git Use __restrict also on clang. * lib/argp.h (__restrict): Don't define as a macro on clang >= 3. * lib/glob.in.h (_Restrict_): Use __restrict on clang >= 3. * lib/unitypes.in.h (_UC_RESTRICT): Likewise. --- diff --git a/ChangeLog b/ChangeLog index b97fcf77cd..46a0d6c5ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-08-16 Bruno Haible + + Use __restrict also on clang. + * lib/argp.h (__restrict): Don't define as a macro on clang >= 3. + * lib/glob.in.h (_Restrict_): Use __restrict on clang >= 3. + * lib/unitypes.in.h (_UC_RESTRICT): Likewise. + 2020-08-16 Bruno Haible pthread-spin: Use GCC built-ins also on clang. diff --git a/lib/argp.h b/lib/argp.h index 808c900b78..c71dd963d8 100644 --- a/lib/argp.h +++ b/lib/argp.h @@ -39,7 +39,8 @@ Other compilers use __restrict, __restrict__, and _Restrict, and 'configure' might #define 'restrict' to those words. */ #ifndef __restrict -# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3) # if 199901L <= __STDC_VERSION__ # define __restrict restrict # else diff --git a/lib/glob.in.h b/lib/glob.in.h index 7061a253a0..d1c0733fa9 100644 --- a/lib/glob.in.h +++ b/lib/glob.in.h @@ -45,7 +45,9 @@ 'configure' might #define 'restrict' to those words, so pick a different name. */ #ifndef _Restrict_ -# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 # define _Restrict_ __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _Restrict_ restrict diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h index b11326dacb..63d0fe3ad6 100644 --- a/lib/unitypes.in.h +++ b/lib/unitypes.in.h @@ -47,7 +47,9 @@ typedef uint32_t ucs4_t; pass a pointer to a different object in the specified pointer argument than in the other pointer arguments. */ #ifndef _UC_RESTRICT -# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 # define _UC_RESTRICT __restrict # elif 199901L <= __STDC_VERSION__ || defined restrict # define _UC_RESTRICT restrict