Skip to content

Warning fixes. #938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
/* FIXME: "We currently have to re-compile the bytecode, because
* we can't copy it without knowing its length."
*/
re_compiled_code_t *new_bc_p = NULL;
const re_compiled_code_t *new_bc_p = NULL;
ecma_value_t bc_comp = re_compile_bytecode (&new_bc_p, pattern_string_p, flags);
/* Should always succeed, since we're compiling from a source that has been compiled previously. */
JERRY_ASSERT (ecma_is_value_empty (bc_comp));
Expand Down Expand Up @@ -201,7 +201,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
ecma_property_t *bc_prop_p = ecma_get_internal_property (this_obj_p,
ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
/* Try to compile bytecode from new source. */
re_compiled_code_t *new_bc_p = NULL;
const re_compiled_code_t *new_bc_p = NULL;
ECMA_TRY_CATCH (bc_dummy,
re_compile_bytecode (&new_bc_p, pattern_string_p, flags),
ret_value);
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-regexp-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ ecma_op_create_regexp_object (ecma_string_t *pattern_p, /**< input pattern */
bytecode_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);

/* Compile bytecode. */
re_compiled_code_t *bc_p = NULL;
const re_compiled_code_t *bc_p = NULL;
ECMA_TRY_CATCH (empty, re_compile_bytecode (&bc_p, pattern_p, flags), ret_value);

ECMA_SET_POINTER (bytecode_prop_p->v.internal_property.value, bc_p);
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/jerry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
{
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
re_compiled_code_t *re_bytecode_p = NULL;
const re_compiled_code_t *re_bytecode_p = NULL;

const uint8_t *regex_start_p = ((const uint8_t *) bytecode_p) + sizeof (uint16_t);

Expand Down
2 changes: 1 addition & 1 deletion jerry-core/lit/lit-literal.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ lit_find_literal_by_utf8_string (const lit_utf8_byte_t *str_p, /**< a string to
continue;
}

if (!strncmp (rec_p + 1, (const char *) str_p, str_size))
if (!strncmp ((const char *) (rec_p + 1), (const char *) str_p, str_size))
{
return lit;
}
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/mem/mem-heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void *mem_heap_alloc_block_internal (const size_t size)
}
else
{
JERRY_ASSERT (MEM_HEAP_GET_ADDR_FROM_OFFSET (mem_heap.first.next_offset)->size > MEM_ALIGNMENT);
JERRY_ASSERT (data_space_p->size > MEM_ALIGNMENT);
mem_heap_free_t *const remaining_p = MEM_HEAP_GET_ADDR_FROM_OFFSET (mem_heap.first.next_offset) + 1;

VALGRIND_DEFINED_SPACE (remaining_p, sizeof (mem_heap_free_t));
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/mem/mem-poolman.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
/**
* Node for free chunk list
*/
typedef struct
typedef struct mem_pools_chunk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. However, there are some more recursive structs in the code base, which solve the the issue inconsitently, sometimes even incorrectly. Could you please open an issue or a follow-up PR to have a uniform solution for all recursive structs out there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I would prefer a naming like mem_pools_chunk_forward_t in general

{
struct mem_pools_chunk_t *next_p; /* pointer to next pool chunk */
struct mem_pools_chunk *next_p; /* pointer to next pool chunk */
#ifndef MEM_HEAP_PTR_64
uint32_t dummy; /* dummy member for alignment */
#endif
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/parser/js/js-lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
context_p->literal_count++;

/* Compile the RegExp literal and store the RegExp bytecode pointer */
re_compiled_code_t *re_bytecode_p = NULL;
const re_compiled_code_t *re_bytecode_p = NULL;
ecma_value_t completion_value;

ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length);
Expand Down
20 changes: 10 additions & 10 deletions jerry-core/parser/regexp/re-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
*/
static void
re_append_char_class (void *re_ctx_p, /**< RegExp compiler context */
ecma_char_t start, /**< character class range from */
ecma_char_t end) /**< character class range to */
uint32_t start, /**< character class range from */
uint32_t end) /**< character class range to */
{
re_compiler_ctx_t *ctx_p = (re_compiler_ctx_t *) re_ctx_p;
re_append_char (ctx_p->bytecode_ctx_p, start);
re_append_char (ctx_p->bytecode_ctx_p, end);
re_append_char (ctx_p->bytecode_ctx_p, (ecma_char_t) start);
re_append_char (ctx_p->bytecode_ctx_p, (ecma_char_t) end);
ctx_p->parser_ctx_p->num_of_classes++;
} /* re_append_char_class */

Expand Down Expand Up @@ -452,7 +452,7 @@ static const re_compiled_code_t *re_cache[RE_CACHE_SIZE];
* @return compiled bytecode - if found
* NULL - otherwise
*/
re_compiled_code_t *
const re_compiled_code_t *
re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
uint16_t flags, /**< flags */
uint32_t *idx) /**< [out] index */
Expand All @@ -461,7 +461,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */

for (*idx = 0u; *idx < RE_CACHE_SIZE; (*idx)++)
{
re_compiled_code_t *cached_bytecode_p = re_cache[*idx];
const re_compiled_code_t *cached_bytecode_p = re_cache[*idx];

if (cached_bytecode_p != NULL)
{
Expand Down Expand Up @@ -495,13 +495,13 @@ re_cache_gc_run ()
{
for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++)
{
re_compiled_code_t *cached_bytecode_p = re_cache[i];
const re_compiled_code_t *cached_bytecode_p = re_cache[i];

if (cached_bytecode_p != NULL
&& (cached_bytecode_p->flags >> ECMA_BYTECODE_REF_SHIFT) == 1)
{ /* Only the cache has reference for the bytecode */

ecma_bytecode_deref (cached_bytecode_p);
ecma_bytecode_deref ((ecma_compiled_code_t *) cached_bytecode_p);
re_cache[i] = NULL;
}
}
Expand All @@ -516,7 +516,7 @@ re_cache_gc_run ()
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
re_compile_bytecode (re_compiled_code_t **out_bytecode_p, /**< [out] pointer to bytecode */
re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] pointer to bytecode */
ecma_string_t *pattern_str_p, /**< pattern */
uint16_t flags) /**< flags */
{
Expand Down Expand Up @@ -604,7 +604,7 @@ re_compile_bytecode (re_compiled_code_t **out_bytecode_p, /**< [out] pointer to

if (cache_idx < RE_CACHE_SIZE)
{
ecma_bytecode_ref (*out_bytecode_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) *out_bytecode_p);
re_cache[cache_idx] = *out_bytecode_p;
}
else
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/parser/regexp/re-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ typedef struct
} re_compiler_ctx_t;

ecma_value_t
re_compile_bytecode (re_compiled_code_t **, ecma_string_t *, uint16_t);
re_compile_bytecode (const re_compiled_code_t **, ecma_string_t *, uint16_t);

re_compiled_code_t *
const re_compiled_code_t *
re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, uint16_t flags, uint32_t *idx);

void re_cache_gc_run ();
Expand Down