Add global stdio streams support for reent small.
Douglas
info@ourairquality.org
Thu Mar 1 21:36:00 GMT 2018
Hi Jeff,
Updated the comments. The logic for those does not appear to be
consistent in the source code - should it use negative logic on the
#else or repeat the #if logic? An attempt was made to follow the local
conventions in each file, and if you have a preference for negating the
logic on the #else then just let me know?
Re: findfp.c and the lock initialization. The original logic was:
!defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL)
so the lock was not initialized if:
__SINGLE_THREAD__ || _REENT_SMALL
Then using _REENT_SMALL and the _REENT_GLOBAL_STDIO_STREAMS this lock
needs to be initialized here, so an exception for that was added:
!defined(__SINGLE_THREAD__) && !(defined(_REENT_SMALL) &&
!defined(_REENT_GLOBAL_STDIO_STREAMS))
and the lock is not initialized if:
__SINGLE_THREAD__ || (_REENT_SMALL && !_REENT_GLOBAL_STDIO_STREAMS))
Currently _REENT_GLOBAL_STDIO_STREAMS does not work with _REENT_SMALL so
this change does not appear to break that case - this patch is to fix
the case in which these are both used together.
If I have missed a logic case there could you please point to the
combination of options that it does break so I can see that clearly, thanks.
Douglas
On 03/02/2018 07:22 AM, Jeff Johnston wrote:
> Hi Douglas,
>
> A few comments. First of all, please update comments on preprocessor #if,
> #else statements to
> include your changes (e.g. you have added a #else, what does this #else
> mean...e.g. #else /* _REENT_SMALL || _REENT_GLOBAL_STDIO_STREAMS */
> This will aid future maintainers to not have to look all the way back to
> the original #if). This also applies to
> comments for #else statements that are altered by your changes.
>
> That said, I have one code comment.
>
> In findfp.c std, you added "&& !defined(__REENT_GLOBAL_STDIO_STREAMS)" to
> check if the lock for the file should be initialized. I don't understand
> why you added this. AFAICT, this will affect current behaviour.
>
> Regarding slots in the reent structs, yes, they are sometimes there for
> fill, for backwards compatibility. Otherwise, everything needs to be
> recompiled/relinked.
>
> -- Jeff J.
>
> On Wed, Feb 28, 2018 at 7:58 AM, Douglas <info@ourairquality.org> wrote:
>
>> The global stdio streams option did not appear to work with reent small
>> option, but these two options are both useful on a low memory system.
>>
>> This seems to simplify the reent small code in this area when using the
>> global stdio streams option. The fake streams and some of the checking
>> is not longer necessary.
>>
>> btw the __sf slot in the reent small struct _reent appears to be unused.
>> Could that be removed, or is it fill for backwards compatibility?
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-global-stdio-streams-support-for-reent-small.patch
Type: text/x-patch
Size: 5474 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20180301/3a41343a/attachment.bin>
More information about the Newlib
mailing list