Subject: Re: [RFC PATCH 1/1] maintenance: separate parallelism safe and unsafe tasks

From: Junio C Hamano <[email-masked]>
Date: Mon, 11 Nov 2024 17:24:59 +0900

Calvin Wan <[email-masked]> writes:

> +	for (j = j; j < TASK__COUNT; j++) {

This seems to break the build.
Here is what I got from my compiler.

builtin/gc.c:1588:9: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign]
        for (j = j; j < TASK__COUNT; j++) {
             ~ ^ ~
builtin/gc.c:1535:11: error: variable 'j' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        else if (opts->detach > 0) {
                 ^~~~~~~~~~~~~~~~
builtin/gc.c:1588:11: note: uninitialized use occurs here
        for (j = j; j < TASK__COUNT; j++) {
                 ^
builtin/gc.c:1535:7: note: remove the 'if' if its condition is always true
        else if (opts->detach > 0) {
             ^~~~~~~~~~~~~~~~~~~~~~
builtin/gc.c:1533:6: error: variable 'j' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (found_selected)
            ^~~~~~~~~~~~~~
builtin/gc.c:1588:11: note: uninitialized use occurs here
        for (j = j; j < TASK__COUNT; j++) {
                 ^
builtin/gc.c:1533:2: note: remove the 'if' if its condition is always false
        if (found_selected)
        ^~~~~~~~~~~~~~~~~~~
builtin/gc.c:1508:10: note: initialize the variable 'j' to silence this warning
        int i, j, found_selected = 0;
                ^
                 = 0