Fix warnings about unreachable code

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2023-09-05 16:20:33 +01:00
parent 0364c8a773
commit cfa722324c
2 changed files with 4 additions and 2 deletions

View file

@ -99,6 +99,7 @@ static mbedtls_mpi_uint mpi_bigendian_to_host(mbedtls_mpi_uint a)
/* Nothing to do on bigendian systems. */ /* Nothing to do on bigendian systems. */
return a; return a;
} else { } else {
MBEDTLS_IGNORE_UNREACHABLE_BEGIN
switch (sizeof(mbedtls_mpi_uint)) { switch (sizeof(mbedtls_mpi_uint)) {
case 4: case 4:
return (mbedtls_mpi_uint) MBEDTLS_BSWAP32((uint32_t) a); return (mbedtls_mpi_uint) MBEDTLS_BSWAP32((uint32_t) a);
@ -109,6 +110,7 @@ static mbedtls_mpi_uint mpi_bigendian_to_host(mbedtls_mpi_uint a)
/* Fall back to C-based reordering if we don't know the byte order /* Fall back to C-based reordering if we don't know the byte order
* or we couldn't use a compiler-specific builtin. */ * or we couldn't use a compiler-specific builtin. */
return mpi_bigendian_to_host_c(a); return mpi_bigendian_to_host_c(a);
MBEDTLS_IGNORE_UNREACHABLE_END
} }
} }

View file

@ -2754,8 +2754,8 @@ static int x509_inet_pton_ipv6(const char *src, void *dst)
p++; p++;
} }
if (num_digits != 0) { if (num_digits != 0) {
addr[nonzero_groups++] = MBEDTLS_IS_BIG_ENDIAN ? group : MBEDTLS_PUT_UINT16_BE(group, addr, nonzero_groups);
(group << 8) | (group >> 8); nonzero_groups++;
if (*p == '\0') { if (*p == '\0') {
break; break;
} else if (*p == '.') { } else if (*p == '.') {