{"thread":{"id":"57237","subject":"[PATCH] reftable: avoid initializing structs from structs","startedAt":"2022-01-13T16:55:39Z","lastAt":"2022-01-17T19:08:08Z","messageCount":7,"participants":["Han-Wen Nienhuys via GitGitGadget","Ævar Arnfjörð Bjarmason","Han-Wen Nienhuys","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"446166","messageId":"pull.1188.git.git.1642092934523.gitgitgadget@gmail.com","threadId":"57237","inReplyTo":null,"subject":"[PATCH] reftable: avoid initializing structs from structs","fromName":"Han-Wen Nienhuys via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-01-13T16:55:34Z","receivedAt":"2022-01-13T16:55:39Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"From: Han-Wen Nienhuys <hanwen@google.com>\n\nApparently, the IBM xlc compiler doesn't like this.\n\nSigned-off-by: Han-Wen Nienhuys <hanwen@google.com>\n---\n    reftable: avoid initializing structs from structs\n    \n    Apparently, the IBM xlc compiler doesn't like this.\n    \n    Signed-off-by: Han-Wen Nienhuys hanwen@google.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1188%2Fhanwen%2Freftable-xlc-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1188/hanwen/reftable-xlc-v1\nPull-Request: https://github.com/git/git/pull/1188\n\n reftable/merged_test.c | 22 +++++++++++-----------\n 1 file changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/reftable/merged_test.c b/reftable/merged_test.c\nindex 24461e8a802..abd34849fca 100644\n--- a/reftable/merged_test.c\n+++ b/reftable/merged_test.c\n@@ -207,11 +207,11 @@ static void test_merged(void)\n \t\t},\n \t};\n \n-\tstruct reftable_ref_record want[] = {\n-\t\tr2[0],\n-\t\tr1[1],\n-\t\tr3[0],\n-\t\tr3[1],\n+\tstruct reftable_ref_record *want[] = {\n+\t\t&r2[0],\n+\t\t&r1[1],\n+\t\t&r3[0],\n+\t\t&r3[1],\n \t};\n \n \tstruct reftable_ref_record *refs[] = { r1, r2, r3 };\n@@ -250,7 +250,7 @@ static void test_merged(void)\n \n \tEXPECT(ARRAY_SIZE(want) == len);\n \tfor (i = 0; i < len; i++) {\n-\t\tEXPECT(reftable_ref_record_equal(&want[i], &out[i],\n+\t\tEXPECT(reftable_ref_record_equal(want[i], &out[i],\n \t\t\t\t\t\t GIT_SHA1_RAWSZ));\n \t}\n \tfor (i = 0; i < len; i++) {\n@@ -345,10 +345,10 @@ static void test_merged_logs(void)\n \t\t\t.value_type = REFTABLE_LOG_DELETION,\n \t\t},\n \t};\n-\tstruct reftable_log_record want[] = {\n-\t\tr2[0],\n-\t\tr3[0],\n-\t\tr1[1],\n+\tstruct reftable_log_record *want[] = {\n+\t\t&r2[0],\n+\t\t&r3[0],\n+\t\t&r1[1],\n \t};\n \n \tstruct reftable_log_record *logs[] = { r1, r2, r3 };\n@@ -387,7 +387,7 @@ static void test_merged_logs(void)\n \n \tEXPECT(ARRAY_SIZE(want) == len);\n \tfor (i = 0; i < len; i++) {\n-\t\tEXPECT(reftable_log_record_equal(&want[i], &out[i],\n+\t\tEXPECT(reftable_log_record_equal(want[i], &out[i],\n \t\t\t\t\t\t GIT_SHA1_RAWSZ));\n \t}\n \n\nbase-commit: 1ffcbaa1a5f10c9f706314d77f88de20a4a498c2\n-- \ngitgitgadget\n"},{"id":"446167","messageId":"220113.86r19btv5a.gmgdl@evledraar.gmail.com","threadId":"57237","inReplyTo":"pull.1188.git.git.1642092934523.gitgitgadget@gmail.com","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-01-13T17:13:14Z","receivedAt":"2022-01-13T17:15:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Jan 13 2022, Han-Wen Nienhuys via GitGitGadget wrote:\n\n> From: Han-Wen Nienhuys <hanwen@google.com>\n\nAh, nevermind <220113.86v8yntxfb.gmgdl@evledraar.gmail.com>, so you\nmeant *want[] :)\n\nI can confirm that this works on the xlc version that errored on this\nbefore, the reftable tests even pass!\n\n> Apparently, the IBM xlc compiler doesn't like this.\n\nWould make sense to steal the compiler version etc. details from my\n<patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\nwe'll be able to change this & other code back, as nobody will care\nabout that older compiler version. It worked before in the pre-image on\na more recent xlc.\n\n> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>\n> ---\n>     reftable: avoid initializing structs from structs\n>     \n>     Apparently, the IBM xlc compiler doesn't like this.\n>     \n>     Signed-off-by: Han-Wen Nienhuys hanwen@google.com\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1188%2Fhanwen%2Freftable-xlc-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1188/hanwen/reftable-xlc-v1\n> Pull-Request: https://github.com/git/git/pull/1188\n>\n>  reftable/merged_test.c | 22 +++++++++++-----------\n>  1 file changed, 11 insertions(+), 11 deletions(-)\n>\n> diff --git a/reftable/merged_test.c b/reftable/merged_test.c\n> index 24461e8a802..abd34849fca 100644\n> --- a/reftable/merged_test.c\n> +++ b/reftable/merged_test.c\n> @@ -207,11 +207,11 @@ static void test_merged(void)\n>  \t\t},\n>  \t};\n>  \n> -\tstruct reftable_ref_record want[] = {\n> -\t\tr2[0],\n> -\t\tr1[1],\n> -\t\tr3[0],\n> -\t\tr3[1],\n> +\tstruct reftable_ref_record *want[] = {\n> +\t\t&r2[0],\n> +\t\t&r1[1],\n> +\t\t&r3[0],\n> +\t\t&r3[1],\n>  \t};\n>  \n>  \tstruct reftable_ref_record *refs[] = { r1, r2, r3 };\n> @@ -250,7 +250,7 @@ static void test_merged(void)\n>  \n>  \tEXPECT(ARRAY_SIZE(want) == len);\n>  \tfor (i = 0; i < len; i++) {\n> -\t\tEXPECT(reftable_ref_record_equal(&want[i], &out[i],\n> +\t\tEXPECT(reftable_ref_record_equal(want[i], &out[i],\n>  \t\t\t\t\t\t GIT_SHA1_RAWSZ));\n>  \t}\n>  \tfor (i = 0; i < len; i++) {\n> @@ -345,10 +345,10 @@ static void test_merged_logs(void)\n>  \t\t\t.value_type = REFTABLE_LOG_DELETION,\n>  \t\t},\n>  \t};\n> -\tstruct reftable_log_record want[] = {\n> -\t\tr2[0],\n> -\t\tr3[0],\n> -\t\tr1[1],\n> +\tstruct reftable_log_record *want[] = {\n> +\t\t&r2[0],\n> +\t\t&r3[0],\n> +\t\t&r1[1],\n>  \t};\n>  \n>  \tstruct reftable_log_record *logs[] = { r1, r2, r3 };\n> @@ -387,7 +387,7 @@ static void test_merged_logs(void)\n>  \n>  \tEXPECT(ARRAY_SIZE(want) == len);\n>  \tfor (i = 0; i < len; i++) {\n> -\t\tEXPECT(reftable_log_record_equal(&want[i], &out[i],\n> +\t\tEXPECT(reftable_log_record_equal(want[i], &out[i],\n>  \t\t\t\t\t\t GIT_SHA1_RAWSZ));\n>  \t}\n>  \n>\n> base-commit: 1ffcbaa1a5f10c9f706314d77f88de20a4a498c2\n\n"},{"id":"446169","messageId":"CAFQ2z_Nng6woxKVCpGzL95EOkuBFMQW7FtCTJfyaAZaZ-HMQcA@mail.gmail.com","threadId":"57237","inReplyTo":"220113.86r19btv5a.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2022-01-13T17:40:10Z","receivedAt":"2022-01-13T17:40:24Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Thu, Jan 13, 2022 at 6:14 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> I can confirm that this works on the xlc version that errored on this\n> before, the reftable tests even pass!\n>\n> > Apparently, the IBM xlc compiler doesn't like this.\n>\n> Would make sense to steal the compiler version etc. details from my\n> <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\n> we'll be able to change this & other code back, as nobody will care\n> about that older compiler version. It worked before in the pre-image on\n> a more recent xlc.\n\nFeel free to butcher this in any way you like for your series. :)\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"446178","messageId":"xmqqy23jh2h3.fsf@gitster.g","threadId":"57237","inReplyTo":"220113.86r19btv5a.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-01-13T19:15:04Z","receivedAt":"2022-01-13T19:15:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> Would make sense to steal the compiler version etc. details from my\n> <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\n> we'll be able to change this & other code back, as nobody will care\n> about that older compiler version. It worked before in the pre-image on\n> a more recent xlc.\n\nIf so, wouldn't it be a better option not to worry about such an old\ncompiler at all from the get-go?  Even with an unnecessary \"turn an\narray of structs into an array of pointers to structs\", the\nresulting code becomes less natural to follow.  And after all, this\nmay be part of our tree but is not yet integrated with our system,\nno?\n\nThanks.\n"},{"id":"446179","messageId":"xmqqtue7h0dd.fsf@gitster.g","threadId":"57237","inReplyTo":"xmqqy23jh2h3.fsf@gitster.g","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-01-13T20:00:30Z","receivedAt":"2022-01-13T20:00:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> Would make sense to steal the compiler version etc. details from my\n>> <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\n>> we'll be able to change this & other code back, as nobody will care\n>> about that older compiler version. It worked before in the pre-image on\n>> a more recent xlc.\n>\n> If so, wouldn't it be a better option not to worry about such an old\n> compiler at all from the get-go?\n\nThe above was a genuine question.  If that \"nobody will care about\nthe old compiler\" will happen only after a few years, then it may\nnot work to just ignore the version of xlc which might still have\na meaningful number of users.  I just am not in a good position to\njudge that.\n\nThanks.\n\n\n"},{"id":"446356","messageId":"CAFQ2z_PNRb6HLUD81=_HkRrX0cMLfzz4NmVJaTUQ37EC61MXbg@mail.gmail.com","threadId":"57237","inReplyTo":"xmqqtue7h0dd.fsf@gitster.g","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2022-01-17T13:07:35Z","receivedAt":"2022-01-17T13:07:50Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Thu, Jan 13, 2022 at 9:00 PM Junio C Hamano <gitster@pobox.com> wrote:\n> >> Would make sense to steal the compiler version etc. details from my\n> >> <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\n> >> we'll be able to change this & other code back, as nobody will care\n> >> about that older compiler version. It worked before in the pre-image on\n> >> a more recent xlc.\n> >\n> > If so, wouldn't it be a better option not to worry about such an old\n> > compiler at all from the get-go?\n>\n> The above was a genuine question.  If that \"nobody will care about\n> the old compiler\" will happen only after a few years, then it may\n> not work to just ignore the version of xlc which might still have\n> a meaningful number of users.  I just am not in a good position to\n> judge that.\n\nI'm all for not worrying too much about ancient compilers, but there\nis no downside to this patch, so it seems fine to let this one go\nthrough.\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"446376","messageId":"xmqqpmoquqng.fsf@gitster.g","threadId":"57237","inReplyTo":"CAFQ2z_PNRb6HLUD81=_HkRrX0cMLfzz4NmVJaTUQ37EC61MXbg@mail.gmail.com","subject":"Re: [PATCH] reftable: avoid initializing structs from structs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-01-17T19:08:03Z","receivedAt":"2022-01-17T19:08:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Han-Wen Nienhuys <hanwen@google.com> writes:\n\n> On Thu, Jan 13, 2022 at 9:00 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> >> Would make sense to steal the compiler version etc. details from my\n>> >> <patch-1.1-7425b64c0a0-20220113T113821Z-avarab@gmail.com>. I.e. eventually\n>> >> we'll be able to change this & other code back, as nobody will care\n>> >> about that older compiler version. It worked before in the pre-image on\n>> >> a more recent xlc.\n>> >\n>> > If so, wouldn't it be a better option not to worry about such an old\n>> > compiler at all from the get-go?\n>>\n>> The above was a genuine question.  If that \"nobody will care about\n>> the old compiler\" will happen only after a few years, then it may\n>> not work to just ignore the version of xlc which might still have\n>> a meaningful number of users.  I just am not in a good position to\n>> judge that.\n>\n> I'm all for not worrying too much about ancient compilers, but there\n> is no downside to this patch, so it seems fine to let this one go\n> through.\n\nYup, I think this already is part of -rc1.\n\nThanks.\n"}]}