Remove the ENABLED/DISABLED macros (#4515)

The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-02-04 23:47:05 +01:00
committed by GitHub
parent e01c2549d7
commit 0628ae1e7b
337 changed files with 5186 additions and 5191 deletions
+28 -30
View File
@@ -206,7 +206,7 @@ ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**<
return string_desc_p;
} /* ecma_new_ecma_string_from_magic_string_ex_id */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Allocate new ecma-string and fill it with reference to the symbol descriptor
*
@@ -243,7 +243,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */
return (!ECMA_IS_DIRECT_STRING (string_p)
&& ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL);
} /* ecma_prop_name_is_symbol */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Allocate new UTF8 ecma-string and fill it with characters from the given utf8 buffer
@@ -510,7 +510,7 @@ ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit) /**< code unit */
return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);
} /* ecma_new_ecma_string_from_code_unit */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Allocate new ecma-string and fill it with cesu-8 character which represents specified code units
@@ -528,7 +528,7 @@ ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, /**< code uni
return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);
} /* ecma_new_ecma_string_from_code_units */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Allocate new ecma-string and fill it with ecma-number
@@ -563,14 +563,14 @@ ecma_new_ecma_string_from_length (ecma_length_t number) /**< property length */
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) number);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT ((ecma_number_t) number <= ECMA_NUMBER_MAX_SAFE_INTEGER);
if (JERRY_UNLIKELY (number > UINT32_MAX))
{
return ecma_new_ecma_string_from_number ((ecma_number_t) number);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_new_non_direct_string_from_uint32 ((uint32_t) number);
} /* ecma_new_ecma_string_from_length */
@@ -951,7 +951,7 @@ ecma_destroy_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_dealloc_string_buffer (string_p, ECMA_ASCII_STRING_GET_SIZE (string_p) + ECMA_ASCII_STRING_HEADER_SIZE);
return;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_STRING_CONTAINER_SYMBOL:
{
ecma_extended_string_t *symbol_p = (ecma_extended_string_t *) string_p;
@@ -959,7 +959,7 @@ ecma_destroy_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_dealloc_extended_string (symbol_p);
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC
@@ -2553,7 +2553,7 @@ ecma_string_trim (const ecma_string_t *string_p) /**< pointer to an ecma string
return ret_string_p;
} /* ecma_string_trim */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Pad the beginning or the end of string with parameter given in fill_string to the length of max_length.
@@ -2624,16 +2624,14 @@ ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */
ecma_stringbuilder_append (&builder, filler_p);
}
lit_utf8_size_t read_size;
ecma_char_t ch;
uint32_t remaining = fill_len - (prepend_count * filler_length);
ECMA_STRING_TO_UTF8_STRING (filler_p, start_p, utf8_str_size);
const lit_utf8_byte_t *temp_start_p = start_p;
while (remaining > 0)
{
read_size = lit_read_code_unit_from_utf8 (temp_start_p, &ch);
ecma_char_t ch;
lit_utf8_size_t read_size = lit_read_code_unit_from_utf8 (temp_start_p, &ch);
ecma_stringbuilder_append_char (&builder, ch);
temp_start_p += read_size;
remaining--;
@@ -2649,7 +2647,7 @@ ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */
return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
} /* ecma_string_pad */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Create an empty string builder
@@ -2662,9 +2660,9 @@ ecma_stringbuilder_create (void)
const lit_utf8_size_t initial_size = ECMA_ASCII_STRING_HEADER_SIZE;
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
ecma_stringbuilder_t ret = {.header_p = header_p};
return ret;
@@ -2683,9 +2681,9 @@ ecma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p,
ECMA_STRINGBUILDER_STRING_PTR (header_p),
@@ -2709,9 +2707,9 @@ ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, /**< pointer to da
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
memcpy (ECMA_STRINGBUILDER_STRING_PTR (header_p), data_p, data_size);
@@ -2736,9 +2734,9 @@ ecma_stringbuilder_grow (ecma_stringbuilder_t *builder_p, /**< string builder */
header_p->current_size = new_size;
builder_p->header_p = header_p;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (required_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size;
} /* ecma_stringbuilder_grow */
@@ -2784,9 +2782,9 @@ ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, /**< string builder
const lit_utf8_size_t new_size = size + ECMA_ASCII_STRING_HEADER_SIZE;
JERRY_ASSERT (new_size <= header_p->current_size);
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (header_p->current_size - new_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
header_p = jmem_heap_realloc_block (header_p, header_p->current_size, new_size);
header_p->current_size = new_size;
@@ -2925,9 +2923,9 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde
ECMA_STRINGBUILDER_STRING_PTR (header_p),
string_size);
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (container_size - ECMA_ASCII_STRING_HEADER_SIZE);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
if (JERRY_LIKELY (string_size <= UINT16_MAX))
{
@@ -2966,12 +2964,12 @@ ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p) /**< string builder
builder_p->header_p = NULL;
#endif
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
} /* ecma_stringbuilder_destroy */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* AdvanceStringIndex operation
*
@@ -3018,7 +3016,7 @@ ecma_op_advance_string_index (ecma_string_t *str_p, /**< input string */
return next_index + 1;
} /* ecma_op_advance_string_index */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}