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:
@@ -18,17 +18,17 @@
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-strings.h"
|
||||
#include "lit-unicode-ranges.inc.h"
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
#include "lit-unicode-ranges-sup.inc.h"
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
#include "lit-unicode-conversions.inc.h"
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
#include "lit-unicode-conversions-sup.inc.h"
|
||||
#include "lit-unicode-folding.inc.h"
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
|
||||
#define NUM_OF_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))
|
||||
|
||||
@@ -73,9 +73,9 @@ function_name (char_type c, /**< code unit */ \
|
||||
|
||||
LIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_char_in_array, ecma_char_t, uint16_t)
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
LIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_codepoint_in_array, lit_code_point_t, uint32_t)
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Binary search algorithm that searches a character in the given intervals.
|
||||
@@ -120,9 +120,9 @@ function_name (char_type c, /**< code unit */ \
|
||||
|
||||
LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN (lit_search_char_in_interval_array, ecma_char_t, uint16_t, uint8_t)
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN (lit_search_codepoint_in_interval_array, lit_code_point_t, uint32_t, uint16_t)
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Check if specified character is one of the Whitespace characters including those that fall into
|
||||
@@ -140,10 +140,10 @@ lit_char_is_white_space (lit_code_point_t c) /**< code point */
|
||||
}
|
||||
|
||||
if (c == LIT_CHAR_BOM
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#if !JERRY_ESNEXT
|
||||
/* Mongolian Vowel Separator (u180e) used to be a whitespace character. */
|
||||
|| c == LIT_CHAR_MVS
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|| c == LIT_CHAR_LS
|
||||
|| c == LIT_CHAR_PS)
|
||||
{
|
||||
@@ -185,7 +185,7 @@ lit_char_is_line_terminator (ecma_char_t c) /**< code unit */
|
||||
static bool
|
||||
lit_char_is_unicode_id_start (lit_code_point_t code_point) /**< code unit */
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (code_point >= LIT_UTF8_4_BYTE_CODE_POINT_MIN))
|
||||
{
|
||||
return (lit_search_codepoint_in_interval_array (code_point,
|
||||
@@ -196,9 +196,9 @@ lit_char_is_unicode_id_start (lit_code_point_t code_point) /**< code unit */
|
||||
lit_unicode_id_start_chars_sup,
|
||||
NUM_OF_ELEMENTS (lit_unicode_id_start_chars_sup)));
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
JERRY_ASSERT (code_point < LIT_UTF8_4_BYTE_CODE_POINT_MIN);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_char_t c = (ecma_char_t) code_point;
|
||||
|
||||
@@ -227,7 +227,7 @@ lit_char_is_unicode_id_continue (lit_code_point_t code_point) /**< code unit */
|
||||
return true;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (code_point >= LIT_UTF8_4_BYTE_CODE_POINT_MIN))
|
||||
{
|
||||
return (lit_search_codepoint_in_interval_array (code_point,
|
||||
@@ -238,9 +238,9 @@ lit_char_is_unicode_id_continue (lit_code_point_t code_point) /**< code unit */
|
||||
lit_unicode_id_continue_chars_sup,
|
||||
NUM_OF_ELEMENTS (lit_unicode_id_continue_chars_sup)));
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
JERRY_ASSERT (code_point < LIT_UTF8_4_BYTE_CODE_POINT_MIN);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_char_t c = (ecma_char_t) code_point;
|
||||
|
||||
@@ -329,7 +329,7 @@ lit_char_is_hex_digit (ecma_char_t c) /**< code unit */
|
||||
&& LEXER_TO_ASCII_LOWERCASE (c) <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END));
|
||||
} /* lit_char_is_hex_digit */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
/**
|
||||
* Check if specified character is one of BinaryDigits characters (ECMA-262 v6, 11.8.3)
|
||||
*
|
||||
@@ -340,7 +340,7 @@ lit_char_is_binary_digit (ecma_char_t c) /** code unit */
|
||||
{
|
||||
return (c == LIT_CHAR_0 || c == LIT_CHAR_1);
|
||||
} /* lit_char_is_binary_digit */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* UnicodeEscape abstract method
|
||||
@@ -565,7 +565,7 @@ lit_char_is_word_char (lit_code_point_t c) /**< code point */
|
||||
|| c == LIT_CHAR_UNDERSCORE);
|
||||
} /* lit_char_is_word_char */
|
||||
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
|
||||
/**
|
||||
* Check if the specified character is in one of those tables which contain bidirectional conversions.
|
||||
@@ -579,14 +579,14 @@ lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code
|
||||
{
|
||||
/* 1, Check if the specified character is part of the lit_unicode_character_case_ranges_{sup} table. */
|
||||
int number_of_case_ranges;
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
bool is_supplementary = cp > LIT_UTF16_CODE_UNIT_MAX;
|
||||
if (is_supplementary)
|
||||
{
|
||||
number_of_case_ranges = NUM_OF_ELEMENTS (lit_unicode_character_case_ranges_sup);
|
||||
}
|
||||
else
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
{
|
||||
number_of_case_ranges = NUM_OF_ELEMENTS (lit_unicode_character_case_ranges);
|
||||
}
|
||||
@@ -602,14 +602,14 @@ lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code
|
||||
|
||||
size_t range_length;
|
||||
lit_code_point_t start_point;
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (is_supplementary)
|
||||
{
|
||||
range_length = lit_unicode_character_case_range_lengths_sup[conv_counter];
|
||||
start_point = lit_unicode_character_case_ranges_sup[i];
|
||||
}
|
||||
else
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
{
|
||||
range_length = lit_unicode_character_case_range_lengths[conv_counter];
|
||||
start_point = lit_unicode_character_case_ranges[i];
|
||||
@@ -641,13 +641,13 @@ lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code
|
||||
offset = i - 1;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (is_supplementary)
|
||||
{
|
||||
start_point = lit_unicode_character_case_ranges_sup[offset];
|
||||
}
|
||||
else
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
{
|
||||
start_point = lit_unicode_character_case_ranges[offset];
|
||||
}
|
||||
@@ -657,12 +657,12 @@ lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code
|
||||
|
||||
/* Note: After this point based on the latest unicode standard(13.0.0.6) no conversion characters are
|
||||
defined for supplementary planes */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (is_supplementary)
|
||||
{
|
||||
return cp;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* 2, Check if the specified character is part of the character_pair_ranges table. */
|
||||
int bottom = 0;
|
||||
@@ -784,7 +784,7 @@ lit_search_in_conversion_table (ecma_char_t character, /**< code unit
|
||||
|
||||
return (lit_code_point_t) character;
|
||||
} /* lit_search_in_conversion_table */
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
|
||||
/**
|
||||
* Append the converted lowercase codeunit sequence of an a given codepoint into the stringbuilder if it is present.
|
||||
@@ -811,7 +811,7 @@ lit_char_to_lower_case (lit_code_point_t cp, /**< code point */
|
||||
return cp;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
lit_code_point_t lowercase_cp = lit_search_in_bidirectional_conversion_tables (cp, true);
|
||||
|
||||
if (lowercase_cp != LIT_INVALID_CP)
|
||||
@@ -850,14 +850,14 @@ lit_char_to_lower_case (lit_code_point_t cp, /**< code point */
|
||||
builder_p,
|
||||
lit_unicode_lower_case_conversions,
|
||||
lit_unicode_lower_case_conversion_counters);
|
||||
#else /* !ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#else /* !JERRY_UNICODE_CASE_CONVERSION */
|
||||
if (builder_p != NULL)
|
||||
{
|
||||
ecma_stringbuilder_append_codepoint (builder_p, cp);
|
||||
}
|
||||
|
||||
return cp;
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
} /* lit_char_to_lower_case */
|
||||
|
||||
/**
|
||||
@@ -885,7 +885,7 @@ lit_char_to_upper_case (lit_code_point_t cp, /**< code point */
|
||||
return cp;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
lit_code_point_t uppercase_cp = lit_search_in_bidirectional_conversion_tables (cp, false);
|
||||
|
||||
if (uppercase_cp != LIT_INVALID_CP)
|
||||
@@ -922,17 +922,17 @@ lit_char_to_upper_case (lit_code_point_t cp, /**< code point */
|
||||
builder_p,
|
||||
lit_unicode_upper_case_conversions,
|
||||
lit_unicode_upper_case_conversion_counters);
|
||||
#else /* !ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#else /* !JERRY_UNICODE_CASE_CONVERSION */
|
||||
if (builder_p != NULL)
|
||||
{
|
||||
ecma_stringbuilder_append_codepoint (builder_p, cp);
|
||||
}
|
||||
|
||||
return cp;
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
} /* lit_char_to_upper_case */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
/*
|
||||
* Look up whether the character should be folded to the lowercase variant.
|
||||
*
|
||||
@@ -942,7 +942,7 @@ lit_char_to_upper_case (lit_code_point_t cp, /**< code point */
|
||||
bool
|
||||
lit_char_fold_to_lower (lit_code_point_t cp) /**< code point */
|
||||
{
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
return (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX
|
||||
|| cp > LIT_UTF16_CODE_UNIT_MAX
|
||||
|| (!lit_search_char_in_interval_array ((ecma_char_t) cp,
|
||||
@@ -952,9 +952,9 @@ lit_char_fold_to_lower (lit_code_point_t cp) /**< code point */
|
||||
&& !lit_search_char_in_array ((ecma_char_t) cp,
|
||||
lit_unicode_folding_skip_to_lower_chars,
|
||||
NUM_OF_ELEMENTS (lit_unicode_folding_skip_to_lower_chars))));
|
||||
#else /* !ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#else /* !JERRY_UNICODE_CASE_CONVERSION */
|
||||
return true;
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
} /* lit_char_fold_to_lower */
|
||||
|
||||
/*
|
||||
@@ -966,7 +966,7 @@ lit_char_fold_to_lower (lit_code_point_t cp) /**< code point */
|
||||
bool
|
||||
lit_char_fold_to_upper (lit_code_point_t cp) /**< code point */
|
||||
{
|
||||
#if ENABLED (JERRY_UNICODE_CASE_CONVERSION)
|
||||
#if JERRY_UNICODE_CASE_CONVERSION
|
||||
return (cp > LIT_UTF8_1_BYTE_CODE_POINT_MAX
|
||||
&& cp <= LIT_UTF16_CODE_UNIT_MAX
|
||||
&& (lit_search_char_in_interval_array ((ecma_char_t) cp,
|
||||
@@ -976,11 +976,11 @@ lit_char_fold_to_upper (lit_code_point_t cp) /**< code point */
|
||||
|| lit_search_char_in_array ((ecma_char_t) cp,
|
||||
lit_unicode_folding_to_upper_chars,
|
||||
NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_chars))));
|
||||
#else /* !ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#else /* !JERRY_UNICODE_CASE_CONVERSION */
|
||||
return false;
|
||||
#endif /* ENABLED (JERRY_UNICODE_CASE_CONVERSION) */
|
||||
#endif /* JERRY_UNICODE_CASE_CONVERSION */
|
||||
} /* lit_char_fold_to_upper */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Helper method to find a specific character in a string
|
||||
|
||||
@@ -221,9 +221,9 @@ bool lit_code_point_is_identifier_part (lit_code_point_t code_point);
|
||||
bool lit_char_is_octal_digit (ecma_char_t c);
|
||||
bool lit_char_is_decimal_digit (ecma_char_t c);
|
||||
bool lit_char_is_hex_digit (ecma_char_t c);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
bool lit_char_is_binary_digit (ecma_char_t c);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
void lit_char_unicode_escape (ecma_stringbuilder_t *builder_p, ecma_char_t c);
|
||||
uint32_t lit_char_hex_to_int (ecma_char_t c);
|
||||
size_t lit_code_point_to_cesu8_bytes (uint8_t *dst_p, lit_code_point_t code_point);
|
||||
@@ -250,9 +250,9 @@ bool lit_char_is_word_char (lit_code_point_t c);
|
||||
lit_code_point_t lit_char_to_lower_case (lit_code_point_t cp, ecma_stringbuilder_t *builder_p);
|
||||
lit_code_point_t lit_char_to_upper_case (lit_code_point_t cp, ecma_stringbuilder_t *builder_p);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
bool lit_char_fold_to_lower (lit_code_point_t cp);
|
||||
bool lit_char_fold_to_upper (lit_code_point_t cp);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#endif /* !LIT_CHAR_HELPERS_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user