From: Jason Merrill <jason@redhat.com>
To: Shujing Zhao <pearly.zhao@oracle.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>,
"Gabriel Dos Reis" <gdr@integrable-solutions.net>,
"Paolo Carlini" <paolo.carlini@oracle.com>,
"Manuel López-Ibáñez" <lopezibanez@gmail.com>
Subject: Re: [PATCH, c++] Emit the diagnostic messages of convert_to_void
Date: Fri, 02 Jul 2010 20:15:00 -0000 [thread overview]
Message-ID: <4C2E48BC.3030603@redhat.com> (raw)
In-Reply-To: <4C19F181.1050205@oracle.com>
> + The IMPLICIT is ICV_NULL when the user is explicitly converting an expression
> + to void via a cast.
In that case let's call it ICV_CAST.
Let's improve the error messages here, too.
> + warning (0, "object of incomplete type %qT will not "
> + "be accessed in void context", type);
"conversion to void will not access object of incomplete type %qT"
(Incidentally, I'm surprised these warnings are unconditional rather
than being controlled by a -Wvolatile option or something, but I guess
we can leave that alone for now since volatile is relatively rare.)
> + warning (0, "object of incomplete type %qT will not "
> + "be accessed in second operand of conditional",
"indirection will not access object of incomplete type %qT in second
operand of conditional expression" (or third)
"indirection will not access object of incomplete type %qT in right
operand of comma operator" (or left)
"indirection will not access object of incomplete type %qT in statement"
"indirection will not access object of incomplete type %qT in for
increment expression"
> /* Don't load the value if this is an implicit dereference, or if
> the type needs to be handled by ctors/dtors. */
> else if (is_volatile && (is_reference || TREE_ADDRESSABLE (type)))
Let's split up these cases.
is_reference:
"conversion to void will not access object of type %qT"
"implicit dereference will not access object of type %qT in..."
TREE_ADDRESSABLE:
"conversion to void will not access object of non-trivially-copyable
type %qT"
"indirection will not access object of non-trivially-copyable type %qT
in..."
> + warning (0, "object %qE of incomplete type %qT will not "
> + "be accessed in void context", expr, type);
"conversion to void will not access object %qE of incomplete type %qT"
"variable %qE of incomplete type %qT will not be accessed in..."
> + error ("void cast "
> + "cannot resolve address of overloaded function");
conversion to void, etc.
> + "second operand of conditional "
> + "is a reference, not call, to function %qE", expr);
conditional expression, etc.
> + warning (OPT_Wunused_value,
> + "second operand of conditional has no effect");
Likewise.
Jason
next prev parent reply other threads:[~2010-07-02 20:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 8:49 Shujing Zhao
2010-06-17 9:38 ` Shujing Zhao
2010-06-17 10:21 ` Shujing Zhao
2010-06-17 10:35 ` Shujing Zhao
2010-07-01 6:28 ` Shujing Zhao
2010-07-02 20:15 ` Jason Merrill [this message]
2010-07-05 10:05 ` Shujing Zhao
2010-07-05 19:59 ` Jason Merrill
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=4C2E48BC.3030603@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdr@integrable-solutions.net \
--cc=lopezibanez@gmail.com \
--cc=paolo.carlini@oracle.com \
--cc=pearly.zhao@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).