From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 8D7BC3858D28; Mon, 7 Aug 2023 14:09:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D7BC3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691417390; bh=rTdiN4nZBMs5snGlUm5cc/vaWs5Se6pkPE/T0YQ5z/Q=; h=From:To:Subject:Date:From; b=xEVLHZbJX6K+PR7xia9+OaXdfckBm4IG6zx2hGPtM6RW/TZPGoMxA0isU8v/MBB57 M6zpzcpKFhBf57EWZSJrj++PH0RAEj0NSq2UTnBVuvXG4V3O8ZBOpF2vf3vySG1wly /6KfSY40FGXTd9dmzCVPo73cm1xBaWI3r4/mX6o8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] sys/cdefs.h: introduce __restrict_arr, as in glibc X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 3c75fac130b5720068707f67b12f4372abf4ad38 X-Git-Newrev: e66c63be6b800ae19ff21fe2f5c12e231986acb6 Message-Id: <20230807140950.8D7BC3858D28@sourceware.org> Date: Mon, 7 Aug 2023 14:09:50 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3De66c63be6b8= 00ae19ff21fe2f5c12e231986acb6 commit e66c63be6b800ae19ff21fe2f5c12e231986acb6 Author: Corinna Vinschen AuthorDate: Mon Aug 7 15:59:42 2023 +0200 Commit: Corinna Vinschen CommitDate: Mon Aug 7 15:59:42 2023 +0200 sys/cdefs.h: introduce __restrict_arr, as in glibc =20 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++. =20 This is in preparation of fixing a Cygwin build problem introduce by commit 3c75fac130b5. =20 Signed-off-by: Corinna Vinschen 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/cdef= s.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 =20 +/* + * 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__ >=3D 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