-
Notifications
You must be signed in to change notification settings - Fork 349
global: Avoid warnings about unused variables #9998
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
global: Avoid warnings about unused variables #9998
Conversation
|
Not sure this is right way, now there's another: sof/src/ipc/ipc4/helper.c:945:31: error: unused variable 'sof_uuid' [-Werror,-Wunused-variable] The sof_uuid is used with tr_warn(). The stub_build step is possibly disabling all traces. Edit - and a few more added. Seems these are relevant, so I'm not closing this. |
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.
Pull Request Overview
This pull request addresses warnings about unused variables across multiple modules, contributing to cleaner builds on stub-check configurations.
- In src/platform/posix/ipc.c, unused variables were removed or relocated under conditional compilation.
- In src/ipc/ipc4/helper.c, an unused argument is explicitly cast to void.
- In the smart amp modules and IGO NR modules, unused variables were removed or cast to void to prevent warnings.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/platform/posix/ipc.c | Removed unused variable declarations and relocated them within a conditional block; removed an unused pointer assignment. |
| src/ipc/ipc4/helper.c | Added an explicit cast for an unused variable to avoid warnings. |
| src/audio/smart_amp/smart_amp_generic.c | Removed an unused variable (sink_ch). |
| src/audio/smart_amp/smart_amp.c | Removed an unused variable (rate). |
| src/audio/igo_nr/igo_nr.c | Added an explicit cast to avoid unused variable warnings. |
Comments suppressed due to low confidence (1)
src/platform/posix/ipc.c:89
- The removal of the 'cc' variable assignment is acceptable if this variable is not used in subsequent processing; please verify that its removal does not affect any later functionality.
struct sof_ipc_comp *cc = global_ipc->comp_data;
kv2019i
left a comment
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 consider __maybe_unused
src/ipc/ipc4/helper.c
Outdated
| struct comp_driver_info *info; | ||
| uint32_t flags; | ||
|
|
||
| (void)sof_uuid; /* Avoid possible warning of unused */ |
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.
@singalsu You should be able to use "__maybe_unused" attribute for these cases. See examples in Zephyr and SOF, often used for variables that are checked in asserts and log statements that may be omitted in production builds.
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.
Ah that was it, I had vague memory of something like that but I could not find example. I'll change, stay tuned.
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.
Updated now, it looks like the stubs build passed with green check mark with __maybe_unused.
This change avoids warning and error about: sof/src/audio/igo_nr/igo_nr.c:678:20: error: unused variable 'cd' [-Werror,-Wunused-variable] struct comp_data *cd = module_get_private_data(mod); Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoids warning/error: sof/src/ipc/ipc4/helper.c:945:31: error: unused variable 'sof_uuid' [-Werror,-Wunused-variable] Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The variable sink_ch is unused. This avoids warning/error: sof/workspace/sof/src/audio/smart_amp/smart_amp_generic.c:224:6: error: unused variable 'sink_ch' [-Werror,-Wunused-variable] Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoid errors: sof/src/platform/posix/ipc.c:48:7: error: unused variable 'comp_new' [-Werror,-Wunused-variable] sof/src/platform/posix/ipc.c:49:6: error: unused variable 'comp_idx' [-Werror,-Wunused-variable] Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change fixes warning/error: sof/src/audio/smart_amp/smart_amp.c:736:11: error: unused variable 'rate' [-Werror,-Wunused-variable] Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change avoids error: sof/src/platform/posix/ipc.c:90:23: error: unused variable 'cc' [-Werror,-Wunused-variable] Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
e065d09 to
6d77c9d
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.
Pull Request Overview
This PR removes unused variable warnings and resolves stub-build check issues in various audio and IPC modules.
- Removed unused variable declarations in posix IPC code.
- Marked unused variables with __maybe_unused in IPC4 Helper and IGO NR.
- Removed redundant unused variables in Smart Amp modules.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/platform/posix/ipc.c | Removed unused variables and relocated declarations conditionally |
| src/ipc/ipc4/helper.c | Marked variable as __maybe_unused to suppress warnings |
| src/audio/smart_amp/smart_amp_generic.c | Removed unused local variable |
| src/audio/smart_amp/smart_amp.c | Removed unused variable from the prepare function |
| src/audio/igo_nr/igo_nr.c | Marked unused variable as __maybe_unused |
lyakh
left a comment
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 completely supersedes #10001
|
@singalsu I've updated the PR title to better reflect what it fixes |
Fixes to IGO NR, Smart Amp, IPC4 Helper, POSIX IPC to fix stub-build check.