From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1474) id 05D753858D37; Fri, 9 Sep 2022 08:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05D753858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662712261; bh=tpKP5TJBDL6DFCj2fywlLwKklITRLzlzM37gzuLBr0Y=; h=From:To:Subject:Date:From; b=AuL4+Eihd0muQA2BjtmwUhgYKxSUVv6UfYUxvN+QaoFO8T7/c8xFPpgixmuoX+YY7 kor22tTPXg+JnMgUZUQNu1MPUOFggqpNJMchKrF1mMNQ9pXCvyM5q/fkBO9ot4AEaA RBZIaYUNXmWiw24jlu36Upp4LVpu46SHoKcN6MG8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jan-Benedict Glaw To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2556] Fix "address will never be NULL" warning X-Act-Checkin: gcc X-Git-Author: Jan-Benedict Glaw X-Git-Refname: refs/heads/master X-Git-Oldrev: b237e36b3864b64894fb4c342f8647e004c8f3de X-Git-Newrev: c2c3e4f6698925c8c969d8525677fbfe98f78909 Message-Id: <20220909083101.05D753858D37@sourceware.org> Date: Fri, 9 Sep 2022 08:31:01 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c2c3e4f6698925c8c969d8525677fbfe98f78909 commit r13-2556-gc2c3e4f6698925c8c969d8525677fbfe98f78909 Author: Jan-Benedict Glaw Date: Fri Sep 9 10:27:27 2022 +0200 Fix "address will never be NULL" warning 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 and produce a warning: "error: the address of 'mingw_format_attribute_overrides' will never be NULL [-Werror=address]" 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/c-family/ChangeLog: * c-format.cc (convert_format_name_to_system_name): Fix warning. gcc/ChangeLog: * 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: --- gcc/c-family/c-format.cc | 3 +-- gcc/doc/tm.texi | 3 ++- gcc/doc/tm.texi.in | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) 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 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 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