Browse Source

Some code is unreachable in the unit test - disable the clang compiler warning at these lines

bel 9 years ago
parent
commit
4c8979c077
2 changed files with 25 additions and 3 deletions
  1. 3 3
      test/private.c
  2. 22 0
      test/public_server.c

+ 3 - 3
test/private.c

@@ -471,9 +471,9 @@ START_TEST(test_mask_data)
 	int i;
 #endif
 
-    uint32_t mask = 0x61626364;
-    /* TODO: adapt test for big endian */
-    ck_assert((*(unsigned char*)mask) == 0x64u);
+	uint32_t mask = 0x61626364;
+	/* TODO: adapt test for big endian */
+	ck_assert((*(unsigned char *)mask) == 0x64u);
 
 #if defined(USE_WEBSOCKET)
 	memset(in, 0, sizeof(in));

+ 22 - 0
test/public_server.c

@@ -100,8 +100,19 @@ wait_not_null(void *volatile *data)
 			return 1;
 		}
 	}
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunreachable-code
+#endif
+
 	ck_abort_msg("wait_not_null failed");
+
 	return 0;
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 }
 
 START_TEST(test_the_test_environment)
@@ -613,8 +624,19 @@ websock_server_data(struct mg_connection *conn,
 		mg_websocket_write(conn, WEBSOCKET_OPCODE_TEXT, "ok - 3", 6);
 		mg_unlock_connection(conn);
 	} else {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunreachable-code
+#endif
+
 		ck_abort_msg("Got unexpected message from websocket client");
+
+
 		return 0;
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 	}
 
 	return 1; /* return 1 to keep the connetion open */