From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8410 invoked by alias); 9 Feb 2007 09:08:51 -0000 Received: (qmail 8401 invoked by uid 22791); 9 Feb 2007 09:08:49 -0000 X-Spam-Check-By: sourceware.org Received: from tamu-relay.tamu.edu (HELO tr-1-int.cis.tamu.edu) (165.91.22.121) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Feb 2007 09:08:42 +0000 Received: from localhost (localhost.tamu.edu [127.0.0.1]) by tr-1-int.cis.tamu.edu (Postfix) with ESMTP id EC0441561B for ; Fri, 9 Feb 2007 03:08:40 -0600 (CST) Received: from postal.cs.tamu.edu (mailhost.cs.tamu.edu [128.194.138.100]) by tr-1-int.cis.tamu.edu (Postfix) with ESMTP id CA80415616; Fri, 9 Feb 2007 03:08:38 -0600 (CST) Received: from soliton.cs.tamu.edu (vpn-25.cs.tamu.edu [128.194.150.25]) by postal.cs.tamu.edu (Postfix) with ESMTP id A339D46DE01; Fri, 9 Feb 2007 03:08:38 -0600 (CST) Received: by soliton.cs.tamu.edu (Postfix, from userid 1000) id 84BAB1AA37; Fri, 9 Feb 2007 03:08:38 -0600 (CST) To: gdb-patches@sourceware.org Cc: dan@codesourcery.com Subject: PATCH to gdb/linux-nat.c From: Gabriel Dos Reis Date: Fri, 09 Feb 2007 09:08:00 -0000 Message-ID: <87odo3ofzd.fsf@soliton.cs.tamu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00119.txt.bz2 Hi, This patchlet fixes the build failure [...] gcc -c -g -O2 -I. -I/home/gdr/redhat/src/gdb -I/home/gdr/redhat/src/gdb/config -DLOCALEDIR="\"/home/gdr/share/locale\"" -DHAVE_CONFIG_H -I/home/gdr/redhat/src/gdb/../include/opcode -I/home/gdr/redhat/src/gdb/../readline/.. -I../bfd -I/home/gdr/redhat/src/gdb/../bfd -I/home/gdr/redhat/src/gdb/../include -DMI_OUT=1 -DTUI=1 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wno-switch -Werror /home/gdr/redhat/src/gdb/linux-nat.c cc1: warnings being treated as errors /home/gdr/redhat/src/gdb/linux-nat.c: In function 'linux_nat_find_memory_regions': /home/gdr/redhat/src/gdb/linux-nat.c:2556: warning: the address of 'filename' will always evaluate as 'true' make[2]: *** [linux-nat.o] Error 1 for a native configuration on an i686-pc-linux-gnu and a build with SVN GCC. The problem is that the existing code was testing whether the value of 'filename' is null. That test is statically known to be false since 'filename' is declared as a local array variable. OK to apply? -- Gaby 2007-02-09 Gabriel Dos Reis * linux-nat.c (linux_nat_find_memory_regions): Don't check the address of 'filename'; it is always non null. Index: gdb/linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/linux-nat.c,v retrieving revision 1.55 diff -p -r1.55 linux-nat.c *** gdb/linux-nat.c 9 Jan 2007 17:58:51 -0000 1.55 --- gdb/linux-nat.c 9 Feb 2007 08:58:04 -0000 *************** linux_nat_find_memory_regions (int (*fun *** 2553,2559 **** size, paddr_nz (addr), read ? 'r' : ' ', write ? 'w' : ' ', exec ? 'x' : ' '); ! if (filename && filename[0]) fprintf_filtered (gdb_stdout, " for %s", filename); fprintf_filtered (gdb_stdout, "\n"); } --- 2553,2559 ---- size, paddr_nz (addr), read ? 'r' : ' ', write ? 'w' : ' ', exec ? 'x' : ' '); ! if (filename[0]) fprintf_filtered (gdb_stdout, " for %s", filename); fprintf_filtered (gdb_stdout, "\n"); }