This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: [PATCH] Fix potential reent issue
- From: "Howland Craig D (Craig)" <howland at LGSInnovations dot com>
- To: <newlib at sourceware dot org>
- Date: Mon, 24 Jun 2013 10:10:39 -0400
- Subject: RE: [PATCH] Fix potential reent issue
- References: <BLU0-SMTP2494D64FD9A74C0AB89A85FF9890 at phx dot gbl>
> -----Original Message-----
> From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org]
On >Behalf Of Federico Terraneo
> Sent: Sunday, June 23, 2013 7:15 AM
> To: newlib@sourceware.org
> Subject: [PATCH] Fix potential reent issue
>
> ...
> Attached is a patch that implements them by calling __getreent() if
both
> __DYNAMIC_REENT__ and _REENT_ONLY are defined. Note that this came out
> of a code review, I don't have such a setup to test this change, so
> please look at the patch carefully.
From the patch:
+#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__) &&
!defined(__getreent)
+struct _reent * _EXFUN(__getreent, (void));
+#endif
+
/* #define _REENT_ONLY define this to get only reentrant routines */
#ifndef _REENT_ONLY
#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
-#ifndef __getreent
- struct _reent * _EXFUN(__getreent, (void));
-#endif
A #ifndef __getreent gating the __getreent() definition has been lost in
the move. Do you have a reason for this? I don't specifically know why
it is this way (perhaps Jeff does), but presumably it is to allow a
mapping of some kind, as is done for some other things (e.g. HUGE_VAL
in math.h). (Having the gate does seem a little odd, but it seems
prudent to raise the question as to its purpose before removing it.)
Craig