Skip to content

Commit 1c1b7ed

Browse files
committed
tests: net: lib: http_server: Disable erroneous warning from clang
The warning emitted is: tests/net/lib/http_server/core/src/main.c:1400:19: error: variable 'http1_header_capture_common_response' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static const char http1_header_capture_common_response[] ^ = "HTTP/1.1 200\r\n" However, this variable is needed at compile-time since it's referenced via sizeof(). This appears to be the same as this clang bug: llvm/llvm-project#25458. This warning only started being emitted when I re-enabled the -Wunused-function warning for clang. Signed-off-by: Tom Hughes <[email protected]>
1 parent 2269962 commit 1c1b7ed

File tree

1 file changed

+3
-0
lines changed
  • tests/net/lib/http_server/core/src

1 file changed

+3
-0
lines changed

tests/net/lib/http_server/core/src/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -1416,11 +1416,14 @@ ZTEST(server_function_tests, test_http2_rst_stream)
14161416
zassert_equal(ret, 0, "Connection should've been closed");
14171417
}
14181418

1419+
/* Disable erroneous warning: https://github.com/llvm/llvm-project/issues/25458. */
1420+
TOOLCHAIN_DISABLE_CLANG_WARNING("-Wunneeded-internal-declaration")
14191421
static const char http1_header_capture_common_response[] = "HTTP/1.1 200\r\n"
14201422
"Transfer-Encoding: chunked\r\n"
14211423
"Content-Type: text/plain\r\n"
14221424
"\r\n"
14231425
"0\r\n\r\n";
1426+
TOOLCHAIN_ENABLE_CLANG_WARNING("-Wunneeded-internal-declaration")
14241427

14251428
static void test_http1_header_capture_common(const char *request)
14261429
{

0 commit comments

Comments
 (0)