summaryrefslogtreecommitdiff
path: root/tests/offsets
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2008-11-16 21:15:54 +0000
committerOwen Taylor <otaylor@src.gnome.org>2008-11-16 21:15:54 +0000
commitc68cef1ba60d2a7563cf8d191aa8c10453467ed7 (patch)
treece1a0be4a4ff0044870989ebe03d430bf59998a7 /tests/offsets
parenta5d45df66370320ec2ae493383ba1388157182da (diff)
downloadgobject-introspection-c68cef1ba60d2a7563cf8d191aa8c10453467ed7.tar.gz
Bug 560825 – Add size and alignment to typelib
Include the size and alignment of structures and unions in the typelib, and add getter methods to retrieve them from GIStructInfo/GIUnionInfo. * docs/typelib-format.txt girepository/gtypelib.h girepository/girnode.c girepository/girmodule.c girepository/gtypelib.c: Add size and alignment to StructBlob and UnionBlob. * girepository/ginfo.c girepository/girepository.h: Add g_[struct|union]_get[size|alignment](). * test/offsets/gen-gitestoffsets: Test overall structure size and alignment. svn path=/trunk/; revision=930
Diffstat (limited to 'tests/offsets')
-rwxr-xr-xtests/offsets/gen-gitestoffsets13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/offsets/gen-gitestoffsets b/tests/offsets/gen-gitestoffsets
index 27fff23b..ce4a977c 100755
--- a/tests/offsets/gen-gitestoffsets
+++ b/tests/offsets/gen-gitestoffsets
@@ -141,10 +141,17 @@ for symbol in symbols:
fields = symbol_fields[symbol]
output({'symbol' : symbol}, r'''
+|typedef struct {
+| char dummy;
+| %(symbol)s struct_;
+|} Align%(symbol)s;
+|
|static void
|compiled_%(symbol)s (FILE *outfile)
|{
-| fprintf (outfile, "%(symbol)s:\n");
+| fprintf (outfile, "%(symbol)s: size=%%" G_GSIZE_FORMAT ", alignment=%%ld\n",
+| sizeof(%(symbol)s),
+| G_STRUCT_OFFSET(Align%(symbol)s, struct_));
|
''')
@@ -174,7 +181,9 @@ for symbol in symbols:
| if (!struct_info)
| g_error ("Can't find GIStructInfo for '%(symbol)s'");
|
-| fprintf (outfile, "%(symbol)s:\n");
+| fprintf (outfile, "%(symbol)s: size=%%" G_GSIZE_FORMAT ", alignment=%%" G_GSIZE_FORMAT "\n",
+| g_struct_info_get_size (struct_info),
+| g_struct_info_get_alignment (struct_info));
|
''')
for field in fields: