Skip to content

Commit

Permalink
Fix Clang warnings (FreeRTOS#809)
Browse files Browse the repository at this point in the history
Corrects several warnings from Clang flags
for Clang 13.

Inspired by @phelter's bug report
FreeRTOS#558
  • Loading branch information
kstribrnAmzn authored and moninom1 committed Apr 18, 2023
1 parent 7171d8b commit cad9525
Show file tree
Hide file tree
Showing 26 changed files with 661 additions and 679 deletions.
1 change: 1 addition & 0 deletions .github/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ xlastalivetime
xlastgratuitousarptime
xlastround
xlastsource
xleasetime
xlength
xlinkstatustimer
xlistend
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ add_compile_options(
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wunused-variable>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wpedantic>

# TODO: Add in other Compilers here.
)
Expand Down
18 changes: 0 additions & 18 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,6 @@ target_include_directories( freertos_plus_tcp SYSTEM
include
)

#TODO(phelter): Investigate and fix in freertos_plus_tcp if not already fixed.
target_compile_options( freertos_plus_tcp
PRIVATE
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-bad-function-cast>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-cast-qual>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-conditional-uninitialized>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-covered-switch-default>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-documentation>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-extra-semi-stmt>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-implicit-int-conversion>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-missing-noreturn>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-reserved-identifier>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-shorten-64-to-32>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-sign-conversion>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-unused-macros>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-unused-parameter>
)

target_link_libraries( freertos_plus_tcp
PUBLIC
freertos_config
Expand Down
70 changes: 35 additions & 35 deletions source/FreeRTOS_ARP.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static TickType_t xLastGratuitousARPTime = 0U;
/**
* @brief Process the ARP packets.
*
* @param[in] pxNetworkBuffer: : The network buffer with the packet to be processed.
* @param[in] pxNetworkBuffer The network buffer with the packet to be processed.
*
* @return An enum which says whether to return the frame or to release it.
*/
Expand Down Expand Up @@ -320,9 +320,9 @@ eFrameProcessingResult_t eARPProcessPacket( const NetworkBufferDescriptor_t * px
/**
* @brief Process an ARP request packets.
*
* @param[in] pxARPFrame: the complete ARP-frame.
* @param[in] pxTargetEndPoint: the end-point that handles the peer's address.
* @param[in] ulSenderProtocolAddress: the IP-address of the sender.
* @param[in] pxARPFrame the complete ARP-frame.
* @param[in] pxTargetEndPoint the end-point that handles the peer's address.
* @param[in] ulSenderProtocolAddress the IP-address of the sender.
*
*/
static void vARPProcessPacketRequest( ARPPacket_t * pxARPFrame,
Expand Down Expand Up @@ -395,9 +395,9 @@ static void vARPProcessPacketRequest( ARPPacket_t * pxARPFrame,

/**
* @brief A device has sent an ARP reply, process it.
* @param[in] pxARPFrame: The ARP packet received.
* @param[in] pxTargetEndPoint: The end-point on which it is received.
* @param[in] ulSenderProtocolAddress: The IPv4 address involved.
* @param[in] pxARPFrame The ARP packet received.
* @param[in] pxTargetEndPoint The end-point on which it is received.
* @param[in] ulSenderProtocolAddress The IPv4 address involved.
*/
static void vARPProcessPacketReply( const ARPPacket_t * pxARPFrame,
NetworkEndPoint_t * pxTargetEndPoint,
Expand Down Expand Up @@ -452,7 +452,7 @@ static void vARPProcessPacketReply( const ARPPacket_t * pxARPFrame,
/**
* @brief Check whether an IP address is in the ARP cache.
*
* @param[in] ulAddressToLookup: The 32-bit representation of an IP address to
* @param[in] ulAddressToLookup The 32-bit representation of an IP address to
* check for.
*
* @return When the IP-address is found: pdTRUE, else pdFALSE.
Expand Down Expand Up @@ -487,7 +487,7 @@ BaseType_t xIsIPInARPCache( uint32_t ulAddressToLookup )
/**
* @brief Check whether a packet needs ARP resolution if it is on local subnet. If required send an ARP request.
*
* @param[in] pxNetworkBuffer: The network buffer with the packet to be checked.
* @param[in] pxNetworkBuffer The network buffer with the packet to be checked.
*
* @return pdTRUE if the packet needs ARP resolution, pdFALSE otherwise.
*/
Expand Down Expand Up @@ -574,7 +574,7 @@ BaseType_t xCheckRequiresARPResolution( NetworkBufferDescriptor_t * pxNetworkBuf
/**
* @brief Remove an ARP cache entry that matches with .pxMACAddress.
*
* @param[in] pxMACAddress: Pointer to the MAC address whose entry shall
* @param[in] pxMACAddress Pointer to the MAC address whose entry shall
* be removed.
* @return When the entry was found and remove: the IP-address, otherwise zero.
*/
Expand Down Expand Up @@ -605,11 +605,11 @@ BaseType_t xCheckRequiresARPResolution( NetworkBufferDescriptor_t * pxNetworkBuf
/**
* @brief Add/update the ARP cache entry MAC-address to IP-address mapping.
*
* @param[in] pxMACAddress: Pointer to the MAC address whose mapping is being
* @param[in] pxMACAddress Pointer to the MAC address whose mapping is being
* updated.
* @param[in] ulIPAddress: 32-bit representation of the IP-address whose mapping
* @param[in] ulIPAddress 32-bit representation of the IP-address whose mapping
* is being updated.
* @param[in] pxEndPoint: The end-point stored in the table.
* @param[in] pxEndPoint The end-point stored in the table.
*/
void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress,
const uint32_t ulIPAddress,
Expand Down Expand Up @@ -692,10 +692,10 @@ void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress,
/**
* @brief The results of an ARP look-up shall be stored in the ARP cache.
* This helper function looks up the location.
* @param[in] pxMACAddress: The MAC-address belonging to the IP-address.
* @param[in] ulIPAddress: The IP-address of the entry.
* @param[in] pxEndPoint: The end-point that will stored in the table.
* @param[out] pxLocation: The results of this search are written in this struct.
* @param[in] pxMACAddress The MAC-address belonging to the IP-address.
* @param[in] ulIPAddress The IP-address of the entry.
* @param[in] pxEndPoint The end-point that will stored in the table.
* @param[out] pxLocation The results of this search are written in this struct.
*/
static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
const uint32_t ulIPAddress,
Expand Down Expand Up @@ -813,8 +813,8 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
/**
* @brief Retrieve an entry from the cache table
*
* @param[in] pxMACAddress: The MAC-address of the entry of interest.
* @param[out] pulIPAddress: set to the IP-address found, or unchanged when not found.
* @param[in] pxMACAddress The MAC-address of the entry of interest.
* @param[out] pulIPAddress set to the IP-address found, or unchanged when not found.
*
* @return Either eARPCacheMiss or eARPCacheHit.
*/
Expand Down Expand Up @@ -862,10 +862,10 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
/**
* @brief Look for ulIPAddress in the ARP cache.
*
* @param[in,out] pulIPAddress: Pointer to the IP-address to be queried to the ARP cache.
* @param[in,out] pxMACAddress: Pointer to a MACAddress_t variable where the MAC address
* @param[in,out] pulIPAddress Pointer to the IP-address to be queried to the ARP cache.
* @param[in,out] pxMACAddress Pointer to a MACAddress_t variable where the MAC address
* will be stored, if found.
* @param[out] ppxEndPoint: Pointer to the end-point of the gateway will be stored.
* @param[out] ppxEndPoint Pointer to the end-point of the gateway will be stored.
*
* @return If the IP address exists, copy the associated MAC address into pxMACAddress,
* refresh the ARP cache entry's age, and return eARPCacheHit. If the IP
Expand Down Expand Up @@ -935,11 +935,11 @@ eARPLookupResult_t eARPGetCacheEntry( uint32_t * pulIPAddress,

/**
* @brief The IPv4 address is apparently a web-address. Find a gateway..
* @param[in] pulIPAddress: The target IP-address. It may be replaced with the IP
* @param[in] pulIPAddress The target IP-address. It may be replaced with the IP
* address of a gateway.
* @param[in] pxMACAddress: In case the MAC-address is found in cache, it will be
* @param[in] pxMACAddress In case the MAC-address is found in cache, it will be
* stored to the buffer provided.
* @param[out] ppxEndPoint: The end-point of the gateway will be copy to the pointee.
* @param[out] ppxEndPoint The end-point of the gateway will be copy to the pointee.
*/
static eARPLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
MACAddress_t * const pxMACAddress,
Expand Down Expand Up @@ -1026,12 +1026,12 @@ static eARPLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
/**
* @brief Lookup an IP address in the ARP cache.
*
* @param[in] ulAddressToLookup: The 32-bit representation of an IP address to
* @param[in] ulAddressToLookup The 32-bit representation of an IP address to
* lookup.
* @param[out] pxMACAddress: A pointer to MACAddress_t variable where, if there
* @param[out] pxMACAddress A pointer to MACAddress_t variable where, if there
* is an ARP cache hit, the MAC address corresponding to
* the IP address will be stored.
* @param[in,out] ppxEndPoint: a pointer to the end-point will be stored.
* @param[in,out] ppxEndPoint a pointer to the end-point will be stored.
*
* @return When the IP-address is found: eARPCacheHit, when not found: eARPCacheMiss,
* and when waiting for a ARP reply: eCantSendPacket.
Expand Down Expand Up @@ -1173,7 +1173,7 @@ void vARPSendGratuitous( void )
/**
* @brief Create and send an ARP request packet.
*
* @param[in] ulIPAddress: A 32-bit representation of the IP-address whose
* @param[in] ulIPAddress A 32-bit representation of the IP-address whose
* physical (MAC) address is required.
*/
void FreeRTOS_OutputARPRequest( uint32_t ulIPAddress )
Expand Down Expand Up @@ -1252,8 +1252,8 @@ void FreeRTOS_OutputARPRequest( uint32_t ulIPAddress )
* needed send an ARP request, and wait for a reply. This function is useful when
* called before FreeRTOS_sendto().
*
* @param[in] ulIPAddress: The IP-address to look-up.
* @param[in] uxTicksToWait: The maximum number of clock ticks to wait for a reply.
* @param[in] ulIPAddress The IP-address to look-up.
* @param[in] uxTicksToWait The maximum number of clock ticks to wait for a reply.
*
* @return Zero when successful.
*/
Expand Down Expand Up @@ -1312,7 +1312,7 @@ BaseType_t xARPWaitResolution( uint32_t ulIPAddress,
* @brief Generate an ARP request packet by copying various constant details to
* the buffer.
*
* @param[in,out] pxNetworkBuffer: Pointer to the buffer which has to be filled with
* @param[in,out] pxNetworkBuffer Pointer to the buffer which has to be filled with
* the ARP request packet details.
*/
void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer )
Expand Down Expand Up @@ -1395,7 +1395,7 @@ void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffe

/**
* @brief A call to this function will clear the ARP cache.
* @param[in] pxEndPoint: only clean entries with this end-point, or when NULL,
* @param[in] pxEndPoint only clean entries with this end-point, or when NULL,
* clear the entire ARP cache.
*/
void FreeRTOS_ClearARP( const struct xNetworkEndPoint * pxEndPoint )
Expand Down Expand Up @@ -1426,8 +1426,8 @@ void FreeRTOS_ClearARP( const struct xNetworkEndPoint * pxEndPoint )
* If so, the packet will be passed to the IP-stack, who will answer it.
* The function is to be called within the function xNetworkInterfaceOutput().
*
* @param[in] pxDescriptor: The network buffer which is to be checked for loop-back.
* @param[in] bReleaseAfterSend: pdTRUE: Driver is allowed to transfer ownership of descriptor.
* @param[in] pxDescriptor The network buffer which is to be checked for loop-back.
* @param[in] bReleaseAfterSend pdTRUE: Driver is allowed to transfer ownership of descriptor.
* pdFALSE: Driver is not allowed to take ownership of descriptor,
* make a copy of it.
*
Expand Down
Loading

0 comments on commit cad9525

Please sign in to comment.