gccgo branch and darwin

Ian Lance Taylor iant@google.com
Wed Dec 1 22:03:00 GMT 2010


Arnaud Lacombe <lacombar@gmail.com> writes:

> On Fri, Nov 19, 2010 at 11:58 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
>
> One nits; is there any reason to use `__xpg_strerror_r()' which is not
> POSIX, versus 'strerror_r()' [0] ?

I did this because on GNU/Linux the POSIX compliant strerror_r is
actually named __xpg_strerror_r.  The <string.h> file is set up such
that that variant is used if strerror_r is called with
-D_XOPEN_SOURCE=600 or _D_POSIX_C_SOURCE=200112L.  If you use
-DGNU_SOURCE, then when calling strerror_r you get the GNU version,
which returns char * rather than int.  This happened because the GNU
version was defined before the POSIX version.


> As RTEMS prototypes has already been mangled to make it return `int'
> instead of the `char *', that would allow to merge all
> `libgo/syscalls/errstr*.go'.

The RTEMS variant assumes the behaviour of the newlib strerror_r.
Declaring it with a return type of int is a bug.


I cleaned up this area to isolate the GNU/Linux dependency with the
following patch.  This should make the code more likely to work on other
systems.  Committed to gccgo branch.

Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 3791 bytes
Desc: strerror_r
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101201/819474bf/attachment.bin>


More information about the Gcc-patches mailing list