public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29028] No warning about unused names introduced with using declarations
       [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
@ 2011-11-06 23:28 ` paolo.carlini at oracle dot com
  2012-09-21  9:29 ` dodji at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-06 23:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|gcc-bugs at gcc dot gnu.org |dodji at gcc dot gnu.org

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-06 23:27:11 UTC ---
Adding Dodji in CC, the issue reminds me so much the "unused typedef"
warning...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
       [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
  2011-11-06 23:28 ` [Bug c++/29028] No warning about unused names introduced with using declarations paolo.carlini at oracle dot com
@ 2012-09-21  9:29 ` dodji at gcc dot gnu.org
  2012-09-21 13:02 ` dodji at seketeli dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-09-21  9:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
       [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
  2011-11-06 23:28 ` [Bug c++/29028] No warning about unused names introduced with using declarations paolo.carlini at oracle dot com
  2012-09-21  9:29 ` dodji at gcc dot gnu.org
@ 2012-09-21 13:02 ` dodji at seketeli dot org
  2012-09-28 12:52 ` dodji at gcc dot gnu.org
  2012-09-28 13:02 ` dodji at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: dodji at seketeli dot org @ 2012-09-21 13:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028

--- Comment #3 from dodji at seketeli dot org <dodji at seketeli dot org> 2012-09-21 13:02:15 UTC ---
A candidate patch has been sent to
http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01540.html.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
       [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-09-21 13:02 ` dodji at seketeli dot org
@ 2012-09-28 12:52 ` dodji at gcc dot gnu.org
  2012-09-28 13:02 ` dodji at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-09-28 12:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-09-28 12:51:42 UTC ---
Author: dodji
Date: Fri Sep 28 12:51:30 2012
New Revision: 191829

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191829
Log:
PR c++/29028 - Missed unused warning on using declaration

In the example of the patch, g++ fails to warn that the variable N::i
(introduced via a using declaration) is unused.

This is because as we want to emit the warning in poplevel, when we
walk the local bindings returned by getdecls, we forget that a
VAR_DECL introduced by a using declaration is represented by a
TREE_LIST which TREE_VALUE is the VAR_DECL, and we wrongly look for a
bare VAR_DECL.

Fixed thus and tested on x86_64-unknown-linux-gnu against trunk.

gcc/cp/

    * decl.c (poplevel<warn_unused*>): Do not forget that some local
    bindings are represented by a TREE_LIST.

gcc/testsuite/

    * g++.dg/warn/Wunused-var-18.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wunused-var-18.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
       [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-09-28 12:52 ` dodji at gcc dot gnu.org
@ 2012-09-28 13:02 ` dodji at gcc dot gnu.org
  4 siblings, 0 replies; 7+ messages in thread
From: dodji at gcc dot gnu.org @ 2012-09-28 13:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-09-28 13:01:56 UTC ---
Fixed in trunk (4.8)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
  2006-09-11 21:55 [Bug c++/29028] New: " amylaar at gcc dot gnu dot org
  2006-09-12  3:58 ` [Bug c++/29028] " bangerth at dealii dot org
@ 2006-09-13  6:28 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-13  6:28 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/29028] No warning about unused names introduced with using declarations
  2006-09-11 21:55 [Bug c++/29028] New: " amylaar at gcc dot gnu dot org
@ 2006-09-12  3:58 ` bangerth at dealii dot org
  2006-09-13  6:28 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2006-09-12  3:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2006-09-12 03:58 -------
At first I thought that the warning is not useful since the variable may
in fact not be unused at all -- the using declaration simply makes the
name available in the present scope.

However, then I realized that this also holds here:
----------------
void f()
{
  extern int i;
}
----------------
For this code, we warn, though:

g/x> /home/bangerth/bin/gcc-4.2-pre/bin/c++ -Wunused -c x.cc
x.cc: In function &#8216;void f()&#8217;:
x.cc:3: warning: unused variable &#8216;i&#8217;

So for the sake of consistency, we should probably do the same in both
situations, whatever "the same" is here.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-12 03:58:07
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-28 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-29028-4@http.gcc.gnu.org/bugzilla/>
2011-11-06 23:28 ` [Bug c++/29028] No warning about unused names introduced with using declarations paolo.carlini at oracle dot com
2012-09-21  9:29 ` dodji at gcc dot gnu.org
2012-09-21 13:02 ` dodji at seketeli dot org
2012-09-28 12:52 ` dodji at gcc dot gnu.org
2012-09-28 13:02 ` dodji at gcc dot gnu.org
2006-09-11 21:55 [Bug c++/29028] New: " amylaar at gcc dot gnu dot org
2006-09-12  3:58 ` [Bug c++/29028] " bangerth at dealii dot org
2006-09-13  6:28 ` pinskia at gcc dot gnu dot org

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).