This is the mail archive of the
mailing list for the newlib project.
Re: Add realpath Prototype
- From: Craig Howland <howland at LGSInnovations dot com>
- To: newlib at sourceware dot org
- Date: Wed, 20 Nov 2013 11:13:51 -0500
- Subject: Re: Add realpath Prototype
- Authentication-results: sourceware.org; auth=none
- References: <528A5B4B dot 2020606 at oarcorp dot com> <528A5D6C dot 2070307 at users dot sourceforge dot net> <528A6B45 dot 70208 at oarcorp dot com> <20131119114241 dot GA18847 at calimero dot vinschen dot de> <20131120094650 dot GA19426 at calimero dot vinschen dot de> <528CBB47 dot 5030506 at oarcorp dot com> <20131120142618 dot GP2936 at calimero dot vinschen dot de> <528CC8BD dot 9040803 at oarcorp dot com> <20131120150231 dot GR2936 at calimero dot vinschen dot de>
On 11/20/2013 10:02 AM, Corinna Vinschen wrote:
I propose that we use only #if !defined(__STRICT_ANSI__). We could spend many,
many hours trying to add "proper" gates to many functions, but there is very
little gain to be had by such an effort. Determining what is "correct" across
all flavors and stuff would be very difficult, if not impossible.
On Nov 20 08:35, Joel Sherrill wrote:
On 11/20/2013 8:26 AM, Corinna Vinschen wrote:
On Nov 20 07:38, Joel Sherrill wrote:
On 11/20/2013 3:46 AM, Corinna Vinschen wrote:
On Nov 19 12:42, Corinna Vinschen wrote:
On Nov 18 13:32, Joel Sherrill wrote:
On 11/18/2013 12:33 PM, Yaakov (Cygwin/X) wrote:
. Thanks. The guards are tricky. glibc has
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
marks it as XSI with no explicit macros that I am spotting.
Is that close enough?
I don't understand the question. BSD and XOPEN don't correspond
to strict ANSI.
I was just pointing out that glibc has BSD and XOPEN as guards.
Is that equivalent?
It's not exactly equivalent, but __USE_BSD and __USE_XOPEN_EXTENDED
are probably not set if strict ANSI is requested.
For example, we could rather easily use the __POSIX_VISIBLE that Sebastion
points out is in use by Free BSD, for example--a good thought. But this is not
fully correct, even for POSIX, because it is an over-simplification. realpath
is listed as having been added for POSIX version 2, so that it really should not
be included for POSIX 1. But, as already discussed and accepted for readdir_r,
that version change was more than 20 years ago, and the distinction does not
really make sense now--using __POSIX_VISIBLE would not be an unreasonable,
although not-completely-accurate, gate.
However, the thing of primary interest here, I think, is that realpath is in
stdlib.h, which is an ANSI C header. So if someone wants strict ANSI, leave it
out. Otherwise, let it be there and spare the pain of figuring out whether
POSIX or BSD or whatever has it. (That is, why even bother with POSIX_VISIBLE?
It's only the prototype. It's not like we're leaving it out of the library.)
Newlib is not trying for strict POSIX compliance, is it? (Loose, perhaps, but
I suggest that this be the principle to be used up to some cutoff date. So, for
example, something added in POSIX 2008 perhaps should have a version gate.
(This would be a much more tractable problem.) Or do we even want to bother
with that? Perhaps a new thread should be started to try and decide a general
policy so that we don't need to try and answer the question for every function
that might need some help. Do you have more in your list to be done, Joel, or
is this close to the last of this flavor?