lib/repo: Add some assertions for ABI sizes

Things like https://sourceware.org/libabigail/manual/abidiff.html
look interesting but in a brief look I couldn't work out
how to conveniently use them for quick ABI sanity checking without
doing a diff from a previous build (which we could do but would be
more involved).

This way will at least catch struct ABI breaks on x86_64 which
I think we'd be most likely to do accidentally when trying
to use one of the previous unused values.

I found the hole values via gdb's `pahole` command.

Closes: #1108
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-08-24 14:58:51 +00:00
1 parent 882fa906e2
commit 95bac299e5
2 files changed
+32

No files matched your search

+5
View File
@@ -724,6 +724,7 @@ typedef struct {
guint disable_xattrs : 1;
guint reserved : 31;
/* 4 byte hole on 64 bit arches */
guint64 timestamp_secs;
guint unused_uint[8];
@@ -838,6 +839,7 @@ typedef struct {
gboolean force_copy; /* Since: 2017.6 */
gboolean bareuseronly_dirs; /* Since: 2017.7 */
gboolean unused_bools[5];
/* 4 byte hole on 64 bit */
const char *subpath;
@@ -972,6 +974,7 @@ gboolean ostree_repo_traverse_commit_union (OstreeRepo *repo,
struct _OstreeRepoCommitTraverseIter {
gboolean initialized;
/* 4 byte hole on 64 bit */
gpointer dummy[10];
char dummy_checksum_data[(OSTREE_SHA256_STRING_LEN+1)*2];
};
@@ -1060,6 +1063,8 @@ gboolean ostree_repo_prune (OstreeRepo *self,
struct _OstreeRepoPruneOptions {
OstreeRepoPruneFlags flags;
/* 4 byte hole on 64 bit */
GHashTable *reachable; /* Set<GVariant> (object names) */
gboolean unused_bools[6];