This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: POSIX 2008 C Extensions and restrict Keyword
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Wed, 10 Jul 2013 10:36:50 +0200
- Subject: Re: POSIX 2008 C Extensions and restrict Keyword
- References: <51DC150C dot 1010109 at oarcorp dot com> <51DC3353 dot 5050401 at LGSInnovations dot com>
On 07/09/2013 05:59 PM, Craig Howland wrote:
(1) From the notes, the restrict keyword was added for alignment
with ISO/IEC 9899:1999 which is C99. The current sys/cdefs.h
defines __restrict which is conditionalized based on the compiler
and language version. Would it be OK to start sweeping __restrict
in per POSIX/C99?
I would think that we should want them in there.
Assuming that it is done, however, we should use restrict, not __restrict. The
latter apparently dates from 2000 when the keyword was brand new. Since it is
now pushing 14 years, I suggest that updating sys/cdefs.h to get rid of the __
is in order. More than that, sys/cdefs.h is looking only at GCC versions.
This really would be better as a configure check, as you'd think that any
remotely recent compiler is pretty likely to accept restrict (whether it acts
on it or not).
I updated the "newlib/libc/include/sys/cdefs.h" to match the current FreeBSD
version:
http://www.cygwin.com/ml/newlib/2013/msg00242.html
This makes it easier to use code from FreeBSD (e.g. the network stack). I
would appreciate it if we can keep the compatibility with the FreeBSD version.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.