On 10/16/09 12:11 PM, Tom Tromey wrote:
>>>>>> "Diego" == Diego Novillo <dnovi...@google.com> writes:
> 
> Diego> void foo(void) __attribute__((user("bleh")));
> 
> Diego> foo.cc:1: warning: 'user' attribute directive ignored
> 
> Diego> We could change the compiler to never complain about the 'user'
> Diego> attribute, unless plugins are loaded,but that also seems incomplete.
> 
> How about just having __attribute__ ((plugin (pluginname, arg...)))
> and ignoring an attribute when the named plugin is not loaded?
> It seems to me that having a single "user" attribute shared by all
> plugins will lead to some pain later on.

Dehydra is going to switch from the generic user attribute to specific
GCC-registered attributes __attribute__((NS_final)) at some point when one
of us can code it up. In particular it would be nice to have more validation
of attribute application: in particular because the user attribute can apply
to types or declarations it's much easier for code authors to misplace,
especially when combined with function pointers.

I don't particularly like __attribute__((plugin (pluginname, arg))). You're
forced to code plugin names into your source, when you may not actually know
the name of the plugin that's going to process your annotations. Mozilla is
likely to have generic attributes (NS_final and others) which are not
specific to one plugin. We already have a volunteer working on an
optimization pass and an analysis pass for an attribute always_returns_zero:
these passes are likely to be in different plugins (optimization in a
compiled plugin, analysis in dehydra/treehydra).

--BDS

Reply via email to