public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33255]  New: A warning for "unused" typedefs?
@ 2007-08-30 23:21 pcarlini at suse dot de
  2007-08-30 23:30 ` [Bug c++/33255] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-30 23:21 UTC (permalink / raw)
  To: gcc-bugs

Just a wild idea, motivated by libstdc++/33084: in that case we had a function
with this body:

      typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure;
      typedef typename __fun<_Name, _Tp>::result_type _Rt;
      return _Expr<_Closure, _Tp>(_Closure(__t, __v));

where the fact that _Rt was completely pointless clearly hinted to a bug, a
typo _Tp -> _Rt in the last line. Would it make sense to add an option to the
front-end to warn in such cases?


-- 
           Summary: A warning for "unused" typedefs?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pcarlini at suse dot de


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
@ 2007-08-30 23:30 ` pinskia at gcc dot gnu dot org
  2007-08-30 23:33 ` pcarlini at suse dot de
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-30 23:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-08-30 23:30 -------
I think it is wrong to warn for unused typedefs, they are all over headers.


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
  2007-08-30 23:30 ` [Bug c++/33255] " pinskia at gcc dot gnu dot org
@ 2007-08-30 23:33 ` pcarlini at suse dot de
  2007-08-30 23:43 ` gdr at cs dot tamu dot edu
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-30 23:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pcarlini at suse dot de  2007-08-30 23:33 -------
Careful, only *in function bodies*.


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
  2007-08-30 23:30 ` [Bug c++/33255] " pinskia at gcc dot gnu dot org
  2007-08-30 23:33 ` pcarlini at suse dot de
@ 2007-08-30 23:43 ` gdr at cs dot tamu dot edu
  2007-08-30 23:46 ` pcarlini at suse dot de
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-08-30 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gdr at cs dot tamu dot edu  2007-08-30 23:43 -------
Subject: Re:  A warning for "unused" typedefs?

On Thu, 30 Aug 2007, pinskia at gcc dot gnu dot org wrote:

| I think it is wrong to warn for unused typedefs, they are all over headers.

In general, I tend to agree with Andrew Pinski on this.  
Maybe the original idea could be refined to *local* typedef
declarations.

-- Gaby


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (2 preceding siblings ...)
  2007-08-30 23:43 ` gdr at cs dot tamu dot edu
@ 2007-08-30 23:46 ` pcarlini at suse dot de
  2007-08-30 23:51 ` gdr at cs dot tamu dot edu
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-30 23:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pcarlini at suse dot de  2007-08-30 23:46 -------
(In reply to comment #3)
> Maybe the original idea could be refined to *local* typedef
> declarations.

Of course.


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (3 preceding siblings ...)
  2007-08-30 23:46 ` pcarlini at suse dot de
@ 2007-08-30 23:51 ` gdr at cs dot tamu dot edu
  2007-08-30 23:59 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-08-30 23:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from gdr at cs dot tamu dot edu  2007-08-30 23:51 -------
Subject: Re:  A warning for "unused" typedefs?

On Thu, 30 Aug 2007, pcarlini at suse dot de wrote:

| 
| 
| ------- Comment #4 from pcarlini at suse dot de  2007-08-30 23:46 -------
| (In reply to comment #3)
| > Maybe the original idea could be refined to *local* typedef
| > declarations.
| 
| Of course.

The tricky part is how to determine that a typedef is used.  

-- Gaby


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (4 preceding siblings ...)
  2007-08-30 23:51 ` gdr at cs dot tamu dot edu
@ 2007-08-30 23:59 ` pcarlini at suse dot de
  2007-08-31  0:06 ` gdr at cs dot tamu dot edu
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-30 23:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-08-30 23:59 -------
Well, assuming there are no "no-go" theorems about that problem ;) I would be
certainly interested in studying the problem in better detail...


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (5 preceding siblings ...)
  2007-08-30 23:59 ` pcarlini at suse dot de
@ 2007-08-31  0:06 ` gdr at cs dot tamu dot edu
  2007-08-31  0:34 ` fang at csl dot cornell dot edu
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-08-31  0:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from gdr at cs dot tamu dot edu  2007-08-31 00:05 -------
Subject: Re:  A warning for "unused" typedefs?

On Thu, 30 Aug 2007, pcarlini at suse dot de wrote:

| Well, assuming there are no "no-go" theorems about that problem ;) I would be
| certainly interested in studying the problem in better detail...

I did not mean to imply that the problem is unsolvable or NP-complete
or something like that.  I just pointed out that usually we rely on

  (1) data flow insfrastructure,
  (2) uniqueness of entities refered to by variable and functions

to warn about unused declarations.

Typedefs on the other hand can be "folded" in very early on.  So, one
needs to track that folding...

-- Gaby


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (6 preceding siblings ...)
  2007-08-31  0:06 ` gdr at cs dot tamu dot edu
@ 2007-08-31  0:34 ` fang at csl dot cornell dot edu
  2007-08-31  1:04 ` gdr at cs dot tamu dot edu
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fang at csl dot cornell dot edu @ 2007-08-31  0:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fang at csl dot cornell dot edu  2007-08-31 00:33 -------
Aren't unused typedefs sometimes useful for static assertions and concept
checking, using templates?  I suppose if one really wanted to keep around an
unused typedef, that __attribute__((unused)) might be somehow applicable.  I'm
looking forward to c++0x concepts, which will allay some of the need for
'creative' uses of templates.  


-- 

fang at csl dot cornell dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fang at csl dot cornell dot
                   |                            |edu


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (7 preceding siblings ...)
  2007-08-31  0:34 ` fang at csl dot cornell dot edu
@ 2007-08-31  1:04 ` gdr at cs dot tamu dot edu
  2007-08-31  8:41 ` pcarlini at suse dot de
  2007-08-31  8:44 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-08-31  1:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from gdr at cs dot tamu dot edu  2007-08-31 01:03 -------
Subject: Re:  A warning for "unused" typedefs?

On Thu, 31 Aug 2007, fang at csl dot cornell dot edu wrote:

| Aren't unused typedefs sometimes useful for static assertions and concept
| checking, using templates?

Maybe.  Do you have examples that involved *local* typedefs?

-- Gaby


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (8 preceding siblings ...)
  2007-08-31  1:04 ` gdr at cs dot tamu dot edu
@ 2007-08-31  8:41 ` pcarlini at suse dot de
  2007-08-31  8:44 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-31  8:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pcarlini at suse dot de  2007-08-31 08:41 -------
(In reply to comment #8)
> Aren't unused typedefs sometimes useful for static assertions and concept
> checking, using templates?

I understand the general spirit of your concerns. However I'm under the
impression that such tricks are becoming *less* common now that we have a real
static_assert in the core language and likewise real concepts.


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
                   ` (9 preceding siblings ...)
  2007-08-31  8:41 ` pcarlini at suse dot de
@ 2007-08-31  8:44 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2007-08-31  8:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pcarlini at suse dot de  2007-08-31 08:44 -------
(In reply to comment #7)
> I did not mean to imply that the problem is unsolvable or NP-complete
> or something like that.  I just pointed out that usually we rely on
> 
>   (1) data flow insfrastructure,
>   (2) uniqueness of entities refered to by variable and functions
> 
> to warn about unused declarations.
> 
> Typedefs on the other hand can be "folded" in very early on.  So, one
> needs to track that folding...

I see Gaby, thanks a lot for those details and clarifications.


-- 


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


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

end of thread, other threads:[~2007-08-31  8:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-30 23:21 [Bug c++/33255] New: A warning for "unused" typedefs? pcarlini at suse dot de
2007-08-30 23:30 ` [Bug c++/33255] " pinskia at gcc dot gnu dot org
2007-08-30 23:33 ` pcarlini at suse dot de
2007-08-30 23:43 ` gdr at cs dot tamu dot edu
2007-08-30 23:46 ` pcarlini at suse dot de
2007-08-30 23:51 ` gdr at cs dot tamu dot edu
2007-08-30 23:59 ` pcarlini at suse dot de
2007-08-31  0:06 ` gdr at cs dot tamu dot edu
2007-08-31  0:34 ` fang at csl dot cornell dot edu
2007-08-31  1:04 ` gdr at cs dot tamu dot edu
2007-08-31  8:41 ` pcarlini at suse dot de
2007-08-31  8:44 ` pcarlini at suse dot de

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