zephyr/tests/net/socket
Tom Hughes 9e85669482 tests: net: socket: Fix -Wsometimes-uninitialized warning
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>
2025-02-07 02:23:24 +01:00
..
af_packet everywhere: replace double words 2024-06-22 05:40:22 -04:00
af_packet_ipproto_raw posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO 2024-06-04 16:27:12 -05:00
can tests/net: Use hwmv2 native targets identifiers 2024-03-15 16:13:12 +01:00
getaddrinfo lib: net_buf: rename header file from zephyr/net/buf.h to zephyr/net_buf.h 2024-09-07 11:19:05 -05:00
getnameinfo tests: net: Exclude native_posix because of socket service 2024-05-20 14:25:44 +03:00
misc net: Fix inet_pton IPv4 implementation 2025-01-29 17:56:09 +01:00
net_mgmt tests: net: sockets: Remove use of NET_SOCKETS_POSIX_NAMES 2024-03-27 13:40:13 -05:00
offload_dispatcher fdtable: replace z_ prefix with zvfs_ for fdtable.h functions 2024-06-26 12:33:02 +02:00
poll posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO 2024-06-04 16:27:12 -05:00
register net: socket: Change the protocol field for AF_PACKET sockets 2024-05-29 10:48:34 -07:00
reuseaddr_reuseport posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO 2024-06-04 16:27:12 -05:00
select posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO 2024-06-04 16:27:12 -05:00
service net: sockets: socket_service: remove k_work related code 2024-10-23 11:32:21 +02:00
socketpair posix: deprecate POSIX_MAX_FDS and add POSIX_DEVICE_IO 2024-06-04 16:27:12 -05:00
tcp tests: net: socket: Fix -Wsometimes-uninitialized warning 2025-02-07 02:23:24 +01:00
tls tests: net: sockets: tls: Increase connect timeout 2024-09-28 08:21:51 -05:00
tls_configurations tests: tls_configurations: adjust Kconfig in overlay-ec 2024-12-16 22:56:43 +01:00
tls_ext tests: net: tls_ext: Fix scheduling race 2025-02-04 11:55:17 +01:00
udp tests: net: socket: udp: Verify recvmsg buffer lengths 2025-01-30 14:09:35 +01:00
websocket misc: move lorem ipsum text to zephyr/misc/lorem_ipsum.h 2024-08-02 03:31:06 -04:00
socket_helpers.h tests: net: sockets: Remove use of NET_SOCKETS_POSIX_NAMES 2024-03-27 13:40:13 -05:00