-
Notifications
You must be signed in to change notification settings - Fork 677
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
Warning fixes. #938
Warning fixes. #938
Conversation
0171aef
to
50d3aa8
Compare
#ifndef MEM_HEAP_PTR_64 | ||
uint32_t dummy; /* dummy member for alignment */ | ||
#endif | ||
} mem_pools_chunk_t; | ||
} mem_pool_chunk; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rewrite doesn't seem to be equivalent to the original version. This code defines a struct mem_pool_chunk
-- and then also defines a variable named mem_pool_chunk
of type struct mem_pool_chunk
. This global variable is certainly not what we want.
BTW, why do we need this rewrite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. I changed this with another solution.
This modification fixed the following warnings:
150:22: assignment from incompatible pointer type : mem_free_chunk_p = chunk_p->next_p;
173:27: assignment from incompatible pointer type : chunk_to_free_p->next_p = mem_free_chunk_p;
190:39: initialization from incompatible pointer type : mem_pools_chunk_t *const next_p = mem_free_chunk_p->next_p;
50d3aa8
to
cfdeeb9
Compare
@@ -472,7 +472,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */ | |||
&& ecma_compare_ecma_strings (cached_pattern_str_p, pattern_str_p)) | |||
{ | |||
JERRY_DDLOG ("RegExp is found in cache\n"); | |||
return re_cache[*idx]; | |||
return (re_compiled_code_t *) re_cache[*idx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change re_cache to store re_compiled_code_t pointers. This is what is there anyway.
cfdeeb9
to
4b29727
Compare
Thanks for the comments. I've updated the patch. |
@@ -37,9 +37,9 @@ | |||
/** | |||
* Node for free chunk list | |||
*/ | |||
typedef struct | |||
typedef struct mem_pools_chunk |
There was a problem hiding this comment.
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 struct
s 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 struct
s out there?
There was a problem hiding this comment.
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
LGTM |
1 similar comment
LGTM |
@@ -388,7 +388,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context | |||
|
|||
ECMA_TRY_CATCH (empty, | |||
re_parse_char_class (re_ctx_p->parser_ctx_p, | |||
re_append_char_class, | |||
(re_char_class_callback) re_append_char_class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, it is bad practice to cast function pointers. Instead, change re_append_char_class
to match re_char_class_callback
's type and cast the uint32_t to ecma_char_t inside the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franc0is, good point. @robertsipka, please change typedef void (*re_char_class_callback) (void *re_ctx_p, uint32_t start, uint32_t end);
to typedef void (*re_char_class_callback) (void *re_ctx_p, ecma_char_t start, ecma_char_t end);
and remove the cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for the comments. I've updated the patch.
@LaszloLango : This modification will affect some helper functions, and more code refactoring needed. I think we could open a follow-up PR to do this kind of conversions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
4b29727
to
a9b5c31
Compare
Passing argument 1 of ‘strncmp’ from incompatible pointer type. Assignments from incompatible pointer types. Passing argument or initialization discards ‘const’ qualifier from pointer target type. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka [email protected]
a9b5c31
to
0b5a49f
Compare
Rebased with master. |
No description provided.