* GCC 2.95 provides `__restrict' as an extension to C90 to support the
* C99-specific `restrict' type qualifier. We happen to use `__restrict' as
* a way to define the `restrict' type qualifier without disturbing older
* software that is unaware of C99 keywords.
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
#define __restrict restrict
The flaw here is that C++ compilers don't define __STDC_VERSION so
this always causes __restrict to be defined away, even if the C++
compiler supports it. This prevents use of the GNU extension
__restrict in C++ code. The workaround is to use __restrict__ in user
code which GNU C++ also supports, and which newlib doesn't define
I don't have a patch. I'm hoping someone else writes one. One
possible solution is to use a different keyword inside newlib, e.g.
__newlib_retrict. This way we don't conflict with the compiler
__restrict feature. Though this means newlib functions will be
declared without __restrict. Another solution would be to check for
C++ compilers with __restrict support and support them. Or maybe both
of these are appropriate.