Building with clang warns:
tests/net/socket/tcp/src/main.c:377:13: error: variable 'c_sock' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
} else if (family == AF_INET6) {
^~~~~~~~~~~~~~~~~~
tests/net/socket/tcp/src/main.c:396:15: note: uninitialized use occurs here
test_connect(c_sock, s_saddr, addrlen);
^~~~~~
tests/net/socket/tcp/src/main.c:377:9: note: remove the 'if' if its
condition is always true
} else if (family == AF_INET6) {
^~~~~~~~~~~~~~~~~~~~~~~~
tests/net/socket/tcp/src/main.c:360:12: note: initialize the variable
'c_sock' to silence this warning
int c_sock;
^
= 0
tests/net/socket/tcp/src/main.c:377:13: error: variable 's_sock' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
} else if (family == AF_INET6) {
^~~~~~~~~~~~~~~~~~
tests/net/socket/tcp/src/main.c:387:12: note: uninitialized use occurs here
test_bind(s_sock, s_saddr, addrlen);
^~~~~~
tests/net/socket/tcp/src/main.c:377:9: note: remove the 'if' if its
condition is always true
} else if (family == AF_INET6) {
^~~~~~~~~~~~~~~~~~~~~~~~
tests/net/socket/tcp/src/main.c:361:12: note: initialize the variable
's_sock' to silence this warning
int s_sock;
^
= 0
Not really needed since we have zassert_unreachable(), but doesn't hurt
to initialize the variables.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
|
||
|---|---|---|
| .. | ||
| af_packet | ||
| af_packet_ipproto_raw | ||
| can | ||
| getaddrinfo | ||
| getnameinfo | ||
| misc | ||
| net_mgmt | ||
| offload_dispatcher | ||
| poll | ||
| register | ||
| reuseaddr_reuseport | ||
| select | ||
| service | ||
| socketpair | ||
| tcp | ||
| tls | ||
| tls_configurations | ||
| tls_ext | ||
| udp | ||
| websocket | ||
| socket_helpers.h | ||