mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-11-05 08:10:38 +03:00
Treat warnings as errors for IAR
Fix IAR compiler warnings Two warnings have been fixed: 1. code 'if( len <= 0xFFFFFFFF )' gave warning 'pointless integer comparison'. This was fixed by wraping the condition in '#if SIZE_MAX > 0xFFFFFFFF'. 2. code 'diff |= A[i] ^ B[i];' gave warning 'the order of volatile accesses is undefined in'. This was fixed by read the volatile data in temporary variables before the computation. Explain IAR warning on volatile access Consistent use of CMAKE_C_COMPILER_ID
This commit is contained in:
committed by
Mohammad Azim Khan
parent
c4bd8ec5ed
commit
45b79cf12b
@@ -630,7 +630,13 @@ static inline int mbedtls_ssl_safer_memcmp( const void *a, const void *b, size_t
|
||||
volatile unsigned char diff = 0;
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
diff |= A[i] ^ B[i];
|
||||
{
|
||||
/* Read volatile data in order before computing diff.
|
||||
* This avoids IAR compiler warning:
|
||||
* 'the order of volatile accesses is undefined ..' */
|
||||
unsigned char x = A[i], y = B[i];
|
||||
diff |= x ^ y;
|
||||
}
|
||||
|
||||
return( diff );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user