Change code added in 1ae2b8cda84 (reftable: add merged table view, 2021-10-07) to be compatible with older versions of AIX's IBM xlc compiler. Version V12.1 of it (on gcc111.fsffrance.org) will hard error with: "reftable/merged_test.c", line 211.19: 1506-196 (S) Initialization between types "char*" and "struct reftable_ref_record" is not allowed. "reftable/merged_test.c", line 212.19: 1506-196 (S) Initialization between types "unsigned long long" and "struct reftable_ref_record" is not allowed. "reftable/merged_test.c", line 213.19: 1506-196 (S) Initialization between types "enum {...}" and "struct reftable_ref_record" is not allowed. "reftable/merged_test.c", line 214.19: 1506-196 (S) Initialization between types "unsigned char*" and "struct reftable_ref_record" is not allowed. "reftable/merged_test.c", line 349.19: 1506-196 (S) Initialization between types "char*" and "struct reftable_log_record" is not allowed. "reftable/merged_test.c", line 350.19: 1506-196 (S) Initialization between types "unsigned long long" and "struct reftable_log_record" is not allowed. "reftable/merged_test.c", line 351.19: 1506-196 (S) Initialization between types "enum {...}" and "struct reftable_log_record" is not allowed. Its newer V13.1.3 sibling (on gcc119.fsffrance.org, a AIX 7.2 box) will compile the pre-image without issues. Let's not make git's sources incompatible with this older AIX 7.1 compiler. Perhaps there's a better way to do this, but just duplicating the earlier struct values declared earlier in these functions works, and is probably the least bad solution. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- reftable/merged_test.c | 74 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) diff --git a/reftable/merged_test.c b/reftable/merged_test.c index 24461e8a802..bf231990a84 100644 --- a/reftable/merged_test.c +++ b/reftable/merged_test.c @@ -206,12 +206,38 @@ static void test_merged(void) .value.val1 = hash1, }, }; - + /* + * We don't use { r2[0], r3[0], ... } for compatibility with + * older IBM xlc. + */ struct reftable_ref_record want[] = { - r2[0], - r1[1], - r3[0], - r3[1], + /* Same as r2[0] */ + { + .refname = "a", + .update_index = 2, + .value_type = REFTABLE_REF_DELETION, + }, + /* Same as r1[1] */ + { + + .refname = "b", + .update_index = 1, + .value_type = REFTABLE_REF_VAL1, + .value.val1 = hash1, + }, + /* Same as r3[0..1] */ + { + .refname = "c", + .update_index = 3, + .value_type = REFTABLE_REF_VAL1, + .value.val1 = hash2, + }, + { + .refname = "d", + .update_index = 3, + .value_type = REFTABLE_REF_VAL1, + .value.val1 = hash1, + }, }; struct reftable_ref_record *refs[] = { r1, r2, r3 }; @@ -345,10 +371,42 @@ static void test_merged_logs(void) .value_type = REFTABLE_LOG_DELETION, }, }; + /* + * We don't use { r2[0], r3[0], ... } for compatibility with + * older IBM xlc. + */ struct reftable_log_record want[] = { - r2[0], - r3[0], - r1[1], + /* Same as r2[0] */ + { + .refname = "a", + .update_index = 3, + .value_type = REFTABLE_LOG_UPDATE, + .value.update = { + .new_hash = hash3, + .name = "jane doe", + .email = "jane@invalid", + .message = "message3", + } + }, + /* Same as r3[0] */ + { + .refname = "a", + .update_index = 2, + .value_type = REFTABLE_LOG_DELETION, + }, + /* Same as r1[1] */ + { + .refname = "a", + .update_index = 1, + .value_type = REFTABLE_LOG_UPDATE, + .value.update = { + .old_hash = hash1, + .new_hash = hash2, + .name = "jane doe", + .email = "jane@invalid", + .message = "message1", + } + }, }; struct reftable_log_record *logs[] = { r1, r2, r3 }; -- 2.35.0.rc0.850.gcc6bf5af6b1