Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/minor] fix compile warning in linux-proc.c
@ 2003-08-21  5:08 Randolph Chung
  2003-08-25 16:48 ` David Carlton
  0 siblings, 1 reply; 4+ messages in thread
From: Randolph Chung @ 2003-08-21  5:08 UTC (permalink / raw)
  To: gdb-patches

While trying to get hppa-linux building with -Werror, I came across one
warning in linux-proc.c that's triggered by -Wformat-nonliteral. This 
patch fixes it if anybody cares :)

thanks,
randolph

2003-08-20  Randolph Chung  <tausq@debian.org>

	* linux-proc.c: rework the code so that it compiles with
	-Wformat-nonliteral -Werror

Index: linux-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-proc.c,v
retrieving revision 1.16
diff -u -p -r1.16 linux-proc.c
--- gdb/linux-proc.c	4 Aug 2003 17:08:22 -0000	1.16
+++ gdb/linux-proc.c	21 Aug 2003 04:54:45 -0000
@@ -404,35 +404,46 @@ linux_info_proc_cmd (char *args, int fro
 	{
 	  long long addr, endaddr, size, offset, inode;
 	  char permissions[8], device[8], filename[MAXPATHLEN];
-	  char *header_fmt_string, *data_fmt_string;
 
+	  printf_filtered ("Mapped address spaces:\n\n");
 	  if (TARGET_ADDR_BIT == 32)
 	    {
-	      header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
-	      data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
-	    }
+	      printf_filtered ("\t%10s %10s %10s %10s %7s\n",
+			   "Start Addr",
+			   "  End Addr",
+			   "      Size", "    Offset", "objfile");
+            }
 	  else
-	    {
-	      header_fmt_string = "  %18s %18s %10s %10s %7s\n";
-	      data_fmt_string = "  %#18lx %#18lx %#10x %#10x %7s\n";
-	    }
-
-	  printf_filtered ("Mapped address spaces:\n\n");
-	  printf_filtered (header_fmt_string,
+            {
+	      printf_filtered ("  %18s %18s %10s %10s %7s\n",
 			   "Start Addr",
 			   "  End Addr",
 			   "      Size", "    Offset", "objfile");
+	    }
 
 	  while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
 			       &offset, &device[0], &inode, &filename[0]))
 	    {
 	      size = endaddr - addr;
-	      printf_filtered (data_fmt_string, (unsigned long) addr,	/* FIXME: pr_addr */
+
+	      if (TARGET_ADDR_BIT == 32)
+	        {
+	          printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
+			       (unsigned long) addr,	/* FIXME: pr_addr */
 			       (unsigned long) endaddr,
 			       (int) size,
 			       (unsigned int) offset,
 			       filename[0] ? filename : "");
-
+		}
+	      else
+	        {
+	          printf_filtered ("  %#18lx %#18lx %#10x %#10x %7s\n",
+			       (unsigned long) addr,	/* FIXME: pr_addr */
+			       (unsigned long) endaddr,
+			       (int) size,
+			       (unsigned int) offset,
+			       filename[0] ? filename : "");
+	        }
 	    }
 
 	  fclose (procfile);
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-27 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21  5:08 [patch/minor] fix compile warning in linux-proc.c Randolph Chung
2003-08-25 16:48 ` David Carlton
2003-08-27  4:25   ` Andrew Cagney
2003-08-27 15:42     ` David Carlton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox