[PATCH v2] Add __pure2 to __locale_ctype_ptr(_l)

Corinna Vinschen vinschen@redhat.com
Wed Nov 8 11:16:00 GMT 2017


On Nov  7 21:29, Wilco Dijkstra wrote:
> Sebastian Huber wrote:
> 
> > Why don't we make
> > 
> > const char *
> > __locale_ctype_ptr (void)
> > {
> >   return __get_current_locale ()->ctype_ptr;
> > }
> >
> > inline?
> >
> > Why do we need the condition in:
> >
> > _ELIDABLE_INLINE struct __locale_t *
> > __get_current_locale (void)
> > {
> >   return _REENT->_locale ?: __get_global_locale ();
> > }
> >
> > Can't we set _REENT->_locale to &__global_locale instead of NULL?
> > 
> > Systems using __getreent() would probably benefit from a __pure2 attribute.
> 
> Absolutely there is no reason not to inline all this. GLIBC has to maintain 
> a consistent ABI because of dynamic linking but that's not relevant to newlib.
> So for single-threaded we could do:
> 
> #define _REENT &_impure_data

No, the __getreent is supposed to hide the actual implementation.
Targets can easily redefine __getreent to be an inline function or
macro, just as they need it, there's no reason to change this.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20171108/156e9df0/attachment.sig>


More information about the Newlib mailing list