-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Is your feature request related to a problem? Please describe.
2nd set of default cases are unreachable, since there's a return from a prior check:
osal/src/os/portable/os-impl-bsd-sockets.c
Lines 102 to 147 in 09a2c5e
| switch (stream->socket_type) | |
| { | |
| case OS_SocketType_DATAGRAM: | |
| os_type = SOCK_DGRAM; | |
| break; | |
| case OS_SocketType_STREAM: | |
| os_type = SOCK_STREAM; | |
| break; | |
| default: | |
| return OS_ERR_NOT_IMPLEMENTED; | |
| } | |
| switch (stream->socket_domain) | |
| { | |
| case OS_SocketDomain_INET: | |
| os_domain = AF_INET; | |
| break; | |
| #ifdef OS_NETWORK_SUPPORTS_IPV6 | |
| case OS_SocketDomain_INET6: | |
| os_domain = AF_INET6; | |
| break; | |
| #endif | |
| default: | |
| return OS_ERR_NOT_IMPLEMENTED; | |
| } | |
| switch (stream->socket_domain) | |
| { | |
| case OS_SocketDomain_INET: | |
| case OS_SocketDomain_INET6: | |
| switch (stream->socket_type) | |
| { | |
| case OS_SocketType_DATAGRAM: | |
| os_proto = IPPROTO_UDP; | |
| break; | |
| case OS_SocketType_STREAM: | |
| os_proto = IPPROTO_TCP; | |
| break; | |
| default: | |
| break; | |
| } | |
| break; | |
| default: | |
| break; | |
| } |
Specifically line 142 and 146 are legitimately dead code.
Describe the solution you'd like
Refactor to eliminate dead code
Describe alternatives you've considered
None
Additional context
Static analysis warning
Requester Info
Jacob Hageman - NASA/GSFC
Reactions are currently unavailable