-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
Description
Summary
Observing the following build warning while compiling with IAR toolchain:
mbedtls_ssl_handshake_set_state(ssl, ssl->state + 1);
^
"<>\mbedtls\library\ssl_misc.h",1361 Warning[Pe188]: enumerated type mixed with another type
System information
Mbed TLS version (number or commit id): Mbed-TLS v3.6.5
Operating system and version: Windows OS
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): IAR toolchain v9.70.1
Expected behavior
Build passes without any warnings.
Actual behavior
Observing Warning [Pe188]: enumerated type mixed with another type
Additional information
static inline void mbedtls_ssl_handshake_set_state(mbedtls_ssl_context *ssl,
mbedtls_ssl_states state)
{
MBEDTLS_SSL_DEBUG_MSG(3, ("handshake state: %d (%s) -> %d (%s)",
ssl->state, mbedtls_ssl_states_str(_(mbedtls_ssl_states)_ ssl->state),
(int) state, mbedtls_ssl_states_str(state)));
ssl->state = (int) state;
}
static inline void mbedtls_ssl_handshake_increment_state(mbedtls_ssl_context *ssl)
{
mbedtls_ssl_handshake_set_state(ssl, _(mbedtls_ssl_states)_ (ssl->state + 1));
}
-> ssl->state is stored as int in the context. But, mbedtls_ssl_handshake_set_state() expects mbedtls_ssl_states parameter.
-> Since IAR is warning about passing an enum parameter as an integer expression without an explicit cast, casting ssl->state to (mbedtls_ssl_states) would fix the issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming