From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33589 invoked by alias); 13 Oct 2019 18:17:18 -0000 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 Received: (qmail 33400 invoked by uid 89); 13 Oct 2019 18:17:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=silence X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 13 Oct 2019 18:17:16 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36261308FC23; Sun, 13 Oct 2019 18:17:15 +0000 (UTC) Received: from f29-4.lan (ovpn-118-26.phx2.redhat.com [10.3.118.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09C3B60C05; Sun, 13 Oct 2019 18:17:14 +0000 (UTC) Date: Sun, 13 Oct 2019 18:17:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH] gdb: Silence -Wformat-nonliteral warning with clang Message-ID: <20191013111714.4a46dbdb@f29-4.lan> In-Reply-To: <20191011205426.1859-1-simon.marchi@efficios.com> References: <20191011205426.1859-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00325.txt.bz2 On Fri, 11 Oct 2019 16:54:26 -0400 Simon Marchi wrote: > We get this warning when building with clang: > > CXX ui-out.o > /home/smarchi/src/binutils-gdb/gdb/ui-out.c:590:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > do_message (style, format, args); > ^~~~~~ > > This can be considered a legitimate warning, as call_do_message's format > parameter is not marked as a format string. Therefore, we should > normally mark the call_do_message method with the `format` attribute. > However, doing so just moves (and multiplies) the problem, as all the > uses of call_do_message in the vmessage method now warn. If we wanted > to continue on that path, we should silence the warning for each of > them, as a way of telling the compiler "it's ok, we know what we are > doing". > > But since call_do_message is really just vmessage's little helper, it's > simpler to just silence the warning at that single point. > > gdb/ChangeLog: > > * ui-out.c (ui_out::call_do_message): Silence > -Wformat-nonliteral warning. LGTM. Kevin