Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-11-07 Thread Jason Merrill
The bootstrap issues with a recent patch of mine led me to run make check-g++-strict-gc, which turned up a GC problem with this code, fixed thus. Tested x86_64-pc-linux-gnu, applying to trunk. commit f2f82e0908b807a0d339a00b434913fc0886c0cc Author: Jason Merrill ja...@redhat.com Date: Mon

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-08 Thread H.J. Lu
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

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-08 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: I think -Wunused and -Wall should imply -Wunused-local-typedefs unless the user specifies -Wno-unused-local-typedefs. Dodji Seketeli do...@redhat.com writes: I actually first tried this (actually adding it to -Wall -extra and -Wunused) and found out

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-08 Thread Jason Merrill
On 09/08/2011 04:50 PM, Dodji Seketeli wrote: Is this be OK for trunk when PR preprocessor/7263 gets in, assuming it passes bootstrap and tests on trunk at that moment? Yes, except... --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3505,6 +3505,7 @@ To suppress this warning use the

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-08 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 09/08/2011 04:50 PM, Dodji Seketeli wrote: Is this be OK for trunk when PR preprocessor/7263 gets in, assuming it passes bootstrap and tests on trunk at that moment? Yes, except... --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -3505,6

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-08 Thread Jason Merrill
On 09/08/2011 05:54 PM, Dodji Seketeli wrote: Jason Merrillja...@redhat.com writes: Don't you want to say This warning is also enabled by @option{-Wunused}, which is enabled by @option{-Wall}.? For the sake of consistency, I followed the pattern used for the other -Wunused-* options in that

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-07 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 08/08/2011 03:52 PM, Dodji Seketeli wrote: + cfun-language = NULL; Might as well ggc_free it first. Done. + /* We want T to be either a type or a TYPE_DECL. */ Comment is out of date. Removed. Does __attribute ((used)) on the typedef

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-07 Thread Jason Merrill
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? Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-07 Thread Dodji Seketeli
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

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-06 Thread Jason Merrill
On 08/08/2011 03:52 PM, Dodji Seketeli wrote: + cfun-language = NULL; Might as well ggc_free it first. + /* We want T to be either a type or a TYPE_DECL. */ Comment is out of date. Does __attribute ((used)) on the typedef prevent the warning? Jason

[PING] [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-09-01 Thread Dodji Seketeli
. Thanks. From: Dodji Seketeli do...@redhat.com Date: Mon, 25 Jul 2011 19:02:07 +0200 Subject: [PATCH] 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

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-08-08 Thread Dodji Seketeli
] 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

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-08-06 Thread Dodji Seketeli
So I finally got back to this and updated the patch according to the comments below. Jason Merrill ja...@redhat.com writes: On 07/27/2011 01:54 PM, Dodji Seketeli wrote: + /* Set of typedefs that are used in this function. */ + struct pointer_set_t * GTY((skip)) used_local_typedefs; Is

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-08-06 Thread Jason Merrill
On 08/06/2011 06:57 AM, Dodji Seketeli wrote: @@ -4340,6 +4340,8 @@ c_sizeof_or_alignof_type (location_t loc, value = fold_convert_loc (loc, size_type_node, value); gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value))); + maybe_record_local_typedef_use (type); Why is this still needed?

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-30 Thread Joseph S. Myers
On Fri, 29 Jul 2011, Jason Merrill wrote: Looking a bit further, it looks like the C FE uses cfun-language only to store the context of the outer function when faced with a nested function. This is done by c_push_function_context, called by c_parser_declaration_or_fndef. Otherwise,

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Jason Merrill
On 07/27/2011 01:54 PM, Dodji Seketeli wrote: + /* Set of typedefs that are used in this function. */ + struct pointer_set_t * GTY((skip)) used_local_typedefs; Is there a reason not to just use TREE_USED for this? + /* Vector of locally defined typedefs, for +

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Paolo Carlini
Hi, I think -Wunused and -Wall should imply -Wunused-local-typedefs unless the user specifies -Wno-unused-local-typedefs. IMHO, this is a very good idea looking forward, but then I think we should make sure the warning plays well with system headers either as-is or together with some other

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 07/27/2011 01:54 PM, Dodji Seketeli wrote: + /* Set of typedefs that are used in this function. */ + struct pointer_set_t * GTY((skip)) used_local_typedefs; Is there a reason not to just use TREE_USED for this? I wasn't sure if that flag wasn't

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Paolo Carlini
Hi, I think -Wunused and -Wall should imply -Wunused-local-typedefs unless the user specifies -Wno-unused-local-typedefs. I actually first tried this (actually adding it to -Wall -extra and -Wunused) and found out the following issue. A typedef can be defined in a macro in a system header, be

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 07/27/2011 01:54 PM, Dodji Seketeli wrote: + /* Set of typedefs that are used in this function. */ + struct pointer_set_t * GTY((skip)) used_local_typedefs; Is there a reason not to just use TREE_USED for this? + /* Vector of locally defined

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Jason Merrill
On 07/29/2011 08:36 AM, Dodji Seketeli wrote: Looking into this a bit, it seems to me that I can access cfun-language-base (of type c_language_function) from inside either the C or C++ FE only, as the type of cfun-language -- which is of type struct language_function -- is only defined either in

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Jason Merrill
On 07/29/2011 03:35 AM, Dodji Seketeli wrote: So do you guys think we should add it nonetheless and just add -Wno-unused-local-typedefs to the tests that exhibit the above issue before fixing PR preprocessor/7263? Does your set of linemap patches fix the issue? In that case, we can add it

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 07/29/2011 03:35 AM, Dodji Seketeli wrote: So do you guys think we should add it nonetheless and just add -Wno-unused-local-typedefs to the tests that exhibit the above issue before fixing PR preprocessor/7263? Does your set of linemap patches fix

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Dodji Seketeli
Jason Merrill ja...@redhat.com writes: On 07/29/2011 08:36 AM, Dodji Seketeli wrote: Looking into this a bit, it seems to me that I can access cfun-language-base (of type c_language_function) from inside either the C or C++ FE only, as the type of cfun-language -- which is of type struct

Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-29 Thread Jason Merrill
On 07/29/2011 10:27 AM, Dodji Seketeli wrote: Jason Merrillja...@redhat.com writes: On 07/29/2011 08:36 AM, Dodji Seketeli wrote: Looking into this a bit, it seems to me that I can access cfun-language-base (of type c_language_function) from inside either the C or C++ FE only, as the type of

[PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning

2011-07-27 Thread Dodji Seketeli
have fixed thus. Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. -- Dodji From b4612a6dd8a642795fe81398b372746f19c86614 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli do...@redhat.com Date: Mon, 25 Jul 2011 19:02:07 +0200 Subject: [PATCH] PR c++/33255 - Support