mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 14:15:37 +00:00
Fix gcc-7 -Wformat-truncation warning
Function test_snprintf() is called by run_test_snprintf() with constant test data. It gets inlined and is subjected to snprintf format truncation checks introduced by -Wformat-truncation in gcc-7. -Wformat-truncation is turned On by -Wall and other similar options. It results in error with -Werror. -Wformat-truncation makes tests performed by run_test_snprintf() redundant on gcc. But they are still relevant for other compilers. This commit prevents inlining of test_snprintf() to avoid gcc compile time checks.
This commit is contained in:
parent
1ec7e6f3d9
commit
76135345c8
|
@ -339,6 +339,8 @@ static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
|
|||
char buf[10] = "xxxxxxxxx";
|
||||
const char ref[10] = "xxxxxxxxx";
|
||||
|
||||
if( n >= sizeof( buf ) )
|
||||
return( -1 );
|
||||
ret = mbedtls_snprintf( buf, n, "%s", "123" );
|
||||
if( ret < 0 || (size_t) ret >= n )
|
||||
ret = -1;
|
||||
|
|
Loading…
Reference in a new issue