public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/7] Adding declaration of reentrant version of inttypes methods.
@ 2017-07-24 19:33 Aditya Upadhyay
  2017-07-24 22:44 ` Gedare Bloom
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Upadhyay @ 2017-07-24 19:33 UTC (permalink / raw)
  To: newlib; +Cc: Aditya Upadhyay

---
 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);
 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);
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/7] Adding declaration of reentrant version of inttypes methods.
  2017-07-24 19:33 [PATCH 1/7] Adding declaration of reentrant version of inttypes methods Aditya Upadhyay
@ 2017-07-24 22:44 ` Gedare Bloom
  2017-07-25 12:56   ` Sebastian Huber
  0 siblings, 1 reply; 3+ messages in thread
From: Gedare Bloom @ 2017-07-24 22:44 UTC (permalink / raw)
  To: Aditya Upadhyay; +Cc: newlib

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/7] Adding declaration of reentrant version of inttypes methods.
  2017-07-24 22:44 ` Gedare Bloom
@ 2017-07-25 12:56   ` Sebastian Huber
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2017-07-25 12:56 UTC (permalink / raw)
  To: Gedare Bloom, Aditya Upadhyay; +Cc: newlib

On 25/07/17 00:43, Gedare Bloom wrote:

> 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>

I would prefer a forward declaration

struct _reent;

instead of this include.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-25 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-24 19:33 [PATCH 1/7] Adding declaration of reentrant version of inttypes methods Aditya Upadhyay
2017-07-24 22:44 ` Gedare Bloom
2017-07-25 12:56   ` Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).