David> I'm not sure of the best way of doing this. My first thought was "use
David> some kind of configuration test", but that could be a nuisance,
David> especially if you want to only compile some subset of the code with the
David> checker.
Also it would mean reconfiguring just to try out the plugin.
That seems like a pain.
David> I directly wrapped GCC's register_attribute() API here, and I don't
have
David> a good sense of what they're for (but I wanted to get the code off of my
David> laptop and into git, rather than wait until it was perfect :) ). I'm
David> new to attributes in GCC.
The comments in tree.h:struct attribute_spec are pretty good:
/* Whether this attribute requires a DECL. If it does, it will be passed
from types of DECLs, function return types and array element types to
the DECLs, function types and array types respectively; but when
applied to a type in any other circumstances, it will be ignored with
a warning. (If greater control is desired for a given attribute,
this should be false, and the flags argument to the handler may be
used to gain greater control in that case.) */
const bool decl_required;
/* Whether this attribute requires a type. If it does, it will be passed
from a DECL to the type of that DECL. */
const bool type_required;
/* Whether this attribute requires a function (or method) type. If it does,
it will be passed from a function pointer type to the target type,
and from a function return type (which is not itself a function
pointer type) to the function type. */
const bool function_type_required;
Tom