On Sun, 2011-07-17 at 21:42 +0200, Denys Duchier wrote:
I cloned the git repo today and tried to compile the plugin.
Apparently, includes have changed a bit: by adding in <coretypes.h> and
<toplev.h> I went a little further, but now I am stuck on an error about
all_translation_units (indeed, it does seem to be undeclared). any
idea?
Thanks for trying it.
I've only ever tried building the plugin against 4.6.0, so I'm not yet
familiar with the differences between the two gcc versions. I'm
targeting 4.6, based on my goals for the cpychecker code, but I hope
it's easy to support 4.5 also.
Can you post the compilation error somewhere?
It looks like "all_translation_units" was made public in this commit:
http://gcc.gnu.org/ml/gcc-cvs/2010-09/msg00625.html
http://gcc.gnu.org/viewcvs?view=revision&revision=164331
The plugin API contains a header file <bversion.h>, which for me
contains:
#define BUILDING_GCC_MAJOR 4
#define BUILDING_GCC_MINOR 6
#define BUILDING_GCC_PATCHLEVEL 0
#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 +
BUILDING_GCC_MINOR)
Assuming that 4.5 also provides such a file, we may be able to patch the
plugin to conditionally compile parts of the Python API, based on the
numeric values e.g.
/* (some comment indicating version that it was added in) */
#if BUILDING_GCC_VERSION >= 4006
etc
For completeness, the API docs should also be annotated with info on the
versions. Sphinx (our documentation generator) supports a "versionadded"
directive, though I'm not sure if that's exactly the right one to use:
http://sphinx.pocoo.org/markup/para.html#directive-versionadded
Note to self: links to GCC's internal documentation for specific
versions of GCC follow this obvious pattern:
4.4.0:
http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gccint/
4.5.0:
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gccint/
4.5.2:
http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gccint/Plugins.html
4.6.0:
http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gccint/
etc
(The plugin interface seems to have been added in 4.5.0, making that the
minimum version that would be supportable)
Hope this is helpful
Dave