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:
@@ -57,7 +57,7 @@ typedef enum
|
||||
* after the last byte code */
|
||||
PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 11), /**< pending (unsent) breakpoint
|
||||
* info is available */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
PARSER_LEXICAL_BLOCK_NEEDED = (1u << 12), /**< global script: needs a lexical environment for let and const
|
||||
* function: needs a lexical environment for arguments */
|
||||
PARSER_IS_ARROW_FUNCTION = (1u << 13), /**< an arrow function is parsed */
|
||||
@@ -76,11 +76,11 @@ typedef enum
|
||||
PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */
|
||||
PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */
|
||||
PARSER_IS_METHOD = (1u << 25), /**< method is parsed */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 26), /**< parsing a function or class default export */
|
||||
PARSER_MODULE_STORE_IDENT = (1u << 27), /**< store identifier of the current export statement */
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction
|
||||
* is postponed after the local parser data is freed */
|
||||
#ifndef JERRY_NDEBUG
|
||||
@@ -125,13 +125,13 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
PARSER_CHECK_BLOCK_CONTEXT, /**< check block context */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
PARSER_CHECK_GLOBAL_CONTEXT, /**< check global context */
|
||||
PARSER_CHECK_FUNCTION_CONTEXT, /**< check function context */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} parser_check_context_type_t;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Class field bits.
|
||||
@@ -144,7 +144,7 @@ typedef enum
|
||||
PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */
|
||||
} parser_class_field_type_t;
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Mask for strict mode code
|
||||
@@ -168,7 +168,7 @@ typedef enum
|
||||
#define PARSER_MAX_BRANCH_LENGTH 3
|
||||
#endif /* PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
/**
|
||||
* Offset of PARSER_ALLOW_SUPER
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ typedef enum
|
||||
#define PARSER_IS_NORMAL_ASYNC_FUNCTION(status_flags) \
|
||||
(((status_flags) & (PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION)) == PARSER_IS_ASYNC_FUNCTION)
|
||||
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* All flags that affect exotic arguments object creation.
|
||||
@@ -231,7 +231,7 @@ typedef enum
|
||||
#define PARSER_ARGUMENTS_RELATED_FLAGS \
|
||||
(PARSER_ARGUMENTS_NEEDED | PARSER_IS_STRICT)
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Checks whether unmapped arguments are needed. */
|
||||
#define PARSER_NEEDS_MAPPED_ARGUMENTS(status_flags) \
|
||||
@@ -419,7 +419,7 @@ typedef struct
|
||||
*/
|
||||
#define PARSER_SCOPE_STACK_FUNC 0xffff
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Mask for decoding the register index of map_to
|
||||
@@ -442,7 +442,7 @@ typedef struct
|
||||
*/
|
||||
#define PARSER_SCOPE_STACK_IS_LOCAL_CREATED (PARSER_SCOPE_STACK_IS_CONST_REG)
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Starting literal index for registers.
|
||||
@@ -473,7 +473,7 @@ typedef struct
|
||||
struct scanner_context_t;
|
||||
typedef struct scanner_context_t scanner_context_t;
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
/**
|
||||
* Extra information for each breakpoint.
|
||||
*/
|
||||
@@ -488,7 +488,7 @@ typedef struct
|
||||
#define PARSER_MAX_BREAKPOINT_INFO_COUNT \
|
||||
(JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))
|
||||
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
/**
|
||||
* Those members of a context which needs
|
||||
@@ -505,9 +505,9 @@ typedef struct parser_saved_context_t
|
||||
|
||||
/* Literal types */
|
||||
uint16_t argument_count; /**< number of function arguments */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t argument_length; /**< length property of arguments */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
uint16_t register_count; /**< number of registers */
|
||||
uint16_t literal_count; /**< number of literals */
|
||||
|
||||
@@ -519,10 +519,10 @@ typedef struct parser_saved_context_t
|
||||
uint16_t scope_stack_size; /**< size of scope stack */
|
||||
uint16_t scope_stack_top; /**< preserved top of scope stack */
|
||||
uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t scope_stack_global_end; /**< end of global declarations of a function */
|
||||
ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
uint16_t context_stack_depth; /**< current context stack depth */
|
||||
@@ -553,10 +553,10 @@ typedef struct
|
||||
parser_saved_context_t *last_context_p; /**< last saved context */
|
||||
parser_stack_iterator_t last_statement; /**< last statement position */
|
||||
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
ecma_module_node_t *module_current_node_p; /**< import / export node that is being processed */
|
||||
lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
/* Lexer members. */
|
||||
lexer_token_t token; /**< current token */
|
||||
@@ -578,9 +578,9 @@ typedef struct
|
||||
|
||||
/* Literal types */
|
||||
uint16_t argument_count; /**< number of function arguments */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t argument_length; /**< length property of arguments */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
uint16_t register_count; /**< number of registers */
|
||||
uint16_t literal_count; /**< number of literals */
|
||||
|
||||
@@ -594,10 +594,10 @@ typedef struct
|
||||
uint16_t scope_stack_size; /**< size of scope stack */
|
||||
uint16_t scope_stack_top; /**< current top of scope stack */
|
||||
uint16_t scope_stack_reg_top; /**< current top register of scope stack */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t scope_stack_global_end; /**< end of global declarations of a function */
|
||||
ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
uint8_t stack_top_uint8; /**< top byte stored on the stack */
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
@@ -605,24 +605,24 @@ typedef struct
|
||||
uint16_t context_stack_depth; /**< current context stack depth */
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||
int is_show_opcodes; /**< show opcodes */
|
||||
uint32_t total_byte_code_size; /**< total byte code size */
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
|
||||
uint16_t breakpoint_info_count; /**< current breakpoint index */
|
||||
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#if ENABLED (JERRY_RESOURCE_NAME)
|
||||
#if JERRY_RESOURCE_NAME
|
||||
ecma_value_t resource_name; /**< resource name */
|
||||
#endif /* ENABLED (JERRY_RESOURCE_NAME) */
|
||||
#endif /* JERRY_RESOURCE_NAME */
|
||||
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if JERRY_LINE_INFO
|
||||
parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
} parser_context_t;
|
||||
|
||||
/**
|
||||
@@ -728,9 +728,9 @@ void parser_set_continues_to_current_position (parser_context_t *context_p, pars
|
||||
#define parser_emit_cbc_ext_backward_branch(context_p, opcode, offset) \
|
||||
parser_emit_cbc_backward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (offset))
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
void parser_reverse_class_fields (parser_context_t *context_p, size_t fields_size);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -747,7 +747,7 @@ bool lexer_check_next_characters (parser_context_t *context_p, lit_utf8_byte_t c
|
||||
lit_utf8_byte_t character2);
|
||||
uint8_t lexer_consume_next_character (parser_context_t *context_p);
|
||||
bool lexer_check_post_primary_exp (parser_context_t *context_p);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
void lexer_skip_empty_statements (parser_context_t *context_p);
|
||||
bool lexer_check_arrow (parser_context_t *context_p);
|
||||
bool lexer_check_arrow_param (parser_context_t *context_p);
|
||||
@@ -755,7 +755,7 @@ bool lexer_check_yield_no_arg (parser_context_t *context_p);
|
||||
bool lexer_consume_generator (parser_context_t *context_p);
|
||||
bool lexer_consume_assign (parser_context_t *context_p);
|
||||
void lexer_update_await_yield (parser_context_t *context_p, uint32_t status_flags);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
void lexer_parse_string (parser_context_t *context_p, lexer_string_options_t opts);
|
||||
void lexer_expect_identifier (parser_context_t *context_p, uint8_t literal_type);
|
||||
bool lexer_scan_identifier (parser_context_t *context_p);
|
||||
@@ -778,12 +778,12 @@ bool lexer_compare_identifiers (parser_context_t *context_p, const lexer_lit_loc
|
||||
bool lexer_current_is_literal (parser_context_t *context_p, const lexer_lit_location_t *right_ident_p);
|
||||
bool lexer_string_is_use_strict (parser_context_t *context_p);
|
||||
bool lexer_string_is_directive (parser_context_t *context_p);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
bool lexer_token_is_identifier (parser_context_t *context_p, const char *identifier_p,
|
||||
size_t identifier_length);
|
||||
bool lexer_token_is_let (parser_context_t *context_p);
|
||||
bool lexer_token_is_async (parser_context_t *context_p);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
bool lexer_compare_literal_to_string (parser_context_t *context_p, const char *string_p, size_t string_length);
|
||||
uint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token);
|
||||
|
||||
@@ -799,11 +799,11 @@ uint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token);
|
||||
void parser_parse_block_expression (parser_context_t *context_p, int options);
|
||||
void parser_parse_expression_statement (parser_context_t *context_p, int options);
|
||||
void parser_parse_expression (parser_context_t *context_p, int options);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
void parser_parse_class (parser_context_t *context_p, bool is_statement);
|
||||
void parser_parse_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
|
||||
void parser_parse_initializer_by_next_char (parser_context_t *context_p, parser_pattern_flags_t flags);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -822,21 +822,21 @@ void scanner_reverse_info_list (parser_context_t *context_p);
|
||||
void scanner_cleanup (parser_context_t *context_p);
|
||||
|
||||
bool scanner_is_context_needed (parser_context_t *context_p, parser_check_context_type_t check_type);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
bool scanner_try_scan_new_target (parser_context_t *context_p);
|
||||
void scanner_check_variables (parser_context_t *context_p);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
void scanner_create_variables (parser_context_t *context_p, uint32_t option_flags);
|
||||
|
||||
void scanner_get_location (scanner_location_t *location_p, parser_context_t *context_p);
|
||||
void scanner_set_location (parser_context_t *context_p, scanner_location_t *location_p);
|
||||
uint16_t scanner_decode_map_to (parser_scope_stack_t *stack_item_p);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
uint16_t scanner_save_literal (parser_context_t *context_p, uint16_t ident_index);
|
||||
bool scanner_literal_is_const_reg (parser_context_t *context_p, uint16_t literal_index);
|
||||
bool scanner_literal_is_created (parser_context_t *context_p, uint16_t literal_index);
|
||||
bool scanner_literal_exists (parser_context_t *context_p, uint16_t literal_index);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
void scanner_scan_all (parser_context_t *context_p, const uint8_t *arg_list_p, const uint8_t *arg_list_end_p,
|
||||
const uint8_t *source_p, const uint8_t *source_end_p);
|
||||
@@ -851,7 +851,7 @@ void scanner_scan_all (parser_context_t *context_p, const uint8_t *arg_list_p, c
|
||||
void parser_parse_statements (parser_context_t *context_p);
|
||||
void parser_free_jumps (parser_stack_iterator_t iterator);
|
||||
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
@@ -877,7 +877,7 @@ void parser_module_add_names_to_node (parser_context_t *context_p,
|
||||
ecma_string_t *imex_name_p,
|
||||
ecma_string_t *local_name_p);
|
||||
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -887,7 +887,7 @@ void parser_module_add_names_to_node (parser_context_t *context_p,
|
||||
*/
|
||||
|
||||
ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32_t status_flags);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);
|
||||
ecma_compiled_code_t *parser_parse_class_fields (parser_context_t *context_p);
|
||||
void parser_set_function_name (parser_context_t *context_p, uint16_t function_literal_index, uint16_t name_index,
|
||||
@@ -895,7 +895,7 @@ void parser_set_function_name (parser_context_t *context_p, uint16_t function_li
|
||||
void parser_compiled_code_set_function_name (parser_context_t *context_p, ecma_compiled_code_t *bytecode_p,
|
||||
uint16_t name_index, uint32_t status_flags);
|
||||
uint16_t parser_check_anonymous_function_declaration (parser_context_t *context_p);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Error management. */
|
||||
|
||||
@@ -903,21 +903,21 @@ void parser_raise_error (parser_context_t *context_p, parser_error_t error);
|
||||
|
||||
/* Debug functions. */
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
|
||||
void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_header_type_t type, uint32_t value);
|
||||
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if JERRY_LINE_INFO
|
||||
|
||||
void parser_emit_line_info (parser_context_t *context_p, uint32_t line, bool flush_cbc);
|
||||
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
#if JERRY_PARSER_DUMP_BYTE_CODE
|
||||
void util_print_cbc (ecma_compiled_code_t *compiled_code_p);
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user