[GCC-XML]gccxml and macros

Brad King brad.king at kitware.com
Mon Feb 2 11:19:12 EST 2004


On Mon, 2 Feb 2004, james anderson wrote:

> i am try to understand whether gccxml can be configured to produce - or
> even can possibly produce - descriptions of c preprocessor macros. i
> observe that there appear to be no remnants of #define'd macro
> definitions in the output for the cases is have tried, and understand
> that the xml generator runs after the cpp is complete, which leaves me
> to wonder if there is anything left wrt macros to output at that point.
>
> still i enquire. the issue is that, if one wants to use the results to
> generate an interface to a c-library from another language, and that
> library's documentation makes reference to said macros, it would be
> nice to include them in the automatically generated translated
> interface description.

As you observed, the GCC-XML dump occurs after preprocessing is complete.
Not only that, but it is after GCC's parser has read the preprocessed
output.  Any macro definitions are long gone by this point, so GCC-XML
will probably never support this in the dump.  However, the latest CVS
version of gccxml does support the full GCC 3.3 preprocessor, so you can
do this:

gccxml foo.cxx -E -dD

or

gccxml foo.cxx -E -dM

to get a list of preprocessor definitions.

-Brad




More information about the gccxml mailing list