Skip to content

Commit 77a802a

Browse files
committed
Fixes compile error for rand() can't be overriden on Windows (benchmarking.c)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
1 parent 3fdc080 commit 77a802a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

jerry-main/benchmark/stubs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ gettimeofday (struct timeval *tv, void *tz)
5050
} /* gettimeofday */
5151
#endif /* __GNUC__ */
5252

53+
/*
54+
* Even though rand can't be overriden on MSVC but we still can override
55+
* it with gcc/mingw. So we just disable the override with MSVC and get
56+
* it to be compiled
57+
*/
58+
#if !defined(_MSC_VER)
5359
int rand (void);
5460

5561
/**
@@ -61,3 +67,4 @@ rand (void)
6167
{
6268
return 4; /* Chosen by fair dice roll. Guaranteed to be random. */
6369
} /* rand */
70+
#endif /* !defined(_MSC_VER) */

tools/run-tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ def skip_if(condition, desc):
125125
['--shared-libs=on'],
126126
skip=skip_if((sys.platform == 'win32'), 'Not yet supported, link failure on Windows')),
127127
Options('buildoption_test-cmdline_test',
128-
['--jerry-cmdline-test=on'],
129-
skip=skip_if((sys.platform == 'win32'), 'rand() can\'t be overriden on Windows (benchmarking.c)')),
128+
['--jerry-cmdline-test=on']),
130129
Options('buildoption_test-cmdline_snapshot',
131130
['--jerry-cmdline-snapshot=on']),
132131
Options('buildoption_test-recursion_limit',

0 commit comments

Comments
 (0)