Browse Source

configurator: Fix warning in HAVE_FOR_LOOP_DECLARATION

Visual C++ prints "warning C4702: unreachable code" due to the return
statement after the for loop which is never reached.  Fix this by
setting a variable returned by a single return statement at the end.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Kevin Locke 9 years ago
parent
commit
c455d55526
1 changed files with 3 additions and 2 deletions
  1. 3 2
      tools/configurator/configurator.c

+ 3 - 2
tools/configurator/configurator.c

@@ -202,8 +202,9 @@ static struct test tests[] = {
 	  "	return sizeof(off_t) == 8 ? 0 : 1;\n"
 	  "}\n" },
 	{ "HAVE_FOR_LOOP_DECLARATION", INSIDE_MAIN, NULL, NULL,
-	  "for (int i = 0; i < argc; i++) { return 0; };\n"
-	  "return 1;" },
+	  "int ret = 1;\n"
+	  "for (int i = 0; i < argc; i++) { ret = 0; };\n"
+	  "return ret;" },
 	{ "HAVE_FLEXIBLE_ARRAY_MEMBER", OUTSIDE_MAIN, NULL, NULL,
 	  "struct foo { unsigned int x; int arr[]; };" },
 	{ "HAVE_GETPAGESIZE", DEFINES_FUNC, NULL, NULL,