From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 794 invoked by alias); 17 Jan 2006 19:37:34 -0000 Received: (qmail 785 invoked by uid 22791); 17 Jan 2006 19:37:33 -0000 X-Spam-Check-By: sourceware.org Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.197) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 17 Jan 2006 19:37:31 +0000 Received: by zproxy.gmail.com with SMTP id m22so1421755nzf for ; Tue, 17 Jan 2006 11:37:30 -0800 (PST) Received: by 10.36.4.18 with SMTP id 18mr6094316nzd; Tue, 17 Jan 2006 11:37:29 -0800 (PST) Received: by 10.37.2.42 with HTTP; Tue, 17 Jan 2006 11:37:29 -0800 (PST) Message-ID: <8f2776cb0601171137yffbcd4exefdefe7c8a79bbf3@mail.gmail.com> Date: Tue, 17 Jan 2006 19:37:00 -0000 From: Jim Blandy To: gdb-patches@sourceware.org Subject: Re: [ob] More warnings; Call for assistance In-Reply-To: <20060117152156.GA3115@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060117151730.GA2420@nevyn.them.org> <20060117152156.GA3115@nevyn.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00220.txt.bz2 Looking at the printcmd.c warnings, there's the following note in Makefile.= in: # FIXME: cagney/2003-08-10: Do not try to build "printcmd.c" with # -Wformat-nonliteral. It needs to be overhauled so that it doesn't # pass user input strings as the format parameter to host printf # function calls. printcmd.o: $(srcdir)/printcmd.c $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $(srcdir)/printcmd.c I gather what this is suggesting is that we have a big switch selecting an appropriate call to printf that uses a fixed format string. There will be dozens of cases there, due to the modifiers (h, l, ll, precision, leading sign, alternative form). The precisions will need to be parsed when present; sometimes they are minimum values, sometimes they are maximum values. Since we check the number and type of the arguments, I think -Wformat-nonliteral is the right answer here. I don't see a benefit to making this change that justifies the risk of mistakes. What do folks think?