-
Notifications
You must be signed in to change notification settings - Fork 478
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
uftrace: Fix dead store warnings found by infer #1757
Conversation
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
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.
Please squash the change at #1758 into this PR.
4e78ca1
to
282079b
Compare
Please rewrite the commit message by looking at the other commit messages especially as follows.
|
282079b
to
4d0eddf
Compare
The commit message doesn't follow our style again. The description
|
In addition, the current commit message only explains about the first change. diff --git a/utils/debug.c b/utils/debug.c
index bbf526fe2..3d779570d 100644
--- a/utils/debug.c
+++ b/utils/debug.c
@@ -383,7 +383,7 @@ void print_time_unit(uint64_t delta_nsec)
void print_diff_percent(uint64_t base_nsec, uint64_t pair_nsec)
{
- double percent = 999.99;
+ double percent;
const char *sc = get_color(COLOR_CODE_NORMAL);
const char *ec = get_color(COLOR_CODE_RESET); There is no explanation about the second change below. diff --git a/utils/kernel.c b/utils/kernel.c
index 3a33b67e1..2d2d277b3 100644
--- a/utils/kernel.c
+++ b/utils/kernel.c
@@ -54,7 +54,6 @@ struct kfilter {
static int set_filter_file(const char *filter_file, struct list_head *filters)
{
struct kfilter *pos, *tmp;
- int ret = -1;
int fd;
fd = open_tracing_file(filter_file, true);
@@ -75,10 +74,9 @@ static int set_filter_file(const char *filter_file, struct list_head *filters)
if (write(fd, " ", 1) != 1)
pr_dbg2("writing filter file failed, but ignoring...\n");
}
- ret = 0;
close(fd);
- return ret;
+ return 0;
}
static int set_tracing_filter(struct uftrace_kernel_writer *kernel) I would rather write the description as follows.
Please write the commit message with meaningful information. |
1c9b677
to
d756979
Compare
Can you please remove something like |
d756979
to
ca0042c
Compare
@namhyung Thank you for the code review! I amended a new patch. :) |
ca0042c
to
0c813ce
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.
The current commit message title is too long and it's better not to exceed more than 50 or 72 characters.
https://www.gitkraken.com/learn/git/best-practices/git-commit-message#git-commit-message-structure
b686c13
to
ec0ad25
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.
The current commit message title is too long and it's better not to exceed more than 50 or 72 characters.
https://www.gitkraken.com/learn/git/best-practices/git-commit-message#git-commit-message-structure
The commit title is still too long so make it short.
uftrace: Fix dead store warnings found by infer and warning on compile time implicit declaration
This patch fixes some dead store warnings found by a static analysis tool, called infer[1]. The warning messages are as follows. $ cd /path/to/uftrace $ infer run --force-integration make ... utils/debug.c:386: error: Dead Store The value written to `&percent` (type `double`) is never used. 384. void print_diff_percent(uint64_t base_nsec, uint64_t pair_nsec) 385. { 386. double percent = 999.99; ^ utils/debug.c:387: error: Dead Store The value written to `&sc` is never used. 385. { 386. double percent = 999.99; 387. const char *sc = get_color(COLOR_CODE_NORMAL); ^ 388. const char *ec = get_color(COLOR_CODE_RESET); 389. utils/kernel.c:57: error: Dead Store The value written to `&ret` is never used. 55. { 56. struct kfilter *pos, *tmp; 57. int ret = -1; ^ 58. int fd; 59. utils/perf.c:230: error: Dead Store The value written to `&start` is never used. 228. buf = &data[start & mask]; 229. size = end - start; 230. start += size; ^ [1] https://github.com/facebook/infer Fixed: namhyung#1553 Signed-off-by: Paran Lee <p4ranlee@gmail.com>
ec0ad25
to
930f24d
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!
uftrace: Fix dead store warnings found by infer
This patch fixes some dead store warnings found by a static analysis
tool, called infer[1].
The warning messages are as follows.
[1] https://github.com/facebook/infer
Fixed: #1553
Signed-off-by: Paran Lee p4ranlee@gmail.com