On Thu, 30 May 2019, Alex Henrie wrote:

> At this point I think I'm convinced that any attribute that applies to
> a function should also be allowed on a function pointer without any
> warnings. We can start by turning off the warnings for the "fndecl"
> attributes and then clean up the other attributes as time goes on.

This is inherently a property of the attribute in question.  The issue is 
not whether it applies to function pointers; it's whether it applies to 
function types.

For example, the "section" or "alias" attributes are attributes that apply 
to a declaration, but not a type.  Because they apply to variables as well 
as functions, they are meaningful on function pointers - but the meaning 
is *not* the same as applying them to the pointed-to function.

The "flatten" attribute, however, seems only meaningful for functions, not 
variables, not function types and not function pointers.

We should try to work out for each attribute exactly what construct it 
appertains to - which for many but not all function attributes is indeed 
the type of the function rather than the function itself.  Then move to 
making such attributes work on types.  But for attributes such as 
"flatten" that logically appertain to the declaration not its type, we 
should continue to diagnose them on function pointers or types.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to