public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] sys/cdefs.h: introduce __restrict_arr, as in glibc Date: Mon, 7 Aug 2023 14:09:50 +0000 (GMT) [thread overview] Message-ID: <20230807140950.8D7BC3858D28@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e66c63be6b800ae19ff21fe2f5c12e231986acb6 commit e66c63be6b800ae19ff21fe2f5c12e231986acb6 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Mon Aug 7 15:59:42 2023 +0200 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Mon Aug 7 15:59:42 2023 +0200 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> Diff: --- newlib/libc/include/sys/cdefs.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index cc1a8a1ccbf5..d13a92a79ee1 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -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
reply other threads:[~2023-08-07 14:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230807140950.8D7BC3858D28@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).