Declarations have to come before executable statements

WOLFSSL_MDK5_COMPLv5: mdk5 compiler ver 5 regards macro with args as executable statement (This seems to be fixed with v6)
This commit is contained in:
Takashi Kojo 2019-02-18 06:39:06 +09:00
parent f8ff68ca7a
commit c7f8f9fc90
2 changed files with 22 additions and 4 deletions

View File

@ -18,7 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#define WOLFSSL_MDK5_COMPLv5
#define NO_MAIN_DRIVER
#define BENCH_EMBEDDED
#define NO_DEV_RANDOM

View File

@ -3989,15 +3989,32 @@ static void bench_rsa_helper(int doAsync, RsaKey rsaKey[BENCH_MAX_PENDING],
#ifndef WOLFSSL_RSA_VERIFY_ONLY
DECLARE_VAR_INIT(message, byte, len, messageStr, HEAP_HINT);
#endif
DECLARE_ARRAY_DYNAMIC(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#if !defined(WOLFSSL_MDK5_COMPLv5)
/* MDK5 compiler regard this as a executable statement, and does not allow declarations after the line. */
DECLARE_ARRAY_DYNAMIC_DEC(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#else
byte* enc[BENCH_MAX_PENDING];
int idxenc;
#endif
#if !defined(WOLFSSL_RSA_VERIFY_INLINE) && \
!defined(WOLFSSL_RSA_PUBLIC_ONLY)
DECLARE_ARRAY_DYNAMIC(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#if !defined(WOLFSSL_MDK5_COMPLv5)
/* MDK5 compiler regard this as a executable statement, and does not allow declarations after the line. */
DECLARE_ARRAY_DYNAMIC_DEC(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#else
int idxout;
byte* out[BENCH_MAX_PENDING];
#endif
#else
byte* out[BENCH_MAX_PENDING];
#endif
DECLARE_ARRAY_DYNAMIC_EXE(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#if !defined(WOLFSSL_RSA_VERIFY_INLINE) && \
!defined(WOLFSSL_RSA_PUBLIC_ONLY)
DECLARE_ARRAY_DYNAMIC_EXE(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT);
#endif
if (!rsa_sign_verify) {
#ifndef WOLFSSL_RSA_VERIFY_ONLY
/* begin public RSA */