From patchwork Thu Sep 8 11:02:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Benedict Glaw X-Patchwork-Id: 1091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp184458wrt; Thu, 8 Sep 2022 04:03:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR7m3cULm3DSSRkDuJWzGSuJ+m/Dsv9EtnBoBPmzMZBYsXY2KGJMQUkrcLo6eRMiSrSqE49h X-Received: by 2002:a05:6402:42c3:b0:43d:682f:c0ca with SMTP id i3-20020a05640242c300b0043d682fc0camr6685668edc.334.1662634996681; Thu, 08 Sep 2022 04:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662634996; cv=none; d=google.com; s=arc-20160816; b=x9lUHx9+5zUlRYuvSMroNNWNvUcJTdhNDvv26kPSGKbAN8++O2U6D6c4B8WsHWMNVJ rvUgf1gT2gTSscvtmTy4JErZ4iPrF9Jc+hSp9CSQqJv+IYKoDKOJrhsq3XEuwYdbYnuX SX8fObUSymTQNE7GgBeDmKE2MNMnh6BhgqkJUbGnhiD62bqDmz6KgJ6d8TzV6oGs9RFw q9iz53BGdniLM8t2H4DID90kIb93dJcKHu575f08YnOG3YAN6oACrItzNjNEcMYUSC43 8CM68jSNh5uLYJYksKMo0Xj6XtgjBtPOsZJSDbBze4Z9Ugh90TOA1fhtLUJf+xxiAONh SjXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dmarc-filter :delivered-to; bh=fJm0PM/uPjBXxp3o8I7ud/fITHXbFiXf0wMUNg+Jc90=; b=lprGAfUoRmY0omS5PAjFMR9ASm1EbCOnqANXZ5s4dJuzbhvLAg9sPguQpf0hu+fKp4 uwvsUeEOu5HeWuETtXcMJsLSr7I7ZvjH/v4LjA+eIO8xHHwouQxql0aU5hKI8dAcCk9E Ypjyfkn9DEEiJvKxab+W045mIyAxnSB/+agDDnRbZef8mIYO26jtX+097Jx4PJcrqS9q YrRxrMFzWf4KTBEsLIsSDRFTHQbT4yM/PinVakFx8pKLKPiEuTm6tUPAp9HkZCrab215 Ere81C8rLWxD3Wjj3Idz+XRd9BYSZK002hq3AKi2q4al+93AX6ZzR99NajKfo5yEmTgr 0Bfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id lh17-20020a170906f8d100b0073dd390029asi1624470ejb.535.2022.09.08.04.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 04:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E193F3857408 for ; Thu, 8 Sep 2022 11:03:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from lug-owl.de (lug-owl.de [IPv6:2a03:4000:10:469::]) by sourceware.org (Postfix) with ESMTPS id 329D3385841A for ; Thu, 8 Sep 2022 11:02:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 329D3385841A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id 8DF8F41FAC; Thu, 8 Sep 2022 13:02:34 +0200 (CEST) Date: Thu, 8 Sep 2022 13:02:34 +0200 From: Jan-Benedict Glaw To: gcc-patches@gcc.gnu.org, Jonathan Yong <10walls@gmail.com>, Kai Tietz Subject: [PATCH] mingw32: Fix warning, update documentation Message-ID: <20220908110234.xdj5n7urppr52nh2@lug-owl.de> MIME-Version: 1.0 Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743399154179705255?= X-GMAIL-MSGID: =?utf-8?q?1743399154179705255?= Hi! The mingw32 port is the only port to have TARGET_OVERRIDES_FORMAT_ATTRIBUTES defined. When this macro is defined, it will never evaluate to NULL, so this check just leads to a warning: /usr/lib/gcc-snapshot/bin/g++ -fcf-protection -fno-PIE -c -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -Ic-family -I../../gcc/gcc -I../../gcc/gcc/c-family -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o c-family/c-format.o -MT c-family/c-format.o -MMD -MP -MF c-family/.deps/c-format.TPo ../../gcc/gcc/c-family/c-format.cc ../../gcc/gcc/c-family/c-format.cc: In function 'const char* convert_format_name_to_system_name(const char*)': ../../gcc/gcc/c-family/c-format.cc:5114:42: error: the address of 'mingw_format_attribute_overrides' will never be NULL [-Werror=address] 5114 | if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES != NULL In file included from ./tm.h:26, from ../../gcc/gcc/c-family/c-format.cc:23: ../../gcc/gcc/config/i386/mingw32.h:268:44: note: 'mingw_format_attribute_overrides' declared here 268 | #define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/gcc/c-family/c-format.cc:5079:30: note: in expansion of macro 'TARGET_OVERRIDES_FORMAT_ATTRIBUTES' 5079 | extern const target_ovr_attr TARGET_OVERRIDES_FORMAT_ATTRIBUTES[]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [Makefile:1146: c-family/c-format.o] Error 1 make[1]: Leaving directory '/var/lib/laminar/run/gcc-x86_64-w64-mingw32/1/toolchain-build/gcc' make: *** [Makefile:4588: all-gcc] Error 2 Also, when TARGET_OVERRIDES_FORMAT_ATTRIBUTES is defined, TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT must be defined as well. Add that requirement to the docs. 2022-09-07 Jan-Benedict Glaw gcc/ChangeLog: * c-family/c-format.cc (convert_format_name_to_system_name): Fix warning. * doc/tm.texi.in (TARGET_OVERRIDES_FORMAT_ATTRIBUTES): Document requirement of TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT being defined as well. * doc/tm.texi: Regenerate. Okay for HEAD? Thanks, Jan-Benedict diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc index 68b94da40cc..a6c380bf1c8 100644 --- a/gcc/c-family/c-format.cc +++ b/gcc/c-family/c-format.cc @@ -5111,8 +5111,7 @@ convert_format_name_to_system_name (const char *attr_name) #ifdef TARGET_OVERRIDES_FORMAT_ATTRIBUTES /* Check if format attribute is overridden by target. */ - if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES != NULL - && TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT > 0) + if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT > 0) { for (i = 0; i < TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT; ++i) { diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 5312059ea79..21b849ea32a 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7836,7 +7836,8 @@ If defined, this macro is the number of entries in If defined, this macro is the name of a global variable containing target-specific format overrides for the @option{-Wformat} option. The default is to have no target-specific format overrides. If defined, -@code{TARGET_FORMAT_TYPES} must be defined, too. +@code{TARGET_FORMAT_TYPES} and @code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT} +must be defined, too. @end defmac @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index e47bf28089a..858bfb80cec 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12043,7 +12043,8 @@ If defined, this macro is the number of entries in If defined, this macro is the name of a global variable containing target-specific format overrides for the @option{-Wformat} option. The default is to have no target-specific format overrides. If defined, -@code{TARGET_FORMAT_TYPES} must be defined, too. +@code{TARGET_FORMAT_TYPES} and @code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT} +must be defined, too. @end defmac @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT