From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 87VpDq8vBGZaVBgAWB0awg (envelope-from ) for ; Wed, 27 Mar 2024 10:39:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1711550383; bh=/Ls55vbVYt/LYfTQzjsVQSX+rpIF/fuoD7mY+5dbrVI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=H1siZx0KRLJlK66S76sb3AiTATrqvNjSZ4M85IQXHaowBqNAwsPvEWpxWYicPjuFh h2VpwS5Wsl+GChlYzravTiPGlFqO1YrG5UhjgIsnhIfnSBpUo0OcIKuzTJlETC5oMl /WTBzxJuvTdRW4AImk1AI+OvSOCYQzIsRhNKsgag= Received: by simark.ca (Postfix, from userid 112) id 1F2FB1E0C0; Wed, 27 Mar 2024 10:39:43 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=SmPmJRiP; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DEEC41E030 for ; Wed, 27 Mar 2024 10:39:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4502D3858D20 for ; Wed, 27 Mar 2024 14:39:40 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id B892D3858D20 for ; Wed, 27 Mar 2024 14:39:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B892D3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B892D3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711550361; cv=none; b=NLmsd+TOg8eH6QuublZO3kscQXh4TFBOlwk2/J4mJkAcUB4e9m239sTt3C1IxLIwqfyyVhhFm3DTa0PjfAIQgHqAcj+3WCBSuSLmSkr6CXqwZl6H0uUFyGTdnTH+v1YdDMBPGqmRxtsk+ME438nMw29NQfSYqewmwwuMc2gQORU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711550361; c=relaxed/simple; bh=/Ls55vbVYt/LYfTQzjsVQSX+rpIF/fuoD7mY+5dbrVI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=l1PDI3+xcaqzSwnCg4H5tiJHLnm82hYTi0u6GjPx/9+jZd2cUafbrNOlqbHQLhmQ6wvTmBrVXfnF0uOs2UQT8y/UfwZyEbhpsz8dFDAwniPToaM2cmVho7X/n8FrvM19x7gx3Y1LpBliDIIt4JP7fmicR4y/fTAWBs/bfLbm1zk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1711550359; bh=/Ls55vbVYt/LYfTQzjsVQSX+rpIF/fuoD7mY+5dbrVI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=SmPmJRiPNEyTBlQo03cj1k+Xel3UtW9lEiTZ5t++L9SoPH8r0AkkDECskiF/YkB25 2VA83GQ/whgrkPhvitrNqpYeXtZlar0otMTOcYHsmZlg7+HpWDtWn2mNYFgkPxq5Cf v07M2KOQiSzsL/2ddBw1nZkVMnht7QnYXZqZgblk= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3DBAF1E030; Wed, 27 Mar 2024 10:39:19 -0400 (EDT) Message-ID: <1a9338d3-81a5-4e95-8823-6613781c323c@simark.ca> Date: Wed, 27 Mar 2024 10:39:18 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] Capture warnings when writing to the index cache Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240312144033.77496-1-tromey@adacore.com> <87zfulat8g.fsf@tromey.com> <7fd73e54-4e87-4f2f-ab70-a3fb8194e32a@simark.ca> <87o7azbycz.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87o7azbycz.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 2024-03-27 09:25, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> My interpretation of this is that we bind a function marked with > Simon> `ATTRIBUTE_PRINTF (2,0)` (deferred_warnings::operator()) to a function > Simon> view that doesn't convey the attribute. So I guess the compiler is > Simon> telling us that whenever the function view is invoked, there won't be a > Simon> format string check, and that's dangerous. > > Simon> I didn't find a good fix that :(. > > Please try the appended. > > thanks, > Tom > > commit 8be8061ea5d0ec37289070f16717d3d0aa0c93af > Author: Tom Tromey > Date: Wed Mar 27 07:21:56 2024 -0600 > > patch > > diff --git a/gdb/utils.h b/gdb/utils.h > index d7db1d84e2f..875a2583179 100644 > --- a/gdb/utils.h > +++ b/gdb/utils.h > @@ -444,10 +444,18 @@ struct deferred_warnings > hook; see scoped_restore_warning_hook. Note that no locking is > done, so users have to be careful to only install this into a > single thread at a time. */ > - void operator() (const char *format, va_list args) ATTRIBUTE_PRINTF (2, 0) > + void operator() (const char *format, va_list args) > { > string_file msg (m_can_style); > + /* Clang warns if we add ATTRIBUTE_PRINTF to this method (because > + the function-view wrapper doesn't also have the attribute), but > + then warns again if we remove it, because this vprintf call > + does not use a literal format string. So, suppress the > + warnings here. */ > + DIAGNOSTIC_PUSH > + DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL > msg.vprintf (format, args); > + DIAGNOSTIC_POP > m_warnings.emplace_back (std::move (msg)); > } > It builds fine with that patch. Thanks, Simon