public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] stdio: fix nano-vfprintf pointer formating with long pointers
@ 2014-11-19 17:02 Peter A. Bigot
  2014-11-20  7:21 ` Bin.Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Peter A. Bigot @ 2014-11-19 17:02 UTC (permalink / raw)
  To: newlib; +Cc: Peter A. Bigot, nickc

On the MSP430 when building with -mlarge sizeof(void*) is larger than
sizeof(int), resulting in an offset error extracting arguments to format
strings that include %p.

stdio/ChangeLog:
2014-11-19  Peter A. Bigot  <pab@pabigot.com>

        * libc/stdio/nano-vfprintf_i.c (_printf_i): Use LONGINT when void* is
        larger than an int.

Cc: nickc@redhat.com
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
---
 newlib/libc/stdio/nano-vfprintf_i.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c
index b75a142..992173b 100644
--- a/newlib/libc/stdio/nano-vfprintf_i.c
+++ b/newlib/libc/stdio/nano-vfprintf_i.c
@@ -150,8 +150,10 @@ _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
        * defined manner.''
        *	-- ANSI X3J11
        */
-      /* NOSTRICT.  */
       pdata->flags |= HEXPREFIX;
+      if (sizeof(void*) > sizeof(int))
+        pdata->flags |= LONGINT;
+      /* NOSTRICT.  */
     case 'x':
       pdata->l_buf[2] = 'x';
       xdigs = "0123456789abcdef";
-- 
1.8.5.5

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

* Re: [PATCH] stdio: fix nano-vfprintf pointer formating with long pointers
  2014-11-19 17:02 [PATCH] stdio: fix nano-vfprintf pointer formating with long pointers Peter A. Bigot
@ 2014-11-20  7:21 ` Bin.Cheng
  2014-11-20 11:41   ` [PATCH v2] " Peter A. Bigot
  0 siblings, 1 reply; 4+ messages in thread
From: Bin.Cheng @ 2014-11-20  7:21 UTC (permalink / raw)
  To: Peter A. Bigot; +Cc: newlib, Nicholas Clifton

On Thu, Nov 20, 2014 at 1:01 AM, Peter A. Bigot <pab@pabigot.com> wrote:
> On the MSP430 when building with -mlarge sizeof(void*) is larger than
> sizeof(int), resulting in an offset error extracting arguments to format
> strings that include %p.
>
> stdio/ChangeLog:
> 2014-11-19  Peter A. Bigot  <pab@pabigot.com>
>
>         * libc/stdio/nano-vfprintf_i.c (_printf_i): Use LONGINT when void* is
>         larger than an int.
>
> Cc: nickc@redhat.com
> Signed-off-by: Peter A. Bigot <pab@pabigot.com>
> ---
>  newlib/libc/stdio/nano-vfprintf_i.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c
> index b75a142..992173b 100644
> --- a/newlib/libc/stdio/nano-vfprintf_i.c
> +++ b/newlib/libc/stdio/nano-vfprintf_i.c
> @@ -150,8 +150,10 @@ _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
>         * defined manner.''
>         *       -- ANSI X3J11
>         */
> -      /* NOSTRICT.  */
>        pdata->flags |= HEXPREFIX;
> +      if (sizeof(void*) > sizeof(int))
Space before '('.

> +        pdata->flags |= LONGINT;
Spaces -> Tab.

> +      /* NOSTRICT.  */
>      case 'x':
>        pdata->l_buf[2] = 'x';
>        xdigs = "0123456789abcdef";
> --
> 1.8.5.5
>

Otherwise good for me, Thanks for fixing the problem.

Thanks,
bin

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

* [PATCH v2] stdio: fix nano-vfprintf pointer formating with long pointers
  2014-11-20  7:21 ` Bin.Cheng
@ 2014-11-20 11:41   ` Peter A. Bigot
  2014-11-20 14:05     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter A. Bigot @ 2014-11-20 11:41 UTC (permalink / raw)
  To: newlib; +Cc: Peter A. Bigot, nickc, amker.cheng

On the MSP430 when building with -mlarge sizeof(void*) is larger than
sizeof(int), resulting in an offset error extracting arguments to format
strings that include %p.

stdio/ChangeLog:
2014-11-19  Peter A. Bigot  <pab@pabigot.com>

        * libc/stdio/nano-vfprintf_i.c (_printf_i): Use LONGINT when void* is
        larger than an int.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
---
v2: conform to coding standards
Cc: nickc@redhat.com
Cc: amker.cheng@gmail.com

 newlib/libc/stdio/nano-vfprintf_i.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c
index b75a142..46945b3 100644
--- a/newlib/libc/stdio/nano-vfprintf_i.c
+++ b/newlib/libc/stdio/nano-vfprintf_i.c
@@ -150,8 +150,10 @@ _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
        * defined manner.''
        *	-- ANSI X3J11
        */
-      /* NOSTRICT.  */
       pdata->flags |= HEXPREFIX;
+      if (sizeof (void*) > sizeof (int))
+	pdata->flags |= LONGINT;
+      /* NOSTRICT.  */
     case 'x':
       pdata->l_buf[2] = 'x';
       xdigs = "0123456789abcdef";
-- 
1.8.5.5

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

* Re: [PATCH v2] stdio: fix nano-vfprintf pointer formating with long pointers
  2014-11-20 11:41   ` [PATCH v2] " Peter A. Bigot
@ 2014-11-20 14:05     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2014-11-20 14:05 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

On Nov 20 05:41, Peter A. Bigot wrote:
> On the MSP430 when building with -mlarge sizeof(void*) is larger than
> sizeof(int), resulting in an offset error extracting arguments to format
> strings that include %p.
> 
> stdio/ChangeLog:
> 2014-11-19  Peter A. Bigot  <...>
> 
>         * libc/stdio/nano-vfprintf_i.c (_printf_i): Use LONGINT when void* is
>         larger than an int.

Patch applied.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-11-20 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 17:02 [PATCH] stdio: fix nano-vfprintf pointer formating with long pointers Peter A. Bigot
2014-11-20  7:21 ` Bin.Cheng
2014-11-20 11:41   ` [PATCH v2] " Peter A. Bigot
2014-11-20 14:05     ` Corinna Vinschen

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