netutils/ntpclient: fix a warning if CONFIG_NETUTILS_DHCPC not defined#3466
Open
masc2008 wants to merge 1 commit intoapache:masterfrom
Open
netutils/ntpclient: fix a warning if CONFIG_NETUTILS_DHCPC not defined#3466masc2008 wants to merge 1 commit intoapache:masterfrom
masc2008 wants to merge 1 commit intoapache:masterfrom
Conversation
Signed-off-by: Jerry Ma <masc2008@gmail.com>
Contributor
Author
|
sorry to introduced this warning, not sure if this needs to be fixed. |
This file contains hidden or 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
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.
Summary
This change fixes a warning in
netutils/ntpclient/ntpclient.cwhenCONFIG_NETUTILS_DHCPCis not enabled.ntpc_set_servers_from_dhcp()is only used from the DHCP notificationpath, but it and its local helper
ntpc_dup_server_list()were compiledunconditionally. In non-DHCP builds this can leave unused static helpers
and trigger compiler warnings.
This patch wraps the DHCP-only declaration and helper definitions with
#ifdef CONFIG_NETUTILS_DHCPCand keeps the shared startup logicunchanged.
ntpc_select_server_list()remains unconditional because itis still used by the normal
ntpc_start()path.Impact
This change is limited to
netutils/ntpclient.It does not change runtime behavior when
CONFIG_NETUTILS_DHCPCisenabled. For builds without
CONFIG_NETUTILS_DHCPC, it removesunnecessary DHCP-only code from compilation and avoids warning noise.
There is no API change and no documentation update is needed for this
internal warning fix.
Testing
Build-tested change only.
Host:
Target / config:
CONFIG_NETUTILS_DHCPC=yCONFIG_NETUTILS_DHCPCnot setVerification:
Runtime testing on hardware was not performed for this warning fix.