Use jerry_is_feature_enabled function instead of macros where possible (#2271)

JerryScript-DCO-1.0-Signed-off-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
This commit is contained in:
tdusnoki 2018-04-09 08:26:36 +02:00 committed by Zoltan Herczeg
parent 8392eef8ad
commit cb40106693
2 changed files with 47 additions and 55 deletions

View File

@ -223,7 +223,6 @@ register_js_function (const char *name_p, /**< name of the function */
jerry_release_value (result_val); jerry_release_value (result_val);
} /* register_js_function */ } /* register_js_function */
#ifdef JERRY_DEBUGGER
/** /**
* Runs the source code received by jerry_debugger_wait_for_client_source. * Runs the source code received by jerry_debugger_wait_for_client_source.
@ -253,7 +252,6 @@ wait_for_source_callback (const jerry_char_t *resource_name_p, /**< resource nam
return ret_val; return ret_val;
} /* wait_for_source_callback */ } /* wait_for_source_callback */
#endif /* JERRY_DEBUGGER */
/** /**
* Command line option IDs * Command line option IDs
@ -625,8 +623,9 @@ main (int argc,
if (is_wait_mode) if (is_wait_mode)
{ {
is_repl_mode = false; is_repl_mode = false;
#ifdef JERRY_DEBUGGER
if (jerry_is_feature_enabled (JERRY_FEATURE_DEBUGGER))
{
while (true) while (true)
{ {
jerry_debugger_wait_for_source_status_t receive_status; jerry_debugger_wait_for_source_status_t receive_status;
@ -670,8 +669,8 @@ main (int argc,
ret_value = jerry_create_undefined (); ret_value = jerry_create_undefined ();
} }
}
#endif /* JERRY_DEBUGGER */
} }
if (is_repl_mode) if (is_repl_mode)

View File

@ -16,16 +16,19 @@
#include "jerryscript.h" #include "jerryscript.h"
#include "test-common.h" #include "test-common.h"
#ifdef JMEM_STATS
int main (void)
{
if (!jerry_is_feature_enabled (JERRY_FEATURE_MEM_STATS))
{
return 0;
}
const char *test_source = ( const char *test_source = (
"var a = 'hello';" "var a = 'hello';"
"var b = 'world';" "var b = 'world';"
"var c = a + ' ' + b;" "var c = a + ' ' + b;"
); );
int main (void)
{
jerry_init (JERRY_INIT_EMPTY); jerry_init (JERRY_INIT_EMPTY);
jerry_value_t parsed_code_val = jerry_parse ((jerry_char_t *) test_source, strlen (test_source), false); jerry_value_t parsed_code_val = jerry_parse ((jerry_char_t *) test_source, strlen (test_source), false);
TEST_ASSERT (!jerry_value_has_error_flag (parsed_code_val)); TEST_ASSERT (!jerry_value_has_error_flag (parsed_code_val));
@ -49,13 +52,3 @@ int main (void)
return 0; return 0;
} /* main */ } /* main */
#else /* JMEM_STATS */
int
main (void)
{
return 0;
} /* main */
#endif /* !JMEM_STATS */