This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [mingw] Fix "%lld" compilation error
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Mark Kettenis <kettenis at gnu dot org>
- Date: Fri, 15 Jun 2012 08:57:16 -0700
- Subject: Re: [patch] [mingw] Fix "%lld" compilation error
- References: <20120615154407.GA30377@host2.jankratochvil.net>
> 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