Mail Archives: djgpp-workers/2000/04/24/01:13:08
On Sun, 23 Apr 2000, Martin Str|mberg wrote:
> According the the gcc manual restrict is only available if
> "-flang-isoc9x" option is given to gcc. And that seems to be a
> documentation bug, you need to use "-std=iso9899:199x according to
> <http://gcc.gnu.org/ml/gcc-bugs/1999-11n/msg00793.html>.
Yes, this is a known bug.
> So I sueggest we use __restrict__ instead of restrict which seems to
> be recognised always (I guess, from the documentation).
What docs says __restrict__ is always recognised? And what does
``always'' mean here?
> So how far back was __restrict__ supported?
The following example (from the C99 standard) doesn't compile with GCC
2.7.2.1:
void foo (int n, int * __restrict__ p, int * __restrict__ q)
{
while (n-- > 0)
*p++ = *q++;
}
The #ifdef magic below (lifted from the GCC bug-reporting list) seems
to imply that __restrict__ is only supported in GCC 2.91 and later.
> Or can we demand that users of DJGPP v. 2.04 use gcc 2.95.2?
I would like to avoid requiring specific versions of GCC, unless we
absolutely must.
> Or do you know/suggest a different approach (some magic #define
> somewhere, perhaps)?
I suggest the following:
#if __STDC_VERSION__ >= 199901
#elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 91
#define restrict __restrict__
#else
#define restrict
#endif
In a recent discussion, this seems to have got a semi-formal blessing
of at least one GCC maintainer.
- Raw text -