This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Link failure with locale routines (when _MB_CAPABLE undefined)

Hi Ulrich,

On Aug 22 18:55, Ulrich Weigand wrote:
> Corinna Vinschen wrote:
> > The problem with !_MB_CAPABLE is that these targets don't support any
> > kind of locale settings at all and, so far, setlocale just returns the
> > fixed string "C".
> > 
> > Thus it seems it doesn't make any sense to expose the POSIX-1.2008
> > locale functions to !_MB_CAPABLE targets at all, so I propose to disable
> > these functions and their prototypes unless #ifdef _MB_CAPABLE.
> > 
> > Thoughts?
> I had a quick look, but I'm not exactly sure what !_MB_CAPABLE
> is supposed to mean, exactly.  Is this supposed to affect the
> list of routines in the public API, or just what the routines do?

I'm not quite sure either, this predates my closer involvement in newlib.
However, in theory using something called _MB_CAPABLE to disable/enable
locale functions doesn't sound quite right.  It looks like _MB_CAPABLE
became one way to simplify and reduce code for small targets at one point.

We could remove the entire _MB_CAPABLE handling from the locale functions.
and thus enable the functionality, but this might add lots of unwanted
code to smaller targets, so I'm not confident here.

On the other hand, on second thought it doesn't seem the right thing to
do to disable the new functions entirely.  After all they are POSIX

So I came up with the attached patch, which enables __global_locale
for !_MB_CAPABLE targets, like your patch, but then accommodates those
targets throughout the new functions instead of disabling them.

Would you mind to give it a try?


Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: 0001-Add-__get_C_locale-inline-function-and-fix-new-local.patch
Description: Text document

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]