From: Joseph Myers <joseph@codesourcery.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH V2] Add warning options -W[no-]compare-distinct-pointer-types
Date: Thu, 18 Aug 2022 15:34:15 +0000 [thread overview]
Message-ID: <alpine.DEB.2.22.394.2208181531380.72069@digraph.polyomino.org.uk> (raw)
In-Reply-To: <87a681d7tf.fsf_-_@oracle.com>
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).
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2022-08-18 15:34 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 [this message]
2022-08-26 15:45 ` Jose E. Marchesi
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=alpine.DEB.2.22.394.2208181531380.72069@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jose.marchesi@oracle.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).