From: "Jose E. Marchesi" <jose.marchesi@oracle.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH V2] Add warning options -W[no-]compare-distinct-pointer-types
Date: Fri, 26 Aug 2022 17:45:52 +0200 [thread overview]
Message-ID: <87h71zdn4f.fsf@oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2208181531380.72069@digraph.polyomino.org.uk> (Joseph Myers's message of "Thu, 18 Aug 2022 15:34:15 +0000")
> On Thu, 18 Aug 2022, Jose E. Marchesi via Gcc-patches wrote:
>
>> diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
>> index de8780a1502..04af02add37 100644
>> --- a/gcc/c/c-typeck.cc
>> +++ b/gcc/c/c-typeck.cc
>> @@ -12397,7 +12397,8 @@ build_binary_op (location_t location, enum tree_code code,
>> }
>> else
>> /* Avoid warning about the volatile ObjC EH puts on decls. */
>> - if (!objc_ok)
>> + if (!objc_ok
>> + && warn_compare_distinct_pointer_types)
>> pedwarn (location, 0,
>> "comparison of distinct pointer types lacks a cast");
>>
>> @@ -12517,8 +12518,9 @@ build_binary_op (location_t location, enum tree_code code,
>> int qual = ENCODE_QUAL_ADDR_SPACE (as_common);
>> result_type = build_pointer_type
>> (build_qualified_type (void_type_node, qual));
>> - pedwarn (location, 0,
>> - "comparison of distinct pointer types lacks a cast");
>> + if (warn_compare_distinct_pointer_types)
>> + pedwarn (location, 0,
>> + "comparison of distinct pointer types lacks a cast");
>
> I think this should use OPT_Wcompare_distinct_pointer_types in place of 0,
> and then you shouldn't need to check warn_compare_distinct_pointer_types
> (as well as the diagnostic then automatically telling the user what option
> controls it).
Ouch, better to use pedwarn the way it is intended to be used yes.
Sorry for the silly overlook :)
Sending a V3 with this modification.
prev parent reply other threads:[~2022-08-26 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 15:44 [PATCH] " Jose E. Marchesi
2022-08-08 18:14 ` Joseph Myers
2022-08-18 13:01 ` [PATCH V2] " Jose E. Marchesi
2022-08-18 15:34 ` Joseph Myers
2022-08-26 15:45 ` Jose E. Marchesi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h71zdn4f.fsf@oracle.com \
--to=jose.marchesi@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).