Rule 20.7 Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses
such like
// ./FreeRTOS/Source/croutine.c line 68
#define prvAddCoRoutineToReadyQueue( pxCRCB ) \
{ \
if( pxCRCB->uxPriority > uxTopCoRoutineReadyPriority ) \
{ \
uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
} \
vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
}
aggarg
(Gaurav Aggarwal)
July 5, 2022, 5:00am
2
What are you trying to use croutine.c
for? Does the following addresses this violation -
#define prvAddCoRoutineToReadyQueue( pxCRCB ) \
{ \
if( ( pxCRCB )->uxPriority > uxTopCoRoutineReadyPriority ) \
{ \
uxTopCoRoutineReadyPriority = ( pxCRCB )->uxPriority; \
} \
vListInsertEnd( ( List_t * ) &( pxReadyCoRoutineLists[ ( pxCRCB )->uxPriority ] ), &( ( pxCRCB )->xGenericListItem ) ); \
}
rtel
(Richard Barry)
July 5, 2022, 1:11pm
3
Co-routines have been deprecated for some time.
1 Like
Yes, this is an another violation
aggarg
(Gaurav Aggarwal)
August 8, 2022, 9:12am
5
I was asking if the code I pasted addresses the violation you mentioned. As Richard mentioned, co-routines have been deprecated. Are you using co-routines?
Oh, I am sorry, the code you pasted can address this violation.
I’m not using co-routines.
My company is developing a static analysis tool about Misra rules, and we just run our tool on some open source projects, like FreeRTOS.
So we don’t know that co-routines have been deprecated.
Thanks for your reply!
However, in addition to coroutines, some files have this problem, such as below in FreeRTOS/Source/include/FreeRTOS.h
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
#endif
#ifndef portCLEAN_UP_TCB
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
#endif
aggarg
(Gaurav Aggarwal)
August 22, 2022, 9:19am
8