This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [patch] inline __getreent in newlib
On Fri, Sep 07, 2007 at 04:19:12PM -0700, Brian Dessent wrote:
>Brian Dessent wrote:
>
>> Done. I added the following comment to config.h to hopefully clarify
>> the situation:
>>
>> /* The following provides an inline version of __getreent() for newlib,
>> which will be used throughout the library whereever there is a _r
>> version of a function that takes _REENT. This saves the overhead
>> of a function call for what amounts to a simple computation.
>>
>> The definition below is essentially equivalent to the one in cygtls.h
>> (&_my_tls.local_clib) however it uses a fixed precomputed
>> offset rather than dereferencing a field of a structure.
>>
>> Including tlsoffets.h here in order to get this constant offset
>> tls_local_clib is a bit of a hack, but the alternative would require
>> dragging the entire definition of struct _cygtls (a large and complex
>> Cygwin internal data structure) into newlib. The machinery to
>> compute these offsets already exists for the sake of gendef so
>> we might as well just use it here. */
>
>Turns out that <sys/config.h> includes <cygwin/config.h>, which leads to
>this breakage when the winsup headers are installed in the system
>location:
>
>$ echo "#include <math.h>" | gcc -x c -
>In file included from /usr/include/sys/config.h:180,
> from /usr/include/_ansi.h:16,
> from /usr/include/sys/reent.h:13,
> from /usr/include/math.h:5,
> from <stdin>:1:
>/usr/include/cygwin/config.h:22:27: ../tlsoffsets.h: No such file or
>directory
>
>Attached patch fixes the situation by only exposing this when
>_COMPILING_NEWLIB. Ok?
Yes.
Thanks.
cgf