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

Change if statements in autoip.c to fix compiler warnings #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kamendov-maxim
Copy link

Got warnings about unused code when tried to build example app with clang-14 so I moved options checks to preprocessor if statements

@yarrick
Copy link
Member

yarrick commented Jul 20, 2024

What warnings did you get?

@kamendov-maxim
Copy link
Author

Unused lines of code if LWIP_DHCP_AUTOIP_COOP is not 0

/lwip/src/core/ipv4/autoip.c:308:21: error: code will never be executed [-Werror,-Wunreachable-code]
autoip->state = AUTOIP_STATE_CHECKING;

if (autoip && (autoip->state != AUTOIP_STATE_OFF) && !LWIP_DHCP_AUTOIP_COOP) {
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
if (autoip && (autoip->state != AUTOIP_STATE_OFF)) {
#ifdef LWIP_DHCP_COOP
Copy link
Contributor

Choose a reason for hiding this comment

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

This #ifdef is superfluous here and below. The #if and #endif should start at the begin of the line. There is a typo LWIP_DHCP_COOP -> LWIP_DHCP_AUTOIP_COOP. Don't you get set but not used warnings with this change and the one below?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, thank you. No, I didn't get any warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants