From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by sourceware.org (Postfix) with ESMTPS id 29A18385737E; Thu, 12 May 2022 15:19:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29A18385737E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=martin.st Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=martin.st Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 24CFJ9kv027965-24CFJ9kw027965; Thu, 12 May 2022 18:19:09 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id D919DA150B; Thu, 12 May 2022 18:19:08 +0300 (EEST) Date: Thu, 12 May 2022 18:19:08 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: Joseph Myers cc: =?ISO-8859-15?Q?Martin_Li=A8ka?= , Marek Polacek , gcc-patches@gcc.gnu.org, redi@gcc.gnu.org Subject: Re: [PATCH] [12/11/10] Fix invalid format warnings on Windows In-Reply-To: Message-ID: References: <466c29c3-54b1-5627-3d9d-e385ad037a4e@suse.cz> <7fd8d3fb-e0c6-decc-374f-495ab81ab1ff@gmail.com> <8f515605-4fc0-148d-3011-a79f672ea025@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-FE-Policy-ID: 3:14:2:SYSTEM X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2022 15:19:19 -0000 On Wed, 11 May 2022, Joseph Myers wrote: > I'd also like to check that "if mingw-w64 is configured to target UCRT" is > not something that is necessarily known when GCC is built or from the > command-line options passed to GCC. Because ideally one might expect the > TARGET_OVERRIDES_FORMAT_ATTRIBUTES / TARGET_OVERRIDES_FORMAT_INIT > definitions to handle things appropriately conditionally, so that printf > attributes are handled as gnu_printf for the "if mingw-w64 is configured > to target UCRT" case. Disregarding a built-in format attribute when one > is also specified explicitly in the header, even though the two are not > exactly equivalent attributes, as in this patch, seems more like the right > approach in the case where the attributes in installed header (at the time > GCC is run, not the time it is built) *are* the way in which GCC gets the > "configured to target UCRT" information - as opposed to it being something > available before the header is parsed. Indeed, the "configured to target X" information isn't available at the point when GCC is built - that gets set afterwards. And even while it is usually mostly fixed soon afterwards, you can even (with some amount of gotchas) change what CRT to build for by passing the appropriate defines that picks a different default in the mingw-w64 headers. Anyway - from the GCC point of view, it's not fixed, and whatever the parsed headers say, is the only thing that can be relied upon. So I think the approach of the patch is the right one, code style/issues notwithstanding. // Martin