mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 13:01:57 -04:00
Fix MISRA C 2012 Rule 11.1 deviations (#856)
* Update callback function prototype to align with definition * Suppress unused function pointer parameter --------- Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Ubuntu <ubuntu@ip-172-31-34-245.ap-northeast-1.compute.internal> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
15af8e072d
commit
877484cd7e
10
MISRA.md
10
MISRA.md
|
@ -34,7 +34,6 @@ _Ref 8.4.2_
|
|||
kernel unit tests. It is not meant to be directly accessed by the application
|
||||
and therefore, not declared in a header file.
|
||||
|
||||
|
||||
#### Rule 8.6
|
||||
|
||||
MISRA C:2012 Rule 8.6: An identifier with external linkage shall have exactly
|
||||
|
@ -45,6 +44,15 @@ _Ref 8.6.1_
|
|||
definitions or no definition. FreeRTOS hook functions are implemented in
|
||||
the application and therefore, have no definition in the Kernel code.
|
||||
|
||||
#### Rule 11.1
|
||||
MISRA C:2012 Rule 11.1: Conversions shall not be performed between a pointer to
|
||||
function and any other type.
|
||||
|
||||
_Ref 11.1.1_
|
||||
- The pointer to function is casted into void to avoid unused parameter
|
||||
compiler warning when Stream Buffer's Tx and Rx Completed callback feature is
|
||||
not used.
|
||||
|
||||
#### Rule 11.3
|
||||
|
||||
MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to
|
||||
|
|
|
@ -506,7 +506,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
|||
traceENTER_xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear );
|
||||
|
||||
traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear );
|
||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */
|
||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL );
|
||||
|
||||
traceRETURN_xEventGroupClearBitsFromISR( xReturn );
|
||||
|
||||
|
@ -735,7 +735,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
|||
/* For internal use only - execute a 'set bits' command that was pended from
|
||||
* an interrupt. */
|
||||
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
||||
const uint32_t ulBitsToSet )
|
||||
uint32_t ulBitsToSet )
|
||||
{
|
||||
traceENTER_vEventGroupSetBitsCallback( pvEventGroup, ulBitsToSet );
|
||||
|
||||
|
@ -751,7 +751,7 @@ void vEventGroupSetBitsCallback( void * pvEventGroup,
|
|||
/* For internal use only - execute a 'clear bits' command that was pended from
|
||||
* an interrupt. */
|
||||
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
||||
const uint32_t ulBitsToClear )
|
||||
uint32_t ulBitsToClear )
|
||||
{
|
||||
traceENTER_vEventGroupClearBitsCallback( pvEventGroup, ulBitsToClear );
|
||||
|
||||
|
@ -812,7 +812,7 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
|||
traceENTER_xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken );
|
||||
|
||||
traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet );
|
||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */
|
||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken );
|
||||
|
||||
traceRETURN_xEventGroupSetBitsFromISR( xReturn );
|
||||
|
||||
|
|
|
@ -807,9 +807,9 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
|||
|
||||
/* For internal use only. */
|
||||
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
||||
const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
||||
const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
||||
uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
|
|
|
@ -1507,10 +1507,17 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
|||
}
|
||||
#else
|
||||
{
|
||||
/* MISRA Ref 11.1.1 [Object type casting] */
|
||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-111 */
|
||||
/* coverity[misra_c_2012_rule_11_1_violation] */
|
||||
( void ) pxSendCompletedCallback;
|
||||
|
||||
/* MISRA Ref 11.1.1 [Object type casting] */
|
||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-111 */
|
||||
/* coverity[misra_c_2012_rule_11_1_violation] */
|
||||
( void ) pxReceiveCompletedCallback;
|
||||
}
|
||||
#endif
|
||||
#endif /* if ( configUSE_SB_COMPLETED_CALLBACK == 1 ) */
|
||||
}
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
|
|
Loading…
Reference in a new issue