Skip to content

Commit

Permalink
Fix compiler warnings when the TCP Window is not used (#124)
Browse files Browse the repository at this point in the history
* Fix warnings when TCP window is not used

* Uncrustify
  • Loading branch information
AniruddhaKanhere committed Feb 24, 2021
1 parent 9a25860 commit be9fe45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ static BaseType_t xIPTaskInitialised = pdFALSE;

/*-----------------------------------------------------------*/

#include "random.h"

/* Coverity wants to make pvParameters const, which would make it incompatible. Leave the
* function signature as is. */

Expand Down Expand Up @@ -434,6 +436,8 @@ static void prvIPTask( void * pvParameters )

iptraceNETWORK_EVENT_RECEIVED( xReceivedEvent.eEventType );

vAddBytesToPool( xReceivedEvent.eEventType );

switch( xReceivedEvent.eEventType )
{
case eNetworkDownEvent:
Expand Down
13 changes: 10 additions & 3 deletions FreeRTOS_TCP_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,12 @@
uxIndex += ( size_t ) ucLen;
}
}

#if ( ipconfigUSE_TCP_WIN == 0 )
/* Avoid compiler warnings when TCP window is not used. */
( void ) xHasSYNFlag;
#endif

return uxIndex;
}
/*-----------------------------------------------------------*/
Expand Down Expand Up @@ -2595,11 +2601,12 @@
TCPHeader_t * pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
const TCPWindow_t * pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
UBaseType_t uxOptionsLength = pxTCPWindow->ucOptionLength;
/* memcpy() helper variables for MISRA Rule 21.15 compliance*/
const void * pvCopySource;
void * pvCopyDest;

#if ( ipconfigUSE_TCP_WIN == 1 )
/* memcpy() helper variables for MISRA Rule 21.15 compliance*/
const void * pvCopySource;
void * pvCopyDest;

if( uxOptionsLength != 0U )
{
/* TCP options must be sent because a packet which is out-of-order
Expand Down
2 changes: 1 addition & 1 deletion tools/tcp_utilities/tcp_mem_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#ifndef ipconfigTCP_MEM_STATS_MAX_ALLOCATION
#define ipconfigTCP_MEM_STATS_MAX_ALLOCATION 128u
#pragma warning "ipconfigTCP_MEM_STATS_MAX_ALLOCATION undefined?"
// #pragma warning "ipconfigTCP_MEM_STATS_MAX_ALLOCATION undefined?"
#endif

#if ( ipconfigUSE_TCP_MEM_STATS != 0 )
Expand Down

0 comments on commit be9fe45

Please sign in to comment.