Remove abort-on-fail from the default port (#3182)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
committed by
Robert Fancsik
parent
6a848a36fd
commit
2180d979b7
@@ -18,59 +18,17 @@
|
||||
#include "jerryscript-port.h"
|
||||
#include "jerryscript-port-default.h"
|
||||
|
||||
#ifndef DISABLE_EXTRA_API
|
||||
|
||||
static bool abort_on_fail = false;
|
||||
|
||||
/**
|
||||
* Sets whether 'abort' should be called instead of 'exit' upon exiting with
|
||||
* non-zero exit code in the default implementation of jerry_port_fatal.
|
||||
*
|
||||
* Note:
|
||||
* This function is only available if the port implementation library is
|
||||
* compiled without the DISABLE_EXTRA_API macro.
|
||||
*/
|
||||
void jerry_port_default_set_abort_on_fail (bool flag) /**< new value of 'abort on fail' flag */
|
||||
{
|
||||
abort_on_fail = flag;
|
||||
} /* jerry_port_default_set_abort_on_fail */
|
||||
|
||||
/**
|
||||
* Check whether 'abort' should be called instead of 'exit' upon exiting with
|
||||
* non-zero exit code in the default implementation of jerry_port_fatal.
|
||||
*
|
||||
* @return true - if 'abort on fail' flag is set,
|
||||
* false - otherwise
|
||||
*
|
||||
* Note:
|
||||
* This function is only available if the port implementation library is
|
||||
* compiled without the DISABLE_EXTRA_API macro.
|
||||
*/
|
||||
bool jerry_port_default_is_abort_on_fail (void)
|
||||
{
|
||||
return abort_on_fail;
|
||||
} /* jerry_port_default_is_abort_on_fail */
|
||||
|
||||
#endif /* !DISABLE_EXTRA_API */
|
||||
|
||||
/**
|
||||
* Default implementation of jerry_port_fatal. Calls 'abort' if exit code is
|
||||
* non-zero and "abort-on-fail" behaviour is enabled, 'exit' otherwise.
|
||||
*
|
||||
* Note:
|
||||
* The "abort-on-fail" behaviour is only available if the port
|
||||
* implementation library is compiled without the DISABLE_EXTRA_API macro.
|
||||
* non-zero, 'exit' otherwise.
|
||||
*/
|
||||
void jerry_port_fatal (jerry_fatal_code_t code) /**< cause of error */
|
||||
{
|
||||
#ifndef DISABLE_EXTRA_API
|
||||
if (code != 0
|
||||
&& code != ERR_OUT_OF_MEMORY
|
||||
&& abort_on_fail)
|
||||
&& code != ERR_OUT_OF_MEMORY)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
#endif /* !DISABLE_EXTRA_API */
|
||||
|
||||
exit ((int) code);
|
||||
} /* jerry_port_fatal */
|
||||
|
||||
@@ -31,9 +31,6 @@ extern "C"
|
||||
* @{
|
||||
*/
|
||||
|
||||
void jerry_port_default_set_abort_on_fail (bool flag);
|
||||
bool jerry_port_default_is_abort_on_fail (void);
|
||||
|
||||
jerry_log_level_t jerry_port_default_get_log_level (void);
|
||||
void jerry_port_default_set_log_level (jerry_log_level_t level);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user