From: Michael Snyder <msnyder@vmware.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "mark@klomp.org" <mark@klomp.org>,
"mark.kettenis@xs4all.nl" <mark.kettenis@xs4all.nl>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
"teawater@gmail.com" <teawater@gmail.com>
Subject: Re: [RFA record/replay] cast to avoid compiler warning
Date: Sun, 05 Oct 2008 20:35:00 -0000 [thread overview]
Message-ID: <48E92487.1@vmware.com> (raw)
In-Reply-To: <u4p3qj0dw.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
Eli Zaretskii wrote:
>> Date: Sun, 05 Oct 2008 11:25:57 -0700
>> From: Michael Snyder <msnyder@vmware.com>
>>
>> OK. So, would you favor using the "%zd" modifier instead of a cast?
>
> What's wrong with casting to "unsigned long" and using %lu?
I know when to give up! ;-)
Like this, then:
[-- Attachment #2: sizeof.txt --]
[-- Type: text/plain, Size: 6387 bytes --]
2008-10-03 Michael Snyder <msnyder@vmware.com>
* linux-record.c (record_linux_system_call): Cast sizeof
in printf calls, avoid compiler warnings on 64 bit hosts.
Index: linux-record.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/linux-record.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 linux-record.c
--- linux-record.c 7 Sep 2008 01:40:43 -0000 1.1.2.4
+++ linux-record.c 5 Oct 2008 20:33:21 -0000
@@ -596,8 +596,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) & sel, sizeof (sel)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (sel));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (sel));
return (-1);
}
if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
@@ -748,8 +748,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
@@ -774,8 +774,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (record_arch_list_add_mem (a[3], tdep->size_int))
@@ -798,8 +798,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (a[2])
@@ -808,8 +808,8 @@ record_linux_system_call (int num, linux
(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (a[2]), sizeof (a[2]));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
return (-1);
}
if (record_arch_list_add_mem (a[1], a[2]))
@@ -830,8 +830,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (a[2])
@@ -840,8 +840,8 @@ record_linux_system_call (int num, linux
(a[2], (gdb_byte *) & (a[2]), sizeof (a[2])))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (a[2]), sizeof (a[2]));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (a[2]), (unsigned long) sizeof (a[2]));
return (-1);
}
if (record_arch_list_add_mem (a[1], a[2]))
@@ -875,8 +875,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (a[4])
@@ -885,8 +885,8 @@ record_linux_system_call (int num, linux
(a[4], (gdb_byte *) & av, sizeof (av)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (a[4]), sizeof (av));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (a[4]), (unsigned long) sizeof (av));
return (-1);
}
if (record_arch_list_add_mem (a[3], av))
@@ -929,8 +929,8 @@ record_linux_system_call (int num, linux
if (target_read_memory (tmpu32, (gdb_byte *) a, sizeof (a)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (tmpu32), sizeof (a));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (tmpu32), (unsigned long) sizeof (a));
return (-1);
}
if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
@@ -943,8 +943,8 @@ record_linux_system_call (int num, linux
(a[1], (gdb_byte *) & rec, sizeof (rec)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
- paddr_nz (a[1]), sizeof (rec));
+ "Record: read memory addr = 0x%s len = %lu error.\n",
+ paddr_nz (a[1]), (unsigned long) sizeof (rec));
return (-1);
}
if (record_arch_list_add_mem
@@ -966,9 +966,9 @@ record_linux_system_call (int num, linux
sizeof (iov)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
+ "Record: read memory addr = 0x%s len = %lu error.\n",
paddr_nz (rec.msg_iov),
- sizeof (iov));
+ (unsigned long) sizeof (iov));
return (-1);
}
if (record_arch_list_add_mem
@@ -1334,9 +1334,9 @@ record_linux_system_call (int num, linux
(vec, (gdb_byte *) & iov, sizeof (struct record_iovec)))
{
fprintf_unfiltered (gdb_stdlog,
- "Record: read memory addr = 0x%s len = %d error.\n",
+ "Record: read memory addr = 0x%s len = %lu error.\n",
paddr_nz (vec),
- sizeof (struct record_iovec));
+ (unsigned long) sizeof (struct record_iovec));
return (-1);
}
if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))
next prev parent reply other threads:[~2008-10-05 20:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-04 18:45 Michael Snyder
2008-10-04 21:53 ` Mark Kettenis
2008-10-05 7:12 ` Andreas Schwab
2008-10-05 9:54 ` Mark Kettenis
2008-10-05 11:02 ` Andreas Schwab
2008-10-05 12:17 ` Mark Wielaard
2008-10-05 15:47 ` Michael Snyder
2008-10-05 16:05 ` Daniel Jacobowitz
2008-10-05 18:28 ` Michael Snyder
2008-10-05 18:40 ` Mark Kettenis
2008-10-05 19:41 ` Eli Zaretskii
2008-10-05 20:35 ` Michael Snyder [this message]
2008-10-05 21:03 ` Mark Kettenis
2008-10-06 7:29 ` teawater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48E92487.1@vmware.com \
--to=msnyder@vmware.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=mark@klomp.org \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox