-
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
Shutting off compiler warnings from libtraceevent #28
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since asprintf generates a compiler warning when its return value is not not properly handled, this patch checks that asprintf call is successful or not. Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
This patch fixes uninitialized variables to remove remaining compiler warnings as follows: event-parse.c: In function ‘pevent_find_event_by_name’: event-parse.c:3513:21: warning: ‘event’ may be used uninitialized in this function [-Wmaybe-uninitialized] pevent->last_event = event; ^ event-parse.c: In function ‘pevent_data_lat_fmt’: event-parse.c:5156:20: warning: ‘migrate_disable’ may be used uninitialized in this function [-Wmaybe-uninitialized] trace_seq_printf(s, "%d", migrate_disable); ^ event-parse.c:5163:20: warning: ‘lock_depth’ may be used uninitialized in this function [-Wmaybe-uninitialized] trace_seq_printf(s, "%d", lock_depth); ^ event-parse.c: In function ‘pevent_event_info’: event-parse.c:5060:18: warning: ‘len_arg’ may be used uninitialized in this function [-Wmaybe-uninitialized] print_str_arg(&p, data, size, event, ^ event-parse.c:4846:6: note: ‘len_arg’ was declared here int len_arg; ^ ... kbuffer-parse.c: In function ‘__old_next_event’: kbuffer-parse.c:339:27: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized] kbuf->next = kbuf->index + length; ^ kbuffer-parse.c:297:15: note: ‘length’ was declared here unsigned int length; ^ Signed-off-by: Honggyu Kim <hong.gyu.kim@lge.com>
This removes compiler warnings from -Wsign-compare by modifying some variable types. It removes the below warnings: warning: signed and unsigned type in conditional expression [-Wsign-compare] warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Closed
namhyung
approved these changes
Oct 21, 2016
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 tested this patchset and it removes the warnings. Thanks for your work!
honggyukim
added a commit
to honggyukim/uftrace
that referenced
this pull request
Nov 25, 2019
This implements full dynamic tracing for ARM. The current status is that it can record uftrace itself, but only for unoptimized binary. The following patterns must be handled to support optimized binary. 00034110 <start_pager>: 34110: e59f3084 ldr r3, [pc, namhyung#132] ; 3419c <start_pager+0x8c> 34114: e92d4010 push {r4, lr} 34118: e1a0e000 mov lr, r0 3411c: e893000f ldm r3, {r0, r1, r2, r3} 00038280 <setup_field>: 38280: e92d4ff0 push {r4, r5, r6, r7, r8, r9, sl, fp, lr} 38284: e3a0c000 mov ip, #0 38288: e5914034 ldr r4, [r1, namhyung#52] ; 0x34 3828c: e24dd01c sub sp, sp, namhyung#28 000482b4 <find_symtabs>: 482b4: e1a0c000 mov ip, r0 482b8: e1c001d0 ldrd r0, [r0, #16] 482bc: e92d4ff8 push {r3, r4, r5, r6, r7, r8, r9, sl, fp, lr} 482c0: e1510003 cmp r1, r3 THUMB code is not handled yet! Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
honggyukim
added a commit
to honggyukim/uftrace
that referenced
this pull request
Nov 26, 2019
This implements full dynamic tracing for ARM. The current status is that it can record uftrace itself, but only for unoptimized binary. The following patterns must be handled to support optimized binary. 00034110 <start_pager>: 34110: e59f3084 ldr r3, [pc, namhyung#132] ; 3419c <start_pager+0x8c> 34114: e92d4010 push {r4, lr} 34118: e1a0e000 mov lr, r0 3411c: e893000f ldm r3, {r0, r1, r2, r3} 00038280 <setup_field>: 38280: e92d4ff0 push {r4, r5, r6, r7, r8, r9, sl, fp, lr} 38284: e3a0c000 mov ip, #0 38288: e5914034 ldr r4, [r1, namhyung#52] ; 0x34 3828c: e24dd01c sub sp, sp, namhyung#28 000482b4 <find_symtabs>: 482b4: e1a0c000 mov ip, r0 482b8: e1c001d0 ldrd r0, [r0, #16] 482bc: e92d4ff8 push {r3, r4, r5, r6, r7, r8, r9, sl, fp, lr} 482c0: e1510003 cmp r1, r3 THUMB code is not handled yet! Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
honggyukim
added a commit
to honggyukim/uftrace
that referenced
this pull request
Dec 13, 2019
This implements full dynamic tracing for ARM. The current status is that it can record uftrace itself, but only for unoptimized binary. The following patterns must be handled to support optimized binary. 00034110 <start_pager>: 34110: e59f3084 ldr r3, [pc, namhyung#132] ; 3419c <start_pager+0x8c> 34114: e92d4010 push {r4, lr} 34118: e1a0e000 mov lr, r0 3411c: e893000f ldm r3, {r0, r1, r2, r3} 00038280 <setup_field>: 38280: e92d4ff0 push {r4, r5, r6, r7, r8, r9, sl, fp, lr} 38284: e3a0c000 mov ip, #0 38288: e5914034 ldr r4, [r1, namhyung#52] ; 0x34 3828c: e24dd01c sub sp, sp, namhyung#28 000482b4 <find_symtabs>: 482b4: e1a0c000 mov ip, r0 482b8: e1c001d0 ldrd r0, [r0, #16] 482bc: e92d4ff8 push {r3, r4, r5, r6, r7, r8, r9, sl, fp, lr} 482c0: e1510003 cmp r1, r3 THUMB code is not handled yet! Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
paranlee
pushed a commit
to paranlee/uftrace
that referenced
this pull request
Dec 10, 2023
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 ... namhyung#24 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; ^ namhyung#28 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. namhyung#31 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. namhyung#32 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; ^ And fix warning on compile time with including unistd.h header file. utils/kernel-parser.c:151:9: warning: implicit declaration of function 'close'; did you mean 'pclos'? [-Wimplicit-function-declaration] 151 | close(kp->fds[cpu]); | ^~~~~ | pclose [1] https://github.com/facebook/infer Fixed: namhyung#1553 Signed-off-by: Paran Lee <p4ranlee@gmail.com>
paranlee
added a commit
to paranlee/uftrace
that referenced
this pull request
Dec 10, 2023
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 ... namhyung#24 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; ^ namhyung#28 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. namhyung#31 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. namhyung#32 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; ^ And fix warning on compile time with including unistd.h header file. utils/kernel-parser.c:151:9: warning: implicit declaration of function 'close'; did you mean 'pclos'? [-Wimplicit-function-declaration] 151 | close(kp->fds[cpu]); | ^~~~~ | pclose [1] https://github.com/facebook/infer Fixed: namhyung#1553 Signed-off-by: Paran Lee <p4ranlee@gmail.com>
paranlee
added a commit
to paranlee/uftrace
that referenced
this pull request
Dec 10, 2023
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 ... namhyung#24 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; ^ namhyung#28 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. namhyung#31 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. namhyung#32 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; ^ And fix warning on compile time with including unistd.h header file. utils/kernel-parser.c:151:9: warning: implicit declaration of function 'close'; did you mean 'pclos'? [-Wimplicit-function-declaration] 151 | close(kp->fds[cpu]); | ^~~~~ | pclose [1] https://github.com/facebook/infer Fixed: namhyung#1553 Signed-off-by: Paran Lee <p4ranlee@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes below compiler warnings: