Skip to content

Commit 788f8cf

Browse files
authored
Update static stream buffer size check (#693)
* Use volatile size instead of sizeof directly to prevent always true/false warning
1 parent aa012e8 commit 788f8cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stream_buffer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,13 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
436436
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
437437

438438
#if ( configASSERT_DEFINED == 1 )
439-
439+
{
440440
/* Sanity check that the size of the structure used to declare a
441441
* variable of type StaticStreamBuffer_t equals the size of the real
442442
* message buffer structure. */
443-
configASSERT( sizeof( StaticStreamBuffer_t ) == sizeof( StreamBuffer_t ) );
443+
volatile size_t xSize = sizeof( StaticStreamBuffer_t );
444+
configASSERT( xSize == sizeof( StreamBuffer_t ) );
445+
} /*lint !e529 xSize is referenced is configASSERT() is defined. */
444446
#endif /* configASSERT_DEFINED */
445447

446448
if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )

0 commit comments

Comments
 (0)