-
Notifications
You must be signed in to change notification settings - Fork 684
Remove the ENABLED/DISABLED macros #4515
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
Conversation
bcf3d62
to
846eb4f
Compare
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.
Looks good in general. But
- There are some new cppcheck suppressions. Cannot these be removed/avoided?
- Why is the new cppcheck-specific macro/guard necessary in the code? Especially in a public header! (jerryscript-compiler.h)
- Rebase and resolve conflicts.
- A humble suggestion to improve a bit on the commit message: "Remove the ENABLED/DISABLED macros // The removal of these macros enabled cppcheck to reveal new errors. These errors are also fixed/suppressed by the patch."
@@ -41,8 +41,10 @@ extern "C" | |||
#define JERRY_ATTR_PURE __attribute__((pure)) | |||
#define JERRY_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | |||
|
|||
#ifndef _CPP_CHECK_ |
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 is something new. At least to me. Why is this necessary?
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 macro was used to prevent JERRY_LIKELY(x)
to use __builtin_expect
since it's only a GCC extension and cppcheck does not know how to interpret it correctly. Until this workaround there were false positive alarms for the following like of code parts:
any_kind *obj_p = do_somenthing();
if (JERRY_UNLIKELY (obj_p == NULL)) {
return;
}
JERRY_ASSERT(obj_p);
obj_p->anything++; // warning(nullPointerRedundantCheck): Either the condition 'obj_p==NULL' is redundant or there is possible null pointer dereference: obj_p.
So now whenever the cppcheck is running the JERRY_{UN}LIKELY macros are forced to JERRY_{UN}LIKELY(x)
, without _CPP_CHECK_
. See here.
Moreover, there are no new inline suppressions by the patch and the number of already existing ones have been reduced to 1. This can be resolved later, but I didn't find a good solution it for now.
846eb4f
to
4002535
Compare
4243a12
to
46041b7
Compare
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.
LGTM
Please, rebase and resolve conflicts. |
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 [email protected]
46041b7
to
6083407
Compare
@akosthekiss The patch is rebased. |
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.
LGTM
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 [email protected]