Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-08-07 16:59:42 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-08-07 16:59:42 +0300
commite66c63be6b800ae19ff21fe2f5c12e231986acb6 (patch)
treeed66fd059036635c57ca96705de18d5501a05fc5 /newlib/libc
parent3c75fac130b5720068707f67b12f4372abf4ad38 (diff)
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 cc1a8a1cc..d13a92a79 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