mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 05:35:28 +00:00
benchmark: Fix incompatibility with C89 compilers
Initializing arrays using non-constant expressions is not permitted in C89, and was causing errors when compiling with Metrowerks CodeWarrior (for classic MacOS) in C89 mode. Clang also produces a warning when compiling with '-Wc99-extensions': test/benchmark.c:670:42: warning: initializer for aggregate is not a compile-time constant [-Wc99-extensions] const unsigned char *dhm_P[] = { dhm_P_2048, dhm_P_3072 }; ^~~~~~~~~~ test/benchmark.c:674:42: warning: initializer for aggregate is not a compile-time constant [-Wc99-extensions] const unsigned char *dhm_G[] = { dhm_G_2048, dhm_G_3072 }; ^~~~~~~~~~ Declaring the arrays as 'static' makes them constant expressions. fixes #1353
This commit is contained in:
parent
1bf6123fca
commit
e61514d70d
|
@ -658,13 +658,13 @@ int main( int argc, char *argv[] )
|
|||
if( todo.dhm )
|
||||
{
|
||||
int dhm_sizes[] = { 2048, 3072 };
|
||||
const unsigned char dhm_P_2048[] =
|
||||
static const unsigned char dhm_P_2048[] =
|
||||
MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN;
|
||||
const unsigned char dhm_P_3072[] =
|
||||
static const unsigned char dhm_P_3072[] =
|
||||
MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN;
|
||||
const unsigned char dhm_G_2048[] =
|
||||
static const unsigned char dhm_G_2048[] =
|
||||
MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN;
|
||||
const unsigned char dhm_G_3072[] =
|
||||
static const unsigned char dhm_G_3072[] =
|
||||
MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN;
|
||||
|
||||
const unsigned char *dhm_P[] = { dhm_P_2048, dhm_P_3072 };
|
||||
|
|
Loading…
Reference in a new issue