This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/minor] fix compile warning in linux-proc.c
- From: Randolph Chung <randolph at tausq dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 20 Aug 2003 22:11:49 -0700
- Subject: [patch/minor] fix compile warning in linux-proc.c
- Reply-to: Randolph Chung <randolph at tausq dot org>
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/