summaryrefslogtreecommitdiff
path: root/tests/offsets
diff options
context:
space:
mode:
authorColin Walters <walters@src.gnome.org>2009-02-02 16:31:02 +0000
committerColin Walters <walters@src.gnome.org>2009-02-02 16:31:02 +0000
commit34c6fe51cd8d669d95aef52bda9abbc38257bca9 (patch)
tree3785e49132f0f2cc0e536d3a677da746f56ba85a /tests/offsets
parentf9a260e02e9921149d52622778ae7c489a5fa257 (diff)
downloadgobject-introspection-34c6fe51cd8d669d95aef52bda9abbc38257bca9.tar.gz
Bug 563469 – Arrays not treated correctly in struct offset calculation
Arrays are currently not handled specially, and hence treated as pointers in giroffsets.c:get_field_size_alignment(), which is (obviously) wrong. svn path=/trunk/; revision=1078
Diffstat (limited to 'tests/offsets')
-rwxr-xr-xtests/offsets/gen-gitestoffsets2
-rw-r--r--tests/offsets/offsets.h14
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/offsets/gen-gitestoffsets b/tests/offsets/gen-gitestoffsets
index ce4a977c..58139fc2 100755
--- a/tests/offsets/gen-gitestoffsets
+++ b/tests/offsets/gen-gitestoffsets
@@ -61,7 +61,7 @@ STRUCT_DEF_RE = compile_re("struct\s+_(TOKEN)\s*{([^}]*)}")
# This certainly can't handle all type declarations, but it only
# needs to handle the ones we use in the test cases
-FIELD_RE = compile_re("^(?:const\s+)?TOKEN(?:[\s*]+)(TOKEN)\s*;$");
+FIELD_RE = compile_re(r"^(?:const\s+)?TOKEN(?:[\s*]+)(TOKEN)\s*(?:\[([0-9]*)\])?\s*;$")
input_f = open(sys.argv[1])
diff --git a/tests/offsets/offsets.h b/tests/offsets/offsets.h
index c0edfe01..9c29a989 100644
--- a/tests/offsets/offsets.h
+++ b/tests/offsets/offsets.h
@@ -104,4 +104,18 @@ struct _OffsetsNested {
char dummy3;
};
+/* Test array offsets
+ */
+
+typedef struct _OffsetsArray OffsetsArray;
+
+struct _OffsetsArray
+{
+ gint some_ints[2];
+ gint8 some_int8s[3];
+ gdouble some_doubles[4];
+ Enum1 some_enum[2];
+ gpointer some_ptrs[5];
+};
+
#endif /* __OFFSETS_H__ */