* [patch] [mingw] Fix "%lld" compilation error
@ 2012-06-15 15:44 Jan Kratochvil
2012-06-15 15:57 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2012-06-15 15:44 UTC (permalink / raw)
To: gdb-patches
Hi,
gdb-7.4.50.20120615/build_win32/gdb/gdbserver$ i686-w64-mingw32-gcc -c -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -D__USE_MINGW_ACCESS -I. -I../../../gdb/gdbserver -I../../../gdb/gdbserver/../common -I../../../gdb/gdbserver/../regformats -I../../../gdb/gdbserver/../../include -I../../../gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../gdb/gdbserver/../common/buffer.c -DGDBSERVER
../../../gdb/gdbserver/../common/buffer.c: In function 'buffer_xml_printf':
../../../gdb/gdbserver/../common/buffer.c:142:9: error: unknown conversion type character 'l' in format [-Werror=format]
../../../gdb/gdbserver/../common/buffer.c:142:9: error: too many arguments for format [-Werror=format-extra-args]
../../../gdb/gdbserver/../common/buffer.c:145:9: error: unknown conversion type character 'l' in format [-Werror=format]
../../../gdb/gdbserver/../common/buffer.c:145:9: error: too many arguments for format [-Werror=format-extra-args]
../../../gdb/gdbserver/../common/buffer.c:148:9: error: unknown conversion type character 'l' in format [-Werror=format]
../../../gdb/gdbserver/../common/buffer.c:148:9: error: too many arguments for format [-Werror=format-extra-args]
../../../gdb/gdbserver/../common/buffer.c:151:9: error: unknown conversion type character 'l' in format [-Werror=format]
../../../gdb/gdbserver/../common/buffer.c:151:9: error: too many arguments for format [-Werror=format-extra-args]
cc1: all warnings being treated as errors
According to:
http://comments.gmane.org/gmane.comp.gnu.mingw.w64.general/4670
Kai Tietz:
the issue is that formatter-width specifier %ll isn't supported for
all msvcrt-DLL versions
JonY:
Use %I64u on Windows, or just use inttypes.h PRIuMAX.
OK to check it in?
Thanks,
Jan
gdb/
2012-06-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/buffer.c: Include inttypes.h.
(buffer_xml_printf): Use PRIdMAX, PRIuMAX, PRIxMAX and PRIoMAX.
--- ./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;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] [mingw] Fix "%lld" compilation error
2012-06-15 15:44 [patch] [mingw] Fix "%lld" compilation error Jan Kratochvil
@ 2012-06-15 15:57 ` Joel Brobecker
2012-06-15 16:49 ` [patchv2] " Jan Kratochvil
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2012-06-15 15:57 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches, Mark Kettenis
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread* [patchv2] [mingw] Fix "%lld" compilation error
2012-06-15 15:57 ` Joel Brobecker
@ 2012-06-15 16:49 ` Jan Kratochvil
2012-06-28 17:09 ` [commit] " Jan Kratochvil
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2012-06-15 16:49 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches, Mark Kettenis
On Fri, 15 Jun 2012 17:57:16 +0200, Joel Brobecker wrote:
> > 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...
Update, the previous patch broke x86_64 GNU/Linux build.
Thanks,
Jan
gdb/
2012-06-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/buffer.c: Include inttypes.h and stdint.h.
(buffer_xml_printf): Use PRId64, PRIu64, PRIx64 and PRIo64.
--- a/gdb/common/buffer.c
+++ b/gdb/common/buffer.c
@@ -25,10 +25,12 @@
#include "xml-utils.h"
#include "buffer.h"
+#include "inttypes.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <stdint.h>
void
buffer_grow (struct buffer *buffer, const char *data, size_t size)
@@ -139,16 +141,20 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
switch (*f)
{
case 'd':
- sprintf (str, "%lld", va_arg (ap, long long));
+ sprintf (str, "%" PRId64,
+ (int64_t) va_arg (ap, long long));
break;
case 'u':
- sprintf (str, "%llu", va_arg (ap, unsigned long long));
+ sprintf (str, "%" PRIu64,
+ (uint64_t) va_arg (ap, unsigned long long));
break;
case 'x':
- sprintf (str, "%llx", va_arg (ap, unsigned long long));
+ sprintf (str, "%" PRIx64,
+ (uint64_t) va_arg (ap, unsigned long long));
break;
case 'o':
- sprintf (str, "%llo", va_arg (ap, unsigned long long));
+ sprintf (str, "%" PRIo64,
+ (uint64_t) va_arg (ap, unsigned long long));
break;
default:
str = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-28 17:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 15:44 [patch] [mingw] Fix "%lld" compilation error Jan Kratochvil
2012-06-15 15:57 ` Joel Brobecker
2012-06-15 16:49 ` [patchv2] " Jan Kratochvil
2012-06-28 17:09 ` [commit] " Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox