[PATCH 1/7] Adding declaration of reentrant version of inttypes methods.

Gedare Bloom gedare@rtems.org
Mon Jul 24 22:44:00 GMT 2017


On Mon, Jul 24, 2017 at 3:33 PM, Aditya Upadhyay <aadit0402@gmail.com> wrote:
> ---
>  newlib/libc/include/inttypes.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
> index 25c6e99fa..c2a0483fb 100644
> --- a/newlib/libc/include/inttypes.h
> +++ b/newlib/libc/include/inttypes.h
> @@ -16,10 +16,16 @@
>  #include <newlib.h>
>  #include <sys/config.h>
>  #include <sys/_intsup.h>
> +#include "_ansi.h"
> +#include <sys/reent.h>
>  #include <stdint.h>
>  #define __need_wchar_t
>  #include <stddef.h>
>
> +#if __POSIX_VISIBLE >= 200809
> +#include <xlocale.h>
> +#endif
> +
>  #define __STRINGIFY(a) #a
>
>  /* 8-bit types */
> @@ -315,9 +321,17 @@ extern "C" {
>
>  extern intmax_t  imaxabs(intmax_t j);
>  extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
> +extern intmax_t  strtoimax_l(const char *__restrict, char **_restrict, int, locale_t);
> +extern intmax_t  _strtoimax_r(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
I think it would be better to add these function declarations to the
corresponding patch that adds the function definitions, e.g. this
should go with the strtoimax.c changes.

>  extern intmax_t  strtoimax(const char *__restrict, char **__restrict, int);
> +extern uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, locale_t);
> +extern uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
So these two would be added by the patch adding the code for
strtoumax_l and strtoumax_r.

>  extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
> +extern intmax_t  wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
> +extern intmax_t  _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
>  extern intmax_t  wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
> +extern uintmax_t wcstoumax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
> +extern uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
>  extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
>
>  #ifdef __cplusplus
> --
> 2.13.0
>



More information about the Newlib mailing list