git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin/gc.c: fix -Wdeclaration-after-statement

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 15, 2022, 09:37 UTC
Message-ID
<3p6n2r7s-q136-n7q9-8o27-740q4qr5os84@tzk.qr>
In-Reply-To
<patch-1.1-54d405f15f1-20221115T080212Z-avarab@gmail.com>
Hi Ævar,
On Tue, 15 Nov 2022, Ævar Arnfjörð Bjarmason wrote:
Show 11 quoted lines
> In 1f80129d61b (maintenance: add option to register in a specific
> config, 2022-11-09) code was added which triggers a
> "-Wdeclaration-after-statement" warning, which is on by default with
> DEVELOPER=1.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
> This landed in the latest "next" push-out, causing e.g this CI
> failure:
> https://github.com/git/git/actions/runs/3467538041/jobs/5792504315

I looked at the same thing all morning, and found that https://lore.kernel.org/git/20221111231910.26769-1-ronan@rjp.ie/ _probably_ was designed to fix the same issue (and I think you agree that that patch should be used instead of yours because it is more complete in fixing left-over issues).

However, try as I might, I did not find out yet why it does not apply cleanly over here (I got side-tracked into range-diff'ing patches downloaded from the archive, which is quite the challenge and not even fun because `range-diff` requires commits, not emails, so I side-tracked myself into teaching `range-diff` to accept mbox arguments).

Maybe you can adjust that patch so it applies cleanly?

Ciao, Dscho

Show 29 quoted lines
>
>  builtin/gc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/gc.c b/builtin/gc.c
> index 56b107e7f0b..22a990db0be 100644
> --- a/builtin/gc.c
> +++ b/builtin/gc.c
> @@ -1543,6 +1543,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
>  	int found = 0;
>  	struct string_list_item *item;
>  	const struct string_list *list;
> +	struct config_set cs;
>
>  	argc = parse_options(argc, argv, prefix, options,
>  			     builtin_maintenance_unregister_usage, 0);
> @@ -1550,7 +1551,6 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
>  		usage_with_options(builtin_maintenance_unregister_usage,
>  				   options);
>
> -	struct config_set cs;
>  	if (config_file) {
>  		git_configset_init(&cs);
>  		git_configset_add_file(&cs, config_file);
> --
> 2.38.0.1473.g172bcc0511c
>
>
>
Previous: Ævar Arnfjörð BjarmasonNext: Johannes Schindelin
Message 2 of 10 in “builtin/gc.c: fix -Wdeclaration-after-statement”
  1. builtin/gc.c: fix -Wdeclaration-after-statementÆvar Arnfjörð Bjarmason, Nov 15, 2022
  2. Johannes SchindelinNov 15, 2022
  3. Johannes SchindelinNov 15, 2022
  4. Ævar Arnfjörð BjarmasonNov 15, 2022
  5. maintenance --unregister: fix uninit'd data use & -Wdeclaration-after-statementÆvar Arnfjörð Bjarmason, Nov 15, 2022
  6. ronan@rjp.ieNov 15, 2022
  7. Taylor BlauNov 15, 2022
  8. ronan@rjp.ieNov 15, 2022
  9. Taylor BlauNov 15, 2022
  10. Taylor BlauNov 15, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.