wt-status.c: Initialise variable to suppress msvc warning
PATCH 14/14 wt-status.c: Initialise variable to suppress msvc warning
The msvc compiler thinks that a variable could be used while uninitialised and issues the following warning:
...\git\wt-status.c(152) : warning C4700: uninitialized local \
variable 'status' used
In order to suppress the warning, we simply initialise the variable to zero.
--- wt-status.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
wt-status.c +1 -1
@@ -149,7 +149,7 @@ static void wt_status_print_change_data(struct wt_status *s, {struct wt_status_change_data *d = it->util;const char *c =color (change_type, s); -int status = status; +int status =0 ;char *one_name;char *two_name;const char *one, *two;
Signature · 1 line
1.7.3
wt-status.c static void wt_status_print_change_data(struct wt_status *s, · line 152
Quoted 8 lines · Ramsay Jones
wt-status.c +1
-1@@ -149,7 +149,7 @@ static void wt_status_print_change_data(struct wt_status *s, {struct wt_status_change_data *d = it->util;const char *c =color (change_type, s); -int status = status; +int status =0 ;
Just for the record (I assume you are already aware of this):
http://thread.gmane.org/gmane.comp.version-control.git/133278/focus=133422
http://thread.gmane.org/gmane.comp.version-control.git/124676/focus=124803
I personally feel lukewarm about this kind of change. Is it possible to suppress this warning from msvc?
Quoted 5 lines · Jonathan Nieder
Just for the record (I assume you are already aware of this):
http://thread.gmane.org/gmane.comp.version-control.git/133278/focus=133422
http://thread.gmane.org/gmane.comp.version-control.git/124676/focus=124803
Yes
Quoted 1 line
I personally feel lukewarm about this kind of change.
OK.
Junio, could you please drop patches 5-14 from the series; the first four patches are the important ones and I'd rather they didn't get held up. Thanks!
ATB,
Ramsay Jones
Quoted 2 lines · Ramsay Jones
Junio, could you please drop patches 5-14 from the series; the first four patches are the important ones and I'd rather they didn't get held up. Thanks!
Have these four patches been Acked by interested parties?
I think I saw 1/N and 2/N acked by Erik and 4/N acked by SSchuberth and J6t, but any words on 3/N?
Not that I deeply care nor have environment to test changes to [3/N], but I am wondering if these need conditional definition to futureproof (e.g. what happens when the header you are using the definition _I64_MIN from, or some other headers, started defining these constats?).
Quoted 7 lines · Junio C Hamano
Quoted 2 lines · Ramsay Jones
Junio, could you please drop patches 5-14 from the series; the first four patches are the important ones and I'd rather they didn't get held up. Thanks!
Have these four patches been Acked by interested parties?
Quoted 7 lines
I think I saw 1/N and 2/N acked by Erik and 4/N acked by SSchuberth and J6t, but any words on 3/N?
Not that I deeply care nor have environment to test changes to [3/N], but I am wondering if these need conditional definition to futureproof (e.g. what happens when the header you are using the definition
_I64_MINfrom, or some other headers, started defining these constats?).
I'm not sure if I follow this entirely. _I64_MIN is defined by limits.h on Windows, and limits.h has a header-guard (or "#pragma once" as Microsoft-code tends to prefer).
Oh, right. You mean if someone else starts defining INTMAX_MAX etc? If someone includes an stdint/inttypes-implementation while including git-compat-util.h, we're going to have a boat-load of similar issues anyway. I think guarding them is something that's better left to when we encounter the problem (if ever).
All in all, patch 1 though 4 looks good to me. And thanks to Ramsay for cleaning up my mess :)
Sebastian Schuberth
Acked-byQuoted 20 lines · Erik Faye-Lund
Quoted 7 lines · Junio C Hamano
Quoted 2 lines · Ramsay Jones
Junio, could you please drop patches 5-14 from the series; the first four patches are the important ones and I'd rather they didn't get held up. Thanks!
Have these four patches been Acked by interested parties?
Quoted 7 lines
I think I saw 1/N and 2/N acked by Erik and 4/N acked by SSchuberth and J6t, but any words on 3/N?
Not that I deeply care nor have environment to test changes to [3/N], but I am wondering if these need conditional definition to futureproof (e.g. what happens when the header you are using the definition
_I64_MINfrom, or some other headers, started defining these constats?).I'm not sure if I follow this entirely.
_I64_MINis defined bylimits.hon Windows, andlimits.hhas a header-guard (or "#pragma once" as Microsoft-code tends to prefer).
Quoted 5 lines
Oh, right. You mean if someone else starts defining
INTMAX_MAXetc? If someone includes an stdint/inttypes-implementation while includinggit-compat-util.h, we're going to have a boat-load of similar issues anyway. I think guarding them is something that's better left to when we encounter the problem (if ever).
FYI: In contrast to previous versions, Visual Studio 2010 ships with a stdint.h header which defines INTMAX_MAX etc. However, that stdint.h is not included by limits.h (in fact, not by *any* other shipping header file, as it seems), so we should not run into any trouble even with VS2010.
So I agree with Erik about patch 3/N:
Signature · 1 line
Sebastian Schuberth
Quoted 28 lines · Sebastian Schuberth
Quoted 20 lines · Erik Faye-Lund
Quoted 7 lines · Junio C Hamano
Quoted 2 lines · Ramsay Jones
Junio, could you please drop patches 5-14 from the series; the first four patches are the important ones and I'd rather they didn't get held up. Thanks!
Have these four patches been Acked by interested parties?
Quoted 7 lines
I think I saw 1/N and 2/N acked by Erik and 4/N acked by SSchuberth and J6t, but any words on 3/N?
Not that I deeply care nor have environment to test changes to [3/N], but I am wondering if these need conditional definition to futureproof (e.g. what happens when the header you are using the definition
_I64_MINfrom, or some other headers, started defining these constats?).I'm not sure if I follow this entirely.
_I64_MINis defined bylimits.hon Windows, andlimits.hhas a header-guard (or "#pragma once" as Microsoft-code tends to prefer).Quoted 5 lines
Oh, right. You mean if someone else starts defining
INTMAX_MAXetc? If someone includes an stdint/inttypes-implementation while includinggit-compat-util.h, we're going to have a boat-load of similar issues anyway. I think guarding them is something that's better left to when we encounter the problem (if ever).
Quoted 6 lines
FYI: In contrast to previous versions, Visual Studio 2010 ships with a
stdint.hheader which definesINTMAX_MAXetc. However, thatstdint.his not included bylimits.h(in fact, not by *any* other shipping header file, as it seems), so we should not run into any trouble even with VS2010.
Very interesting, thanks. Did you try to compile Git on VS2010? This sounds like a reason for me to install VS2010 on one of my machines... :)
Quoted 10 lines · Erik Faye-Lund
Quoted 6 lines
FYI: In contrast to previous versions, Visual Studio 2010 ships with a
stdint.hheader which definesINTMAX_MAXetc. However, thatstdint.his not included bylimits.h(in fact, not by *any* other shipping header file, as it seems), so we should not run into any trouble even with VS2010.Very interesting, thanks. Did you try to compile Git on VS2010? This sounds like a reason for me to install VS2010 on one of my machines... :)
I just gave it a quick try by just importing the VS2008 solution, and there seem to be some CRT related link problems, but these should be easy to resolve. I don't have the time right now to look any further into this, sorry.
Signature · 1 line
Sebastian Schuberth