[PATCH 14/14] wt-status.c: Initialise variable to suppress msvc warning

Subsystems: the rest

STALE3741d

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH 14/14] wt-status.c: Initialise variable to suppress msvc warning

From: Ramsay Jones <hidden>
Date: 2016-06-15 22:50:10

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.

Signed-off-by: Ramsay Jones <redacted>
---
 wt-status.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index d9f3d9f..9b4b5bf 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -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;
-- 
1.7.3

Re: [PATCH 14/14] wt-status.c: Initialise variable to suppress msvc warning

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:10

Ramsay Jones wrote:
quoted hunk
--- a/wt-status.c
+++ b/wt-status.c
@@ -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?

Re: [PATCH 14/14] wt-status.c: Initialise variable to suppress msvc warning

From: Ramsay Jones <hidden>
Date: 2016-06-15 22:50:13

Jonathan Nieder wrote:
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
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help