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 (or couldn't be) used for some "core"
functionality with another meaning for this type of tree, and so would
cause some conflict.

>
>> +  /* Vector of locally defined typedefs, for
>> +     -Wunused-local-typedefs.  */
>> +  VEC(tree,gc) *local_typedefs;
>
> If the accessors are in c-common, this field should be in
> c_language_function.
>

Thanks, I didn't realize this existed.

> Actually, couldn't we just mark a typedef as used when when lookup
> finds it?  That would avoid having to mark in so many places and avoid
> the need for walk_tree.

This would indeed simplify things.  I'll try it.

> 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 expanded in a
function and not be used by the function.  In this case we shouldn't
warn, but PR preprocessor/7263 makes us warn nonetheless.  There are
many spots of that kind in the libstdc++ test suite.

Paolo Carlini <paolo.carl...@oracle.com> writes:

> 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 pending work of Dodji. In
> particular, as I probably mentioned already in the trail, we really
> want to double check that debug-mode does not trigger warnings, I'm a
> bit of worried because many people use and like it.

Exactly.  This would be a side effect of PR preprocessor/7263?

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?

Thanks.

-- 
                Dodji

Reply via email to