4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-18 23:12:15 +08:00

sys/cdefs.h: introduce __restrict_arr, as in glibc

C99 allows to define arrays as non-overlappiung using the restrict
keyword.  This is supported by GCC 3.1 and later, but it's not
allowed in C++.

This is in preparation of fixing a Cygwin build problem introduce by
commit 3c75fac130b5.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-08-07 15:59:42 +02:00
parent 3c75fac130
commit e66c63be6b

View File

@ -423,6 +423,19 @@
#define __restrict
#endif
/*
* Additionally, we allow to use `__restrict_arr' for declaring arrays as
* non-overlapping per C99. That's supported since gcc 3.1, but it's not
* allowed in C++.
*/
#if defined(__cplusplus) || !__GNUC_PREREQ__(3, 1)
#define __restrict_arr
#elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#define __restrict_arr restrict
#else
#define __restrict_arr
#endif
/*
* GNU C version 2.96 adds explicit branch prediction so that
* the CPU back-end can hint the processor and also so that