[GCC-XML] pragmas, preprocessor
Thomas Heller
theller at python.net
Wed Sep 22 16:01:26 EDT 2004
Brad King <brad.king at kitware.com> writes:
> 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
First tests show that this patch seems to do what I want.
Now that I've been playing with this stuff, I'll think about what I need
further;-)
Again, I'm impressed how smoothless the build worked - CMake seems to be
the next great tool!
Thomas
Index: xml.c
===================================================================
RCS file: /cvsroot/GCC_XML/gccxml/GCC/gcc/cp/xml.c,v
retrieving revision 1.89
diff -c -r1.89 xml.c
*** xml.c 29 Jul 2004 12:09:53 -0000 1.89
--- xml.c 22 Sep 2004 19:47:38 -0000
***************
*** 1363,1368 ****
--- 1363,1370 ----
xml_print_artificial_attribute (xdi, TYPE_NAME (rt));
xml_print_attributes_attribute (xdi, TYPE_ATTRIBUTES(rt), 0);
+ fprintf (xdi->file, " align=\"%d\"", TYPE_ALIGN(rt));
+
if (dn->complete && COMPLETE_TYPE_P (rt))
{
fprintf (xdi->file, " members=\"");
More information about the gccxml
mailing list