Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	  teawater <teawater@gmail.com>
Subject: [RFA record/replay] cast to avoid compiler warning
Date: Sat, 04 Oct 2008 18:45:00 -0000	[thread overview]
Message-ID: <48E7B927.9050207@vmware.com> (raw)

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

Sizeof returns size_t, which is not always the same as int.
This cast will prevent compiler warnings on some architectures
(eg. x86_64)


[-- Attachment #2: sizeof.txt --]
[-- Type: text/plain, Size: 4728 bytes --]

2008-10-03  Michael Snyder  <msnyder@promb-2s-dhcp59.eng.vmware.com>

	* linux-record.c (record_linux_system_call): Cast sizeof to int
	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	3 Oct 2008 23:04:20 -0000
@@ -597,7 +597,7 @@ record_linux_system_call (int num, linux
 	      {
 		fprintf_unfiltered (gdb_stdlog,
 				    "Record: read memory addr = 0x%s len = %d error.\n",
-				    paddr_nz (tmpu32), sizeof (sel));
+				    paddr_nz (tmpu32), (int) sizeof (sel));
 		return (-1);
 	      }
 	    if (record_arch_list_add_mem (sel.inp, tdep->size_fd_set))
@@ -749,7 +749,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_sockaddr))
@@ -775,7 +775,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[3], tdep->size_int))
@@ -799,7 +799,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -809,7 +809,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    paddr_nz (a[2]), (int) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -831,7 +831,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[2])
@@ -841,7 +841,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[2]), sizeof (a[2]));
+					    paddr_nz (a[2]), (int) sizeof (a[2]));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[1], a[2]))
@@ -876,7 +876,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (a[4])
@@ -886,7 +886,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[4]), sizeof (av));
+					    paddr_nz (a[4]), (int) sizeof (av));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem (a[3], av))
@@ -930,7 +930,7 @@ record_linux_system_call (int num, linux
 		  {
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
-					paddr_nz (tmpu32), sizeof (a));
+					paddr_nz (tmpu32), (int) sizeof (a));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (a[1], tdep->size_msghdr))
@@ -944,7 +944,7 @@ record_linux_system_call (int num, linux
 		      {
 			fprintf_unfiltered (gdb_stdlog,
 					    "Record: read memory addr = 0x%s len = %d error.\n",
-					    paddr_nz (a[1]), sizeof (rec));
+					    paddr_nz (a[1]), (int) sizeof (rec));
 			return (-1);
 		      }
 		    if (record_arch_list_add_mem
@@ -968,7 +968,7 @@ record_linux_system_call (int num, linux
 				fprintf_unfiltered (gdb_stdlog,
 						    "Record: read memory addr = 0x%s len = %d error.\n",
 						    paddr_nz (rec.msg_iov),
-						    sizeof (iov));
+						    (int) sizeof (iov));
 				return (-1);
 			      }
 			    if (record_arch_list_add_mem
@@ -1336,7 +1336,7 @@ record_linux_system_call (int num, linux
 		    fprintf_unfiltered (gdb_stdlog,
 					"Record: read memory addr = 0x%s len = %d error.\n",
 					paddr_nz (vec),
-					sizeof (struct record_iovec));
+					(int) sizeof (struct record_iovec));
 		    return (-1);
 		  }
 		if (record_arch_list_add_mem (iov.iov_base, iov.iov_len))

             reply	other threads:[~2008-10-04 18:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-04 18:45 Michael Snyder [this message]
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
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=48E7B927.9050207@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.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