aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-08-07 15:59:42 +0200
committerCorinna Vinschen <corinna@vinschen.de>2023-08-07 15:59:42 +0200
commite66c63be6b800ae19ff21fe2f5c12e231986acb6 (patch)
treeed66fd059036635c57ca96705de18d5501a05fc5 /newlib/libc
parent3c75fac130b5720068707f67b12f4372abf4ad38 (diff)
downloadnewlib-e66c63be6b800ae19ff21fe2f5c12e231986acb6.zip
newlib-e66c63be6b800ae19ff21fe2f5c12e231986acb6.tar.gz
newlib-e66c63be6b800ae19ff21fe2f5c12e231986acb6.tar.bz2
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>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/sys/cdefs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index cc1a8a1..d13a92a 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -424,6 +424,19 @@
#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
* code blocks can be reordered such that the predicted path