public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
@ 2011-07-22 16:50 ` dodji at gcc dot gnu.org
  2011-07-22 17:01 ` paolo.carlini at oracle dot com
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-07-22 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.07.22 16:48:39
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
  2011-07-22 16:50 ` [Bug c++/33255] A warning for "unused" typedefs? dodji at gcc dot gnu.org
@ 2011-07-22 17:01 ` paolo.carlini at oracle dot com
  2011-07-24 21:59 ` dodji at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-22 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-22 17:00:57 UTC ---
Somebody should add a "Thumb Up" button to Bugzilla.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
  2011-07-22 16:50 ` [Bug c++/33255] A warning for "unused" typedefs? dodji at gcc dot gnu.org
  2011-07-22 17:01 ` paolo.carlini at oracle dot com
@ 2011-07-24 21:59 ` dodji at gcc dot gnu.org
  2011-07-24 22:10 ` dodji at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-07-24 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-07-24 21:57:47 UTC ---
Created attachment 24820
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24820
Work in progress patch

This works only on the C++ FE (not on the C FE yet) for now and has been
lightly tested so far.

I ran it on libstdc++ and so far it fell short only on the use of
PB_DS_STATIC_ASSERT (and friends) which defines a typedef.  When this macro is
expanded in a function that doesn't use the typedef it defines, the patch
warns.  Normally, it shouldn't warn b/c the macro is defined in a system
header.  But with the current (libcpp) infrastructure, we cannot tell the
difference between a typedef defined in a system header macro that is expanded
in a local function, and a typedef that is directly defined in the function. 
Normally with the work being done on PR proprocessor/7263 this patch should not
warn in those case.  At least if my understanding of the issue is correct.

The warning option is -Wunused-local-typedefs and is activated by -Wall
-Wextra, or -Wunused -Wextra.

I am putting it here for now in case someone has interesting test cases to add.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-07-24 21:59 ` dodji at gcc dot gnu.org
@ 2011-07-24 22:10 ` dodji at gcc dot gnu.org
  2011-07-24 22:34 ` paolo.carlini at oracle dot com
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-07-24 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #24820|0                           |1
        is obsolete|                            |

--- Comment #16 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-07-24 22:09:27 UTC ---
Created attachment 24821
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24821
Woops, this one is the right one.

Sorry the previous patch was the wrong one.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-07-24 22:10 ` dodji at gcc dot gnu.org
@ 2011-07-24 22:34 ` paolo.carlini at oracle dot com
  2011-07-24 22:38 ` paolo.carlini at oracle dot com
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-24 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:32:22 UTC ---
Beautiful. And of course I don't think PB_DS_STATIC_ASSERT gonna be a serious
problem.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-07-24 22:34 ` paolo.carlini at oracle dot com
@ 2011-07-24 22:38 ` paolo.carlini at oracle dot com
  2011-07-24 22:50 ` paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-24 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:37:39 UTC ---
By the way, an obvious positive additional testcase, involving templates, would
be one inspired by libstdc++/33084 that is involving <valarray> *before* the
fix for that bug. Shouldn't be too hard to figure out...


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-07-24 22:38 ` paolo.carlini at oracle dot com
@ 2011-07-24 22:50 ` paolo.carlini at oracle dot com
  2011-07-24 22:54 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-24 22:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:49:32 UTC ---
Just as a note, wanted also to add that if I understand correctly the
(temporary?!?) small issue with system headers, it would also affect people
building their code with -D_GLIBCXX_CONCEPT_CHECKS (by itself largely
deprecated and not being updated for c++0x). Again, I don't see this as a
serious issue if the new warning remains, for now at least, outside -Wall.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2011-07-24 22:50 ` paolo.carlini at oracle dot com
@ 2011-07-24 22:54 ` paolo.carlini at oracle dot com
  2011-07-25 11:18 ` dodji at seketeli dot org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-24 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:54:05 UTC ---
... or maybe not, because actually _GLIBCXX_CONCEPT_CHECKS defines used
typedefs, only, pointless besides type checking.

We should also check -D_GLIBCXX_DEBUG. This one is serious.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2011-07-24 22:54 ` paolo.carlini at oracle dot com
@ 2011-07-25 11:18 ` dodji at seketeli dot org
  2011-07-25 11:44 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at seketeli dot org @ 2011-07-25 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from dodji at seketeli dot org <dodji at seketeli dot org> 2011-07-25 11:17:11 UTC ---
> --- Comment #18 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:37:39 UTC ---
> By the way, an obvious positive additional testcase, involving templates, would
> be one inspired by libstdc++/33084 that is involving <valarray> *before* the
> fix for that bug. Shouldn't be too hard to figure out...

Thanks for the pointer.  I am adding this (hopefully equivalent) test
case to the patch:

+
+template<class T, class U>
+struct S10
+{
+};
+
+template<class T>
+void
+test10(void)
+{
+  typedef typename ST<T>::T bar; // { dg-warning "locally defined but not
used" }
+  typedef typename ST<T>::T foo; // We shouldn't warn for this one, as
+                 // it's used below.
+  S10<int, foo> v;
+}


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2011-07-25 11:18 ` dodji at seketeli dot org
@ 2011-07-25 11:44 ` paolo.carlini at oracle dot com
  2011-07-25 14:29 ` dodji at seketeli dot org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-07-25 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-25 11:43:47 UTC ---
Excellent.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2011-07-25 11:44 ` paolo.carlini at oracle dot com
@ 2011-07-25 14:29 ` dodji at seketeli dot org
  2011-07-25 17:32 ` dodji at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at seketeli dot org @ 2011-07-25 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from dodji at seketeli dot org <dodji at seketeli dot org> 2011-07-25 14:29:15 UTC ---
> --- Comment #19 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-07-24 22:49:32 UTC ---
> Just as a note, wanted also to add that if I understand correctly the
> (temporary?!?) small issue with system headers, it would also affect people
> building their code with -D_GLIBCXX_CONCEPT_CHECKS (by itself largely
> deprecated and not being updated for c++0x). Again, I don't see this as a
> serious issue if the new warning remains, for now at least, outside
> -Wall.

Building libstdc++ itself without _GLIBCXX_CONCEPT_CHECKS
raises this warning for e.g:

      typedef typename iterator_traits<_II1>::value_type _ValueType1;
      typedef typename iterator_traits<_II2>::value_type _ValueType2;

 [..]
      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)

(in libstdc++-v3/include/bits/stl_algobase.h)

As the macro __glibcxx_function_requires is defined to nothing (without
-D_GLIBCXX_CONCEPT_CHECKS) _ValueType1 and _ValueType2 appear unused
here.

So yes, -Wunused-local-typedefs definitely needs to be put out of --Wall
-Extra (and -Wunused).

Thanks.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2011-07-25 14:29 ` dodji at seketeli dot org
@ 2011-07-25 17:32 ` dodji at gcc dot gnu.org
  2011-07-27 18:10 ` dodji at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-07-25 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #24821|0                           |1
        is obsolete|                            |

--- Comment #24 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-07-25 17:31:46 UTC ---
Created attachment 24833
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24833
Enhanced patch with proper ChangeLog

This version removes the -Wunused-local-typedefs option from -Wunused and -Wall
-extra, adds more test cases, fixes some unused local typedefs spots in 
libstdc++ and adds a ChangeLog.

Now I guess I need to look at adding support for this option to the C FE...


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2011-07-25 17:32 ` dodji at gcc dot gnu.org
@ 2011-07-27 18:10 ` dodji at gcc dot gnu.org
  2011-09-08 13:57 ` dodji at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-07-27 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #24833|0                           |1
        is obsolete|                            |

--- Comment #25 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-07-27 18:09:16 UTC ---
Created attachment 24845
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24845
C FE support added

This patch adds -Wunused-local-typedefs support to the C FE as well as some due
clean up.  I am currently bootstrapping it.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2011-07-27 18:10 ` dodji at gcc dot gnu.org
@ 2011-09-08 13:57 ` dodji at gcc dot gnu.org
  2011-09-08 21:22 ` dodji at seketeli dot org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-09-08 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #26 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-09-08 13:54:33 UTC ---
Author: dodji
Date: Thu Sep  8 13:54:24 2011
New Revision: 178692

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178692
Log:
PR c++/33255 - Support -Wunused-local-typedefs warning

gcc/

    * c-decl.c (lookup_name): Use the new
    maybe_record_typedef_use.
    (pushdecl): Use the new
    record_locally_defined_typedef.
    (store_parm_decls): Allocate cfun->language.
    (finish_function): Use the new maybe_warn_unused_local_typedefs,
    and free cfun->language.
    (c_push_function_context): Allocate cfun->language here only if
    needed.
    (c_pop_function_context): Likewise, mark cfun->language
    for collection only when it should be done.
    * c-common.c (handle_used_attribute): Don't ignore TYPE_DECL
    nodes.
    * c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new
    maybe_record_local_typedef_use.

gcc/c-family

    * c-common.h (struct c_language_function::local_typedefs): New
    field.
    (record_locally_defined_typedef, maybe_record_typedef_use)
    (maybe_warn_unused_local_typedefs): Declare new functions.
    * c-common.c (record_locally_defined_typedef)
    (maybe_record_typedef_use)
    (maybe_warn_unused_local_typedefs): Define new functions.
    * c.opt: Declare new -Wunused-local-typedefs flag.

gcc/cp

    * name-lookup.c (pushdecl_maybe_friend_1): Use the new
    record_locally_defined_typedef.
    * decl.c (finish_function): Use the new
    maybe_warn_unused_local_typedefs.
    (grokfield): Use the new record_locally_defined_typedef.
    * parser.c (lookup_name): Use the new maybe_record_typedef_use.

gcc/doc/

    * invoke.texi: Update documentation for -Wunused-local-typedefs.

gcc/testsuite/

    * g++.dg/warn/Wunused-local-typedefs.C: New test file.
    * c-c++-common/Wunused-local-typedefs.c: Likewise.

libstdc++-v3/

    * include/ext/bitmap_allocator.h
    (__detail::__mini_vector::__lower_bound): Remove unused typedef.
    * src/istream.cc (std::operator>>(basic_istream<char>& __in,
    basic_string<char>& __str)): Likewise.
    (std::getline): Likewise.
    * src/valarray.cc (__valarray_product): Likewise.

Added:
    trunk/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c
    trunk/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c.opt
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/parser.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/bitmap_allocator.h
    trunk/libstdc++-v3/src/istream.cc
    trunk/libstdc++-v3/src/valarray.cc


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2011-09-08 13:57 ` dodji at gcc dot gnu.org
@ 2011-09-08 21:22 ` dodji at seketeli dot org
  2011-11-07 17:53 ` jason at gcc dot gnu.org
  2012-08-22 21:00 ` paolo.carlini at oracle dot com
  16 siblings, 0 replies; 30+ messages in thread
From: dodji at seketeli dot org @ 2011-09-08 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from dodji at seketeli dot org <dodji at seketeli dot org> 2011-09-08 20:55:19 UTC ---
As a follow-up, I have posted a patchlet[1] to enable this warning whenever
-Wall or -Wunused is used.  This patchlet would be applied when the fix
for PR preprocessor/7263 goes in.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00593.html


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2011-09-08 21:22 ` dodji at seketeli dot org
@ 2011-11-07 17:53 ` jason at gcc dot gnu.org
  2012-08-22 21:00 ` paolo.carlini at oracle dot com
  16 siblings, 0 replies; 30+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-07 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #28 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-07 17:51:28 UTC ---
Author: jason
Date: Mon Nov  7 17:51:24 2011
New Revision: 181100

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181100
Log:
    PR c++/33255
    * decl.c (save_function_data): Clear local_typedefs.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2011-11-07 17:53 ` jason at gcc dot gnu.org
@ 2012-08-22 21:00 ` paolo.carlini at oracle dot com
  16 siblings, 0 replies; 30+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-22 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org |
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #29 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-22 21:00:06 UTC ---
I suppose we can close this, right? In case there are issues with the
implementation, belong to new, separate PRs.


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-16141@http.gcc.gnu.org/bugzilla/>
  2008-06-09 13:37 ` paolo dot carlini at oracle dot com
@ 2008-06-09 14:07 ` gdr at cs dot tamu dot edu
  1 sibling, 0 replies; 30+ messages in thread
From: gdr at cs dot tamu dot edu @ 2008-06-09 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from gdr at cs dot tamu dot edu  2008-06-09 14:06 -------
Subject: Re:  A warning for "unused" typedefs?

"paolo dot carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| Hi Gaby, just a pointer, this is the enhancement PR I was talking about...

Many thanks, Paolo.

-- Gaby


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
       [not found] <bug-33255-16141@http.gcc.gnu.org/bugzilla/>
@ 2008-06-09 13:37 ` paolo dot carlini at oracle dot com
  2008-06-09 14:07 ` gdr at cs dot tamu dot edu
  1 sibling, 0 replies; 30+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-06-09 13:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from paolo dot carlini at oracle dot com  2008-06-09 13:36 -------
Hi Gaby, just a pointer, this is the enhancement PR I was talking about...


-- 


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


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

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

* [Bug c++/33255] A warning for "unused" typedefs?
  2007-08-30 23:21 [Bug c++/33255] New: " 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; 30+ 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] 30+ messages in thread

end of thread, other threads:[~2012-08-22 21:00 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-33255-4@http.gcc.gnu.org/bugzilla/>
2011-07-22 16:50 ` [Bug c++/33255] A warning for "unused" typedefs? dodji at gcc dot gnu.org
2011-07-22 17:01 ` paolo.carlini at oracle dot com
2011-07-24 21:59 ` dodji at gcc dot gnu.org
2011-07-24 22:10 ` dodji at gcc dot gnu.org
2011-07-24 22:34 ` paolo.carlini at oracle dot com
2011-07-24 22:38 ` paolo.carlini at oracle dot com
2011-07-24 22:50 ` paolo.carlini at oracle dot com
2011-07-24 22:54 ` paolo.carlini at oracle dot com
2011-07-25 11:18 ` dodji at seketeli dot org
2011-07-25 11:44 ` paolo.carlini at oracle dot com
2011-07-25 14:29 ` dodji at seketeli dot org
2011-07-25 17:32 ` dodji at gcc dot gnu.org
2011-07-27 18:10 ` dodji at gcc dot gnu.org
2011-09-08 13:57 ` dodji at gcc dot gnu.org
2011-09-08 21:22 ` dodji at seketeli dot org
2011-11-07 17:53 ` jason at gcc dot gnu.org
2012-08-22 21:00 ` paolo.carlini at oracle dot com
     [not found] <bug-33255-16141@http.gcc.gnu.org/bugzilla/>
2008-06-09 13:37 ` paolo dot carlini at oracle dot com
2008-06-09 14:07 ` gdr at cs dot tamu dot edu
2007-08-30 23:21 [Bug c++/33255] New: " 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).