Re: Problem with recent change to getlocalename_l
Dimitar Dimitrov <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <Zb_mvr3T3r7jtpbP@kendros> |
On Thu, Feb 01, 2024 at 08:44:32PM +0100, Corinna Vinschen wrote:
> On Feb 1 20:11, Corinna Vinschen wrote:
> > No, wait.
> >
> > On Feb 1 20:00, Corinna Vinschen wrote:
> > > Given that this new functionality needs a 32 byte buffer, and given that
> > > _REENT_SMALL targets are... well... small, I made the new buffer
> > > optional via `#ifdef _MB_CAPABLE' in struct _misc_reent, which only used
> > > by _REENT_SMALL targets.
> > >
> > > Apparently I missed to take the _REENT_CHECK_MISC expression into account.
> > > AFAICS the culprit is the _REENT_INIT_MISC macro now.
> > >
> > > Can you please check if this change fixes the problem?
> >
> > Try this one instead, please:
>
> Sorry, I suddenly realized that I screwed up the name of the new member
> as well. Sigh.
>
> Please try this one, it's also much simpler:
>
> diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
> index 4e60c3096ae2..0cba1667cc66 100644
> --- a/newlib/libc/include/sys/reent.h
> +++ b/newlib/libc/include/sys/reent.h
> @@ -514,6 +514,11 @@ struct _reent
> #define _REENT_CHECK_EMERGENCY(var) \
> _REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
>
> +#ifdef _MB_CAPABLE
> +#define __REENT_INIT_MISC_GETLOCALENAME_L _r->_misc->_getlocalename_l_buf[0] = '\0'
> +#else
> +#define __REENT_INIT_MISC_GETLOCALENAME_L
> +#endif
> #define _REENT_INIT_MISC(var) do { \
> struct _reent *_r = (var); \
> _r->_misc->_strtok_last = _NULL; \
> @@ -533,7 +538,7 @@ struct _reent
> _r->_misc->_wcrtomb_state.__value.__wch = 0; \
> _r->_misc->_wcsrtombs_state.__count = 0; \
> _r->_misc->_wcsrtombs_state.__value.__wch = 0; \
> - _r->_misc->_getlocale_l_buf[0] = '\0'; \
> + __REENT_INIT_MISC_GETLOCALENAME_L; \
> _r->_misc->_l64a_buf[0] = '\0'; \
> _r->_misc->_getdate_err = 0; \
> } while (0)
>
Hi,
This fixes the build for pru-unknown-elf, and there are no regressions
when running the GCC and newlib testsuites.
Regards,
Dimitar
>
> Sorry,
> Corinna
>