[GCC-XML] pragmas, preprocessor

Brad King brad.king at kitware.com
Wed Sep 22 12:33:07 EDT 2004


Thomas Heller wrote:
> Hm, I just found out that '#pragma pack' even seems to work with gcc
> (Suse linux, gcc 3.3.1) on a C program.  Would it be possible (I'd even
> try to work on a patch) to expose either the current packing for
> structures, or expose field offsets of structure members in the xml
> output?

If gcc knows about this pragma then it is probably possible to get at it 
during the xml dump.  I do not have time to look at doing this but I can 
get you started.  Take a look in the GCC-XML source tree at 
GCC/gcc/tree.h, GCC/gcc/cp/cp-tree.h, and GCC/gcc/cp/xml.c.  The 
function xml_output_record_type in xml.c is probably the place to add 
your code.  The two header files have plenty of comments to help you 
explore GCC's internal data structures.  Also, look at the GCC internals 
documentation here:

http://gcc.gnu.org/onlinedocs/gccint/Trees.html#Trees

Good luck,
-Brad



More information about the gccxml mailing list