From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1434 invoked by alias); 8 Sep 2011 13:55:35 -0000 Received: (qmail 1041 invoked by uid 22791); 8 Sep 2011 13:55:33 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Sep 2011 13:55:06 +0000 From: "dodji at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/33255] A warning for "unused" typedefs? Date: Thu, 08 Sep 2011 13:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: dodji at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00603.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33255 --- Comment #26 from Dodji Seketeli 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& __in, basic_string& __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