Re: [PATCH] reftable tests: use C syntax compatible with old xlc
- From
Han-Wen Nienhuys <hanwen@google.com>
- Date
- Jan 13, 2022, 14:23 UTC
- Message-ID
- <CAFQ2z_M2ZH-8RNS_zxShkdaXdO4x4Vr8EwrFo6atd0qzyy36oA@mail.gmail.com>
- In-Reply-To
- <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>
On Thu, Jan 13, 2022 at 12:38 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 12 quoted lines
> 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