Fix MISRA_C_2012 rule 20.7 violation (#843)

* Wrap macro parameter expansion by parentheses
* Update parentheses in SMP macro definition

---------

Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Co-authored-by: Monika Singh <moninom@amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
This commit is contained in:
Rahul Kar 2023-12-06 13:57:10 +05:30 committed by GitHub
parent 84c0047ccd
commit edce1e94b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 26 deletions

View file

@ -153,16 +153,16 @@
* invoke the callback else use the send complete macro which is provided by default for all instances. * invoke the callback else use the send complete macro which is provided by default for all instances.
*/ */
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
#define prvSEND_COMPLETED( pxStreamBuffer ) \ #define prvSEND_COMPLETED( pxStreamBuffer ) \
do { \ do { \
if( ( pxStreamBuffer )->pxSendCompletedCallback != NULL ) \ if( ( pxStreamBuffer )->pxSendCompletedCallback != NULL ) \
{ \ { \
pxStreamBuffer->pxSendCompletedCallback( ( pxStreamBuffer ), pdFALSE, NULL ); \ ( pxStreamBuffer )->pxSendCompletedCallback( ( pxStreamBuffer ), pdFALSE, NULL ); \
} \ } \
else \ else \
{ \ { \
sbSEND_COMPLETED( ( pxStreamBuffer ) ); \ sbSEND_COMPLETED( ( pxStreamBuffer ) ); \
} \ } \
} while( 0 ) } while( 0 )
#else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */ #else /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
#define prvSEND_COMPLETED( pxStreamBuffer ) sbSEND_COMPLETED( ( pxStreamBuffer ) ) #define prvSEND_COMPLETED( pxStreamBuffer ) sbSEND_COMPLETED( ( pxStreamBuffer ) )

32
tasks.c
View file

@ -324,22 +324,22 @@
/* Yields the given core. This must be called from a critical section and xCoreID /* Yields the given core. This must be called from a critical section and xCoreID
* must be valid. This macro is not required in single core since there is only * must be valid. This macro is not required in single core since there is only
* one core to yield. */ * one core to yield. */
#define prvYieldCore( xCoreID ) \ #define prvYieldCore( xCoreID ) \
do { \ do { \
if( xCoreID == ( BaseType_t ) portGET_CORE_ID() ) \ if( ( xCoreID ) == ( BaseType_t ) portGET_CORE_ID() ) \
{ \ { \
/* Pending a yield for this core since it is in the critical section. */ \ /* Pending a yield for this core since it is in the critical section. */ \
xYieldPendings[ xCoreID ] = pdTRUE; \ xYieldPendings[ ( xCoreID ) ] = pdTRUE; \
} \ } \
else \ else \
{ \ { \
/* Request other core to yield if it is not requested before. */ \ /* Request other core to yield if it is not requested before. */ \
if( pxCurrentTCBs[ xCoreID ]->xTaskRunState != taskTASK_SCHEDULED_TO_YIELD ) \ if( pxCurrentTCBs[ ( xCoreID ) ]->xTaskRunState != taskTASK_SCHEDULED_TO_YIELD ) \
{ \ { \
portYIELD_CORE( xCoreID ); \ portYIELD_CORE( xCoreID ); \
pxCurrentTCBs[ xCoreID ]->xTaskRunState = taskTASK_SCHEDULED_TO_YIELD; \ pxCurrentTCBs[ ( xCoreID ) ]->xTaskRunState = taskTASK_SCHEDULED_TO_YIELD; \
} \ } \
} \ } \
} while( 0 ) } while( 0 )
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */ #endif /* #if ( configNUMBER_OF_CORES > 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/