Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchinglee-iot <61685396+chinglee-iot@users.noreply.github.com>2023-06-26 10:44:33 +0300
committerGitHub <noreply@github.com>2023-06-26 10:44:33 +0300
commit788f8cfd7693da0b26a75c6758519d3f514ef497 (patch)
tree5e4ecc35984b0462385c8e9a674d42c69e5750ef /stream_buffer.c
parentaa012e8d82bd05f8747c54b2e89694c9673bce4e (diff)
Update static stream buffer size check (#693)
* Use volatile size instead of sizeof directly to prevent always true/false warning
Diffstat (limited to 'stream_buffer.c')
-rw-r--r--stream_buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/stream_buffer.c b/stream_buffer.c
index cbc0939b3..2306b5d9b 100644
--- a/stream_buffer.c
+++ b/stream_buffer.c
@@ -436,11 +436,13 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
#if ( configASSERT_DEFINED == 1 )
-
+ {
/* Sanity check that the size of the structure used to declare a
* variable of type StaticStreamBuffer_t equals the size of the real
* message buffer structure. */
- configASSERT( sizeof( StaticStreamBuffer_t ) == sizeof( StreamBuffer_t ) );
+ volatile size_t xSize = sizeof( StaticStreamBuffer_t );
+ configASSERT( xSize == sizeof( StreamBuffer_t ) );
+ } /*lint !e529 xSize is referenced is configASSERT() is defined. */
#endif /* configASSERT_DEFINED */
if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )