From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8740 invoked by alias); 21 Aug 2003 05:08:14 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8684 invoked from network); 21 Aug 2003 05:08:04 -0000 Received: from unknown (HELO pippin.tausq.org) (64.81.244.94) by sources.redhat.com with SMTP; 21 Aug 2003 05:08:04 -0000 Received: by pippin.tausq.org (Postfix, from userid 1000) id ADE48CD365; Wed, 20 Aug 2003 22:11:49 -0700 (PDT) Date: Thu, 21 Aug 2003 05:08:00 -0000 From: Randolph Chung To: gdb-patches@sources.redhat.com Subject: [patch/minor] fix compile warning in linux-proc.c Message-ID: <20030821051149.GB21328@tausq.org> Reply-To: Randolph Chung Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-PGP: for PGP key, see http://www.tausq.org/pgp.txt X-GPG: for GPG key, see http://www.tausq.org/gpg.txt User-Agent: Mutt/1.5.3i X-SW-Source: 2003-08/txt/msg00358.txt.bz2 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 * 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/