checkout: squelch "'mode' may be used uninitialized in this function" warning
PATCH 1/1 checkout: squelch "'mode' may be used uninitialized in this function" warning
From: David Soria Parra <[email protected]>
Use a 'fake' initialization for the 'mode' variable to work around a GCC warning as in 5a7a367. The necessary condition to initialize 'mode' will always be true but cannot be checked by the compiler.
--- builtin/checkout.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
builtin/checkout.c +1 -1
@@ -157,7 +157,7 @@ static int checkout_merged(int pos, struct checkout *state)unsigned char sha1[20 ];mmbuffer_t result_buf;unsigned char threeway[3 ][20 ]; -unsigned mode; +unsigned mode = mode;memset (threeway,0 ,sizeof (threeway));while (pos < active_nr) {
Signature · 1 line
1.7.8.GIT
Any update on this patch? Is it going to maint?
Quoted 24 lines · On 2012-04-30, [email protected] <[email protected]> wrote:
From: David Soria Parra <[email protected]>
Use a 'fake' initialization for the 'mode' variable to work around a GCC warning as in 5a7a367. The necessary condition to initialize 'mode' will always be true but cannot be checked by the compiler.
Signed-off-by David Soria Parra <[email protected]>--- builtin/checkout.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)builtin/checkout.c +1
-1@@ -157,7 +157,7 @@ static int checkout_merged(int pos, struct checkout *state)unsigned char sha1[20 ];mmbuffer_t result_buf;unsigned char threeway[3 ][20 ]; -unsigned mode; +unsigned mode = mode;memset (threeway,0 ,sizeof (threeway));while (pos < active_nr) {
Quoted 1 line · David Soria Parra
Any update on this patch? Is it going to maint?
I doubt it:
Quoted 10 lines
builtin/checkout.c static int checkout_merged(int pos, struct checkout *state) · line 160
Quoted 10 lines
builtin/checkout.c +1
-1@@ -157,7 +157,7 @@ static int checkout_merged(int pos, struct checkout *state)unsigned char sha1[20 ];mmbuffer_t result_buf;unsigned char threeway[3 ][20 ]; -unsigned mode; +unsigned mode = mode;
What is this based on? This has been fixed since 335c6e4 (checkout_merged(): squelch false warning from some gcc, 2011-12-15), which was in v1.7.8.2.
-Peff