From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ugsj7kznmozjxwbt" 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 List-Id: --ugsj7kznmozjxwbt Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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_FRONTEN= D -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 -Wov= erloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlen= gth-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/../l= ibbacktrace -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 =2E./../gcc/gcc/c-family/c-format.cc: In function 'const char* convert_form= at_name_to_system_name(const char*)': =2E./../gcc/gcc/c-family/c-format.cc:5114:42: error: the address of 'mingw_= format_attribute_overrides' will never be NULL [-Werror=3Daddress] 5114 | if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES !=3D NULL In file included from ./tm.h:26, from ../../gcc/gcc/c-family/c-format.cc:23: =2E./../gcc/gcc/config/i386/mingw32.h:268:44: note: 'mingw_format_attribute= _overrides' declared here 268 | #define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_o= verrides | ^~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~ =2E./../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/t= oolchain-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. 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) =20 #ifdef TARGET_OVERRIDES_FORMAT_ATTRIBUTES /* Check if format attribute is overridden by target. */ - if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES !=3D NULL - && TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT > 0) + if (TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT > 0) { for (i =3D 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_CO= UNT} +must be defined, too. @end defmac =20 @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_CO= UNT} +must be defined, too. @end defmac =20 @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT Okay for HEAD? Thanks, Jan-Benedict --=20 --ugsj7kznmozjxwbt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCYxnLyAAKCRAdvV51g5nh u/jFAJ9iB0LIudYoI/mPdX1Yn2fnVC9XHACfRk09w1MVP+delqQntDMEOg6yOow= =qROS -----END PGP SIGNATURE----- --ugsj7kznmozjxwbt--