public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/10416] 'unused variable' warning ignores ctor/dtor side-effects
Date: Mon, 23 Jan 2006 22:23:00 -0000 [thread overview]
Message-ID: <20060123222314.15182.qmail@sourceware.org> (raw)
In-Reply-To: <bug-10416-5473@http.gcc.gnu.org/bugzilla/>
------- Comment #10 from pinskia at gcc dot gnu dot org 2006-01-23 22:23 -------
(In reply to comment #9)
> Of course, the compiler (more precisely the middle-end) knows that the
> destructor has a side-effect. But GCC middle-end tends to have little
> knowledge of language specific idioms. Notice also that a is "used"
> from a very high level abstraction point of view -- not from byte-fiddling
> point of view. This is another instance of diagnostic PR better handed off
> to the front-end.
Actually the diagnostic is done in the front-end in cp/decl.c in poplevel.
/* Before we remove the declarations first check for unused variables. */
if (warn_unused_variable
&& !processing_template_decl)
for (decl = getdecls (); decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == VAR_DECL
&& ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
warning (0, "unused variable %q+D", decl);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10416
next prev parent reply other threads:[~2006-01-23 22:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-10416-5473@http.gcc.gnu.org/bugzilla/>
2005-12-23 0:57 ` pinskia at gcc dot gnu dot org
2006-01-22 10:44 ` gdr at gcc dot gnu dot org
2006-01-23 22:23 ` pinskia at gcc dot gnu dot org [this message]
[not found] <bug-10416-4@http.gcc.gnu.org/bugzilla/>
2012-08-20 11:50 ` paolo.carlini at oracle dot com
2012-08-20 17:39 ` paolo at gcc dot gnu.org
2012-08-20 17:40 ` paolo.carlini at oracle dot com
2012-11-08 15:06 ` paolo.carlini at oracle dot com
[not found] <20030415185600.10416.gccbugs@contacts.eelis.net>
2004-06-10 19:31 ` mutz at kde dot org
2004-06-10 19:41 ` pinskia at gcc dot gnu dot org
2004-06-10 19:43 ` pinskia at gcc dot gnu dot org
2004-08-11 0:02 ` mbp at sourcefrog dot net
2004-08-16 18:56 ` bangerth at dealii dot org
2005-09-07 17:44 ` pinskia at gcc dot gnu dot org
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=20060123222314.15182.qmail@sourceware.org \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/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).