On Mon, 2011-10-24 at 20:43 -0400, David Malcolm wrote:
I've just committed initial support for creating custom
compilation
attributes from Python, as:
http://git.fedorahosted.org/git/?p=gcc-python-plugin.git;a=commitdiff;h=a...
Nice!
So it's now possible to write declarations like these:
void some_function(void)
__attribute__(claims_mutex("io"));
void some_other_function(void)
__attribute__(releases_mutex("io"));
and register those new attributes from Python code, and have a code
analysis script use them to ensure some property (e.g. that the resource
claim/release usage is properly balanced).
According to
http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html two
open and two closing brackets are needed for the __attribute__ syntax
e.g.
void some_function(void)
__attribute__((claims_mutex("io")));
(Same issue on the attributes.html doc.)
Is there a way to detect whether or not you are compiling with a
particular python plugin loaded in the source code to shut up the
warnings about none-existing attribute names if you are not by defining
things like:
#ifdef COMPILING_AGAINST_FOOBAR_ATTR_PYTHON_CHECKER
#define FOOBAR_ATTR __attribute__((foobar))
#else
#define FOOBAR_ATTR
#endif
I can kind of guess what the decl_required, type_required,
function_type_required are for, but they aren't documented in the above.
Thanks,
Mark