Skip to content

Commit

Permalink
Fixes compile error for rand() can't be overriden on Windows (benchma…
Browse files Browse the repository at this point in the history
…rking.c)

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
  • Loading branch information
lygstate committed Nov 14, 2024
1 parent 8023bf1 commit f160794
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions jerry-main/benchmark/stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand All @@ -61,3 +67,4 @@ rand (void)
{
return 4; /* Chosen by fair dice roll. Guaranteed to be random. */
} /* rand */
#endif /* !defined(_MSC_VER) */
3 changes: 1 addition & 2 deletions tools/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f160794

Please sign in to comment.