[PATCH] detect attribute mismatches in alias declarations (PR 81824)

Martin Sebor msebor@gmail.com
Fri Nov 9 17:33:00 GMT 2018


>> +/* Handle the "copy" attribute by copying the set of attributes
>> +   from the symbol referenced by ARGS to the declaration of *NODE.  */
>> +
>> +static tree
>> +handle_copy_attribute (tree *node, tree name, tree args,
>> +		       int flags, bool *no_add_attrs)
>> +{
>> +  /* Break cycles in circular references.  */
>> +  static hash_set<tree> attr_copy_visited;
> Does this really need to be static?

The variable was intended to break cycles in recursive calls to
the function for self-referential applications of attribute copy
but since the attribute itself is not applied (anymore) such cycles
can no longer form.  I have removed the variable and simplified
the handlers (there are tests to verify this works correctly).

>> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
>> index cfe6a8e..8ffb0cd 100644
>> --- a/gcc/doc/extend.texi
>> +++ b/gcc/doc/extend.texi
>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> index 5c95f67..c027acd 100644
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
> [ ... ]
>
>> +
>> +In C++, the warning is issued when an explicitcspecialization of a primary
> "explicitcspecialization" ? :-)
>

Fixed.

>
> Looks pretty good.  There's the explicit specialization nit and the
> static vs auto question for attr_copy_visited.  Otherwise it's OK.

Thanks.  I've retested a revision with the changes discussed here
and committed it as r265980.

Martin



More information about the Gcc-patches mailing list