On Tue, 2011-10-25 at 11:31 -0400, David Malcolm wrote:
On Tue, 2011-10-25 at 13:20 +0200, Mark Wielaard wrote:
> On Mon, 2011-10-24 at 20:43 -0400, David Malcolm wrote:
...
> 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'm not sure of the best way of doing this. My first thought was "use
some kind of configuration test", but that could be a nuisance,
especially if you want to only compile some subset of the code with the
checker.
Idea: have the plugin predefine a preprocessor macro. I don't yet know
whether or not a gcc plugin can hook into the preprocessor, and provide
some predefined macros. Will investigate...
I managed to do this: as of:
http://git.fedorahosted.org/git/?p=gcc-python-plugin.git;a=commit;h=2f917...
there's now a gcc.define_macro() hook, so you can define the macro in
your python script at the same time as you define the attribute.
I added an example of how to do this to the docs here:
http://readthedocs.org/docs/gcc-python-plugin/en/latest/attributes.html#u...
I'll start adding some custom attributes to the cpychecker code next, to
use all of this machinery, and have a go at using them in gdb to silence
some of the false warnings.