From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26008 invoked by alias); 1 Aug 2003 16:18:24 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26001 invoked from network); 1 Aug 2003 16:18:23 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 1 Aug 2003 16:18:23 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id E6084BFE3; Fri, 1 Aug 2003 09:18:22 -0700 (PDT) To: Andrew Cagney Cc: gdb Subject: Re: -Wformat References: <3F2A903E.9000908@redhat.com> From: David Carlton Date: Fri, 01 Aug 2003 16:18:00 -0000 In-Reply-To: <3F2A903E.9000908@redhat.com> (Andrew Cagney's message of "Fri, 01 Aug 2003 12:07:26 -0400") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-08/txt/msg00006.txt.bz2 On Fri, 01 Aug 2003 12:07:26 -0400, Andrew Cagney said: >> I just downloaded mainline GDB for the first time in far too long, and >> the recent -Wformat-nonliteral change breaks -Werror for me (compiling >> with GCC 3.2.3). I'll include the stderr output of 'make -k' from >> within gdb/ after my signature; I haven't investigated them >> thoroughly, but what I've look at makes me think that >> -Wformat-nonliteral isn't a good idea. > `works for me'. I tested it with: > gcc version 2.95.3 20010315 (release) (NetBSD nb3) > gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2) Actually, I lied slightly: I used GCC 3.2 Red Hat. But I would assume that any recent GCC would show this; the warnings are legitimate. > Looking at the first problem: > breakpoint.c: In function `insert_breakpoints': > breakpoint.c:916: warning: format not a string literal, argument types > not checked > it revealed this little `gem': > static char message1[] = "Error inserting catchpoint %d:\n"; > static char message[sizeof (message1) + 30]; > ... > sprintf (message, message1, b->number); Yup. And further down in the log, you'll run into stuff like fprintf_filtered (stream, local_octal_format_prefix ()); which could easily be fixed by using fputs_filtered. > While getting the option working with a current GCC could mean more > work, I'm not convinced that it's a bad idea. You're right: I was too pessimistic. I just want the -Wformat-nonliteral patch reverted in the meantime. :-) (Actually, if you want to fix the warnings in question quickly, that's fine with me too: I can easily revert it on my local tree.) David Carlton carlton@kealia.com