Skip to content
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

Re-enable -Wno-unused-variable for clang #83833

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

thughes
Copy link
Contributor

@thughes thughes commented Jan 10, 2025

This has a dependency on #84063

@thughes thughes force-pushed the fix-unused-variable-warnings branch 3 times, most recently from 3da13d7 to d90ea7b Compare January 17, 2025 19:12
@thughes thughes changed the title Fix unused variable warnings Re-enable -Wno-unused-variable for clang Jan 17, 2025
@thughes thughes marked this pull request as ready for review January 17, 2025 22:52
Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this gives erroneous warnings, why is it being enabled?

@thughes thughes force-pushed the fix-unused-variable-warnings branch from d90ea7b to 6e803d8 Compare January 25, 2025 00:37
@thughes thughes marked this pull request as draft February 4, 2025 19:49
@thughes thughes force-pushed the fix-unused-variable-warnings branch 4 times, most recently from cac9484 to 981b0ce Compare February 7, 2025 18:49
Building with clang warns:

tests/drivers/i2c/i2c_emul/src/test_forwarding_pio.cpp:19:32: error:
unused variable 'targets' [-Werror,-Wunused-const-variable]
constexpr const struct device *targets[FORWARD_COUNT] = {
                               ^

Signed-off-by: Tom Hughes <[email protected]>
Building with clang warns:

tests/drivers/i2c/i2c_emul/src/test_forwarding_buf.cpp:20:32: error:
unused variable 'targets' [-Werror,-Wunused-const-variable]
constexpr const struct device *targets[FORWARD_COUNT] = {
                               ^

Signed-off-by: Tom Hughes <[email protected]>
@thughes thughes force-pushed the fix-unused-variable-warnings branch 3 times, most recently from d561793 to b7b14f5 Compare February 15, 2025 00:14
In order to support new toolchains that are not compatible with
gcc/clang (e.g., IAR), we need to add a level of indirection for
the name of warnings.

Signed-off-by: Tom Hughes <[email protected]>
tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:69:22: error: variable
'test_response_read_data_start' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static const uint8_t test_response_read_data_start[5] = {
                     ^
tests/subsys/mgmt/mcumgr/settings_mgmt/src/main.c:73:22: error: variable
'test_response_read_data_end' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static const uint8_t test_response_read_data_end[1] = {
                     ^

Signed-off-by: Tom Hughes <[email protected]>
tests/subsys/usb/bos/src/test_bos.c:24:22: error: variable
'dummy_descriptor' is not needed and will not be emitted
[-Werror,-Wunneeded-internal-declaration]
static const uint8_t dummy_descriptor[] = {
                     ^

Signed-off-by: Tom Hughes <[email protected]>
All warnings in the code base have been resolved.

Signed-off-by: Tom Hughes <[email protected]>
@thughes thughes force-pushed the fix-unused-variable-warnings branch from b7b14f5 to d35ae8a Compare February 15, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants