-
Notifications
You must be signed in to change notification settings - Fork 106
Raise the warning level to -Wall -Wextra and resolve the warnings #609
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
base: release/v2.4.9.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -694,37 +694,37 @@ int ltfs_trace_dump(char *fname, const char *work_dir) | |
| trc_header->header_size + req_header->header_size + fn_trc_header->header_size; | ||
|
|
||
| /* Write headers */ | ||
| (void)arch_write(fd, trc_header, sizeof(struct trace_header)); | ||
| (void)arch_write(fd, req_header, sizeof(struct request_header)); | ||
| (void)!arch_write(fd, trc_header, sizeof(struct trace_header)); | ||
| (void)!arch_write(fd, req_header, sizeof(struct request_header)); | ||
|
|
||
| /* Write request trace data */ | ||
| ltfs_mutex_lock(&req_trace->req_trace_lock); | ||
| (void)arch_write(fd, req_trace->entries, REQ_TRACE_SIZE); | ||
| (void)!arch_write(fd, req_trace->entries, REQ_TRACE_SIZE); | ||
| ltfs_mutex_unlock(&req_trace->req_trace_lock); | ||
|
|
||
| /* Write function trace header */ | ||
| (void)arch_write(fd, &fn_trc_header->header_size, sizeof(uint32_t)); | ||
| (void)arch_write(fd, &fn_trc_header->num_of_fn_trace, sizeof(uint32_t)); | ||
| (void)!arch_write(fd, &fn_trc_header->header_size, sizeof(uint32_t)); | ||
| (void)!arch_write(fd, &fn_trc_header->num_of_fn_trace, sizeof(uint32_t)); | ||
| for (unsigned int i=0; i<n; i++) | ||
| (void)arch_write(fd, &fn_trc_header->req_t_desc[i], sizeof(struct function_trace_descriptor)); | ||
| (void)arch_write(fd, &fn_trc_header->crc, sizeof(uint32_t)); | ||
| (void)!arch_write(fd, &fn_trc_header->req_t_desc[i], sizeof(struct function_trace_descriptor)); | ||
| (void)!arch_write(fd, &fn_trc_header->crc, sizeof(uint32_t)); | ||
| free(fn_trc_header->req_t_desc); | ||
| fn_trc_header->req_t_desc = NULL; | ||
|
|
||
| /* Write function trace data */ | ||
| for (fsitem=fs_tr_list; fsitem != NULL; fsitem=fsitem->hh.next) { | ||
| acquireread_mrsw(&fsitem->fn_entry->trace_lock); | ||
| (void)arch_write(fd, fsitem->fn_entry->entries, FS_FN_TRACE_SIZE); | ||
| (void)!arch_write(fd, fsitem->fn_entry->entries, FS_FN_TRACE_SIZE); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a little comment on these changes, I suggested this for an idiomatic approach of GCC shenanigans to suppress a warning, but making some tests I see no warnings with the original way this was done, do you have more info about the specific warnings and system you saw a warning being raised?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The warning is Reproduced with Should this be commented at the call sites for future readers? |
||
| releaseread_mrsw(&fsitem->fn_entry->trace_lock); | ||
| } | ||
| for (admitem=admin_tr_list; admitem != NULL; admitem=admitem->hh.next) { | ||
| acquireread_mrsw(&admitem->fn_entry->trace_lock); | ||
| (void)arch_write(fd, admitem->fn_entry->entries, ADMIN_FN_TRACE_SIZE); | ||
| (void)!arch_write(fd, admitem->fn_entry->entries, ADMIN_FN_TRACE_SIZE); | ||
| releaseread_mrsw(&admitem->fn_entry->trace_lock); | ||
| } | ||
| TAILQ_FOREACH (tailq_item, acomp, list) { | ||
| acquireread_mrsw(&tailq_item->fn_entry->trace_lock); | ||
| (void)arch_write(fd, tailq_item->fn_entry->entries, ADMIN_FN_TRACE_SIZE); | ||
| (void)!arch_write(fd, tailq_item->fn_entry->entries, ADMIN_FN_TRACE_SIZE); | ||
| releaseread_mrsw(&tailq_item->fn_entry->trace_lock); | ||
| } | ||
| } | ||
|
|
||
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.
What warning was this fixing when compiling before? Can you please share details about the warning and specific platform? Thanks
Uh oh!
There was an error while loading. Please reload this page.
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.
Many warnings appear only with a higher -O level. This one is
-Walloc-size-larger-than, reported by gcc 15 (Ubuntu 25.10 and 26.04) with--enable-fast(-O2); clang does not report it.namelen + namesisint, and gcc's range analysis finds it can be negative; converted tocalloc'ssize_targument that becomes ~2^64. Fixed by makingnames/namelensize_t.