On Wed, Sep 7, 2011 at 12:57 PM, Dodji Seketeli <do...@redhat.com> wrote: > Jason Merrill <ja...@redhat.com> writes: > >> On 09/07/2011 02:01 PM, Dodji Seketeli wrote: >>> + >>> /* Process declarations and variables for C compiler. >> >> Blank line at the top of the file? > > Oops, I noticed it and changed it in the aggregated patch I sent, but > forgot to update the diff against the previous. Sorry for that. > >>> Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, >>> 2000, >>> 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 >>> @@ -8328,7 +8329,8 @@ finish_function (void) >>> if (!decl_function_context (fndecl)) >>> undef_nested_function = false; >>> >>> - cfun->language = NULL; >>> + if (cfun->language != NULL) >>> + ggc_free (cfun->language); >> >> You'll still want to set it to NULL after freeing it. > > Fixed. > >> OK with those changes. > > Thanks. > > Here is the patch I will commit in a short while. > > 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.
This may have caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50332 -- H.J.