[GCC-XML] Preprocessor to XML ... away to get the defines?

Brad King brad.king at kitware.com
Mon Mar 7 13:08:50 EST 2005


Thomas Menguy wrote:
> The other way we would like to dig is how to catch the macros/define
> ... I know gccxml is working, of course on preprocessed datas ...
> anyway something like gcc -E -dD -undef on a file gives all the
> necessary information to do the job : so 2 way to do :
> -have a gccxml -E -dD -undef and make the output as XML (ie gets the
> #define lines and the associated file) : relatively easy to do ( ;-)
> ), but far from being optimal, processor wize
> -instrument the preprocessor also, to output directly the defines in
> the XML structure.

I view this problem as similar to adding support for another language 
(like pure C or Fortran or Java).  The C++ dump is a hook in the C++ 
parser in GCC.  A dump of another language requires a hook in the parser 
for that language.  The preprocessor is really another language 
completely and has its own parser in GCC.  You would need to add a hook 
into that parser that is basically independent of the C++ hook.  Then 
you could call both hooks to dump into the same file.

-Brad



More information about the gccxml mailing list