This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [patch] [mingw] Fix "%lld" compilation error


> 2012-06-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* common/buffer.c: Include inttypes.h.
> 	(buffer_xml_printf): Use PRIdMAX, PRIuMAX, PRIxMAX and PRIoMAX.

I vaguely remember us not necessarily wanting to use some of those,
but I don't remember the details. Perhaps Mark remembers? It seems
that gnulib might be dealing with portability issues for us...

> --- ./gdb/common/buffer.c-orig	2012-05-22 17:55:30.000000000 +0200
> +++ ./gdb/common/buffer.c	2012-06-15 17:38:21.255770838 +0200
> @@ -25,6 +25,7 @@
>  
>  #include "xml-utils.h"
>  #include "buffer.h"
> +#include "inttypes.h"
>  
>  #include <stdlib.h>
>  #include <string.h>
> @@ -139,16 +140,16 @@ buffer_xml_printf (struct buffer *buffer
>  		  switch (*f)
>  		    {
>  		    case 'd':
> -		      sprintf (str, "%lld", va_arg (ap, long long));
> +		      sprintf (str, "%" PRIdMAX, va_arg (ap, long long));
>  		      break;
>  		    case 'u':
> -		      sprintf (str, "%llu", va_arg (ap, unsigned long long));
> +		      sprintf (str, "%" PRIuMAX, va_arg (ap, unsigned long long));
>  		      break;
>  		    case 'x':
> -		      sprintf (str, "%llx", va_arg (ap, unsigned long long));
> +		      sprintf (str, "%" PRIxMAX, va_arg (ap, unsigned long long));
>  		      break;
>  		    case 'o':
> -		      sprintf (str, "%llo", va_arg (ap, unsigned long long));
> +		      sprintf (str, "%" PRIoMAX, va_arg (ap, unsigned long long));
>  		      break;
>  		    default:
>  		      str = 0;

-- 
Joel


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