{"thread":{"id":"33757","subject":"[PATCH 1/3] poll.h lies in the same folder, so use normal quotes for include","startedAt":"2013-05-09T01:10:50Z","lastAt":"2013-05-09T14:32:55Z","messageCount":9,"participants":["Sven Strickroth","Krzysztof Mazur","Jonathan Nieder","René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"216743","messageId":"518AF79A.5000408@cs-ware.de","threadId":"33757","inReplyTo":null,"subject":"[PATCH 0/3] MSVC fixes","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T01:10:50Z","receivedAt":"2013-05-09T01:10:50Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Hi,\n\nI've 3 patches fixing warnings and errors when compiling with latest\nMSVC (2012).\n\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216740","messageId":"518AF7EA.6020403@cs-ware.de","threadId":"33757","inReplyTo":"518AF79A.5000408@cs-ware.de","subject":"[PATCH 1/3] poll.h lies in the same folder, so use normal quotes for include","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T01:12:10Z","receivedAt":"2013-05-09T01:12:10Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Some compilers, like Visual C++ complain when <> is used instead of\ndouble quotes for non system includes.\n\nSigned-off-by: Sven Strickroth <email@cs-ware.de>\n---\n compat/poll/poll.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/compat/poll/poll.c b/compat/poll/poll.c\nindex 7d226ec..b85386a 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/poll.c\n@@ -31,7 +31,7 @@\n #include <sys/types.h>\n \n /* Specification.  */\n-#include <poll.h>\n+#include \"poll.h\"\n \n #include <errno.h>\n #include <limits.h>\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216741","messageId":"518AF81C.10302@cs-ware.de","threadId":"33757","inReplyTo":"518AF79A.5000408@cs-ware.de","subject":"[PATCH 2/3] mingw.h: Define only if necessary","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T01:13:00Z","receivedAt":"2013-05-09T01:13:00Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Since the latest version of MSVC EWOULDBLOCK, EAFNOSUPPORT and\nECONNABORTED are defined in errno.h. When used with MSVC mingw.h\nis included from msvc.h and causes warnings about redefinitions.\n\nSigned-off-by: Sven Strickroth <email@cs-ware.de>\n---\n compat/mingw.h | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 685cd2c..c424333 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -32,7 +32,9 @@ typedef int socklen_t;\n #define WEXITSTATUS(x) ((x) & 0xff)\n #define WTERMSIG(x) SIGTERM\n \n+#ifndef EWOULDBLOCK\n #define EWOULDBLOCK EAGAIN\n+#endif\n #define SHUT_WR SD_SEND\n \n #define SIGHUP 1\n@@ -46,8 +48,12 @@ typedef int socklen_t;\n #define F_SETFD 2\n #define FD_CLOEXEC 0x1\n \n+#ifndef EAFNOSUPPORT\n #define EAFNOSUPPORT WSAEAFNOSUPPORT\n+#endif\n+#ifndef ECONNABORTED\n #define ECONNABORTED WSAECONNABORTED\n+#endif\n \n struct passwd {\n \tchar *pw_name;\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216742","messageId":"518AF843.6040501@cs-ware.de","threadId":"33757","inReplyTo":"518AF79A.5000408@cs-ware.de","subject":"[PATCH 3/3] Initialize variables with values","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T01:13:39Z","receivedAt":"2013-05-09T01:13:39Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"With MSVC initializing a variable with \"int a=a\" causes a warning about\nusing an uninitialized value.\n\nSigned-off-by: Sven Strickroth <email@cs-ware.de>\n---\n builtin/rev-list.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..13afacd 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -338,7 +338,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n \n \tif (bisect_list) {\n-\t\tint reaches = reaches, all = all;\n+\t\tint reaches = 0, all = 0;\n \n \t\trevs.commits = find_bisection(revs.commits, &reaches, &all,\n \t\t\t\t\t      bisect_find_all);\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216744","messageId":"518AFC74.2040500@cs-ware.de","threadId":"33757","inReplyTo":"518AF7EA.6020403@cs-ware.de","subject":"Re: [PATCH 1/3] poll.h lies in the same folder, so use normal quotes for include","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T01:31:32Z","receivedAt":"2013-05-09T01:31:32Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Am 09.05.2013 03:12 schrieb Sven Strickroth:\n> Some compilers, like Visual C++ complain when <> is used instead of\n> double quotes for non system includes.\n\nI just noticed that this patch isn't necessary for 1.8.3 (since\n41f2999180f5a58f2a4214d896359c1587c9024f) any more. Sorry for the noise\n- I was still building against 1.8.2.2.\n\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216763","messageId":"20130509124022.GA8685@shrek.podlesie.net","threadId":"33757","inReplyTo":"518AF843.6040501@cs-ware.de","subject":"Re: [PATCH 3/3] Initialize variables with values","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2013-05-09T12:40:22Z","receivedAt":"2013-05-09T12:40:22Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"On Thu, May 09, 2013 at 03:13:39AM +0200, Sven Strickroth wrote:\n> With MSVC initializing a variable with \"int a=a\" causes a warning about\n> using an uninitialized value.\n> \n> Signed-off-by: Sven Strickroth <email@cs-ware.de>\n> ---\n>  builtin/rev-list.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/builtin/rev-list.c b/builtin/rev-list.c\n> index 67701be..13afacd 100644\n> --- a/builtin/rev-list.c\n> +++ b/builtin/rev-list.c\n> @@ -338,7 +338,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n>  \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n>  \n>  \tif (bisect_list) {\n> -\t\tint reaches = reaches, all = all;\n> +\t\tint reaches = 0, all = 0;\n>  \n>  \t\trevs.commits = find_bisection(revs.commits, &reaches, &all,\n>  \t\t\t\t\t      bisect_find_all);\n\nBut this generates worse code, at least using gcc 4.7.2:\n\n--- old\t2013-05-09 14:33:22.000000000 +0200\n+++ new\t2013-05-09 14:33:02.000000000 +0200\n@@ -1,2 +1,2 @@\n    text\t   data\t    bss\t    dec\t    hex\tfilename\n-   4283\t      0\t      0\t   4283\t   10bb\tbuiltin/rev-list.o\n+   4299\t      0\t      0\t   4299\t   10cb\tbuiltin/rev-list.o\n\nKrzysiek\n"},{"id":"216766","messageId":"20130509132115.GA3375@elie","threadId":"33757","inReplyTo":"518AF843.6040501@cs-ware.de","subject":"Re: [PATCH 3/3] Initialize variables with values","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-05-09T13:21:15Z","receivedAt":"2013-05-09T13:21:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nSven Strickroth wrote:\n\n> With MSVC initializing a variable with \"int a=a\" causes a warning about\n> using an uninitialized value.\n[...]\n> --- a/builtin/rev-list.c\n> +++ b/builtin/rev-list.c\n> @@ -338,7 +338,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n>  \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n>  \n>  \tif (bisect_list) {\n> -\t\tint reaches = reaches, all = all;\n> +\t\tint reaches = 0, all = 0;\n\nA correct way to spell this is\n\n\t\tint reaches, all;\n\nwhich, as a bonus, lets the compiler warn if they are used\nuninitialized.  Does that provoke warnings?\n\nThanks,\nJonathan\n"},{"id":"216768","messageId":"518BA986.8060209@cs-ware.de","threadId":"33757","inReplyTo":"20130509132115.GA3375@elie","subject":"Re: [PATCH 3/3] Initialize variables with values","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2013-05-09T13:49:58Z","receivedAt":"2013-05-09T13:49:58Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Am 09.05.2013 15:21 schrieb Jonathan Nieder:\n> Sven Strickroth wrote:\n> \n>> With MSVC initializing a variable with \"int a=a\" causes a warning about\n>> using an uninitialized value.\n> [...]\n>> --- a/builtin/rev-list.c\n>> +++ b/builtin/rev-list.c\n>> @@ -338,7 +338,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n>>  \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n>>  \n>>  \tif (bisect_list) {\n>> -\t\tint reaches = reaches, all = all;\n>> +\t\tint reaches = 0, all = 0;\n> \n> A correct way to spell this is\n> \n> \t\tint reaches, all;\n> \n> which, as a bonus, lets the compiler warn if they are used\n> uninitialized.  Does that provoke warnings?\n\nThis seems to be ok.\n\n-- \nBest regards,\n Sven Strickroth\n PGP key id F5A9D4C4 @ any key-server\n"},{"id":"216770","messageId":"518BB397.901@lsrfire.ath.cx","threadId":"33757","inReplyTo":"20130509132115.GA3375@elie","subject":"Re: [PATCH 3/3] Initialize variables with values","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2013-05-09T14:32:55Z","receivedAt":"2013-05-09T14:32:55Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 09.05.2013 15:21, schrieb Jonathan Nieder:\n> Hi,\n>\n> Sven Strickroth wrote:\n>\n>> With MSVC initializing a variable with \"int a=a\" causes a warning about\n>> using an uninitialized value.\n> [...]\n>> --- a/builtin/rev-list.c\n>> +++ b/builtin/rev-list.c\n>> @@ -338,7 +338,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)\n>>   \t\tmark_edges_uninteresting(revs.commits, &revs, show_edge);\n>>\n>>   \tif (bisect_list) {\n>> -\t\tint reaches = reaches, all = all;\n>> +\t\tint reaches = 0, all = 0;\n>\n> A correct way to spell this is\n>\n> \t\tint reaches, all;\n>\n> which, as a bonus, lets the compiler warn if they are used\n> uninitialized.  Does that provoke warnings?\n\nOnly find_bisection() (defined in bisect.c) is used to set these \nvariables in that block.  While it sets \"all\" unconditionally, it \ndoesn't always set \"reaches\" -- only if it actually finds something. \nThat's still safe because the following code path errors out early if \nnothing was found before it uses \"reaches\".\n\nAre there C compilers that can analyse initialization and usage of \nvariables across compilation units like that?\n\nAnyway, initializing the variables to zero makes this code consistent \nwith the second call-site of find_bisection().  Making sure this \nfunction sets \"reaches\" unconditionally as well and dropping the \ninitialization from both places may be even better.\n\nRené\n"}]}