Re: [PATCH] reftable tests: use C syntax compatible with old xlc
From: Han-Wen Nienhuys <hidden>
Date: 2022-01-13 14:23:44
On Thu, Jan 13, 2022 at 12:38 PM Ævar Arnfjörð Bjarmason [off-list ref] wrote:
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.Weird. What C standard does xlc implement?
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.
I'd rather not duplicate anything. Can't you do
struct foobar *want = { &r[0], &r[2] .. }
--
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--
Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado