Hi Paul, > --- lib/regex.h 10 Aug 2006 20:08:01 -0000 1.38 > +++ lib/regex.h 27 Nov 2006 07:15:02 -0000 > @@ -635,14 +635,17 @@ > # endif > # endif > #endif > -/* gcc 3.1 and up support the [restrict] syntax. */ > -#ifndef __restrict_arr > -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \ > - && !defined __GNUG__ > -# define __restrict_arr __restrict > -# else > -# define __restrict_arr > -# 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. */ > +#undef __restrict_arr > +#if (defined __GNUG__ \ > + || (__STDC_VERSION__ < 199901L \ > + && (__STRICT_ANSI__ \ > + || (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1))))) > +# define __restrict_arr > +#else > +# define __restrict_arr __restrict > #endif
I would find the inverted condition easier to understand. If in our mind we have the question "when is it safe to use __restrict?", we'll get safer code than if we ask "which are the conditions which force us to not use __restrict?". Also, I consider the __GNUG__ and __STRICT_ANSI__ case some exceptions to the general rules, and therefore they should be mentioned after the general rule, not before. How about this? *** lib/regex.h 27 Nov 2006 07:15:26 -0000 1.39 --- lib/regex.h 27 Nov 2006 13:44:35 -0000 *************** *** 639,651 **** sys/cdefs.h's definition of __restrict_arr, though, as it mishandles gcc -ansi -pedantic. */ #undef __restrict_arr ! #if (defined __GNUG__ \ ! || (__STDC_VERSION__ < 199901L \ ! && (__STRICT_ANSI__ \ ! || (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1))))) ! # define __restrict_arr ! #else # define __restrict_arr __restrict #endif /* POSIX compatibility. */ --- 639,651 ---- sys/cdefs.h's definition of __restrict_arr, though, as it mishandles gcc -ansi -pedantic. */ #undef __restrict_arr ! #if (__STDC_VERSION__ >= 199901L \ ! || (((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) \ ! && !__STRICT_ANSI__)) \ ! && !defined __GNUG__ # define __restrict_arr __restrict + #else + # define __restrict_arr #endif /* POSIX compatibility. */