From f1607945a385733f208c61a863a9d6878087681f Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Mon, 18 Jan 2021 20:34:44 +0800 Subject: [PATCH] Fixes compile error for rand() can't be overriden on Windows (benchmarking.c) JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com --- jerry-main/benchmark/stubs.c | 7 +++++++ tools/run-tests.py | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jerry-main/benchmark/stubs.c b/jerry-main/benchmark/stubs.c index 0040d86a57..3eac5159df 100644 --- a/jerry-main/benchmark/stubs.c +++ b/jerry-main/benchmark/stubs.c @@ -50,6 +50,12 @@ gettimeofday (struct timeval *tv, void *tz) } /* gettimeofday */ #endif /* __GNUC__ */ +/* + * Even though rand can't be overriden on MSVC but we still can override + * it with gcc/mingw. So we just disable the override with MSVC and get + * it to be compiled + */ +#if !defined(_MSC_VER) int rand (void); /** @@ -61,3 +67,4 @@ rand (void) { return 4; /* Chosen by fair dice roll. Guaranteed to be random. */ } /* rand */ +#endif /* !defined(_MSC_VER) */ diff --git a/tools/run-tests.py b/tools/run-tests.py index 64bc1ed827..7111c53d19 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -125,8 +125,7 @@ def skip_if(condition, desc): ['--shared-libs=on'], skip=skip_if((sys.platform == 'win32'), 'Not yet supported, link failure on Windows')), Options('buildoption_test-cmdline_test', - ['--jerry-cmdline-test=on'], - skip=skip_if((sys.platform == 'win32'), 'rand() can\'t be overriden on Windows (benchmarking.c)')), + ['--jerry-cmdline-test=on']), Options('buildoption_test-cmdline_snapshot', ['--jerry-cmdline-snapshot=on']), Options('buildoption_test-recursion_limit',