Fix MISRA_C_2012 rule 8.4 violation (#844)

Fix MISRA_C_2012 rule 8.4 violation
pull/855/head^2
Rahul Kar 1 year ago committed by GitHub
parent 22eb827b3d
commit d1a0202125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,14 +24,15 @@ MISRA C:2012 Rule 8.4: A compatible declaration shall be visible when an
object or function with external linkage is defined.
_Ref 8.4.1_
- This rule requires that a compatible declaration is made available
in a header file when an object with external linkage is defined.
pxCurrentTCB(s) is defined with external linkage but it is only
referenced from the assembly code in the port files. Therefore, adding
a declaration in header file is not useful as the assembly code will
still need to declare it separately.
- pxCurrentTCB(s) is defined with external linkage but it is only referenced
from the assembly code in the port files. Therefore, adding a declaration in
header file is not useful as the assembly code will still need to declare it
separately.
_Ref 8.4.2_
- xQueueRegistry is defined with external linkage because it is accessed by the
kernel unit tests. It is not meant to be directly accessed by the application
and therefore, not declared in a header file.
#### Rule 11.3

@ -165,6 +165,10 @@ typedef xQUEUE Queue_t;
/* The queue registry is simply an array of QueueRegistryItem_t structures.
* The pcQueueName member of a structure being NULL is indicative of the
* array position being vacant. */
/* MISRA Ref 8.4.2 [Declaration shall be visible] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-84 */
/* coverity[misra_c_2012_rule_8_4_violation] */
PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ];
#endif /* configQUEUE_REGISTRY_SIZE */

@ -436,6 +436,9 @@ typedef tskTCB TCB_t;
/*lint -save -e956 A manual analysis and inspection has been used to determine
* which static variables must be declared volatile. */
#if ( configNUMBER_OF_CORES == 1 )
/* MISRA Ref 8.4.1 [Declaration shall be visible] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-84 */
/* coverity[misra_c_2012_rule_8_4_violation] */
portDONT_DISCARD PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL;
#else
/* MISRA Ref 8.4.1 [Declaration shall be visible] */
@ -490,7 +493,7 @@ PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandles[ configNUMBER_OF_CORES ];
/* Improve support for OpenOCD. The kernel tracks Ready tasks via priority lists.
* For tracking the state of remote threads, OpenOCD uses uxTopUsedPriority
* to determine the number of priority lists to read back from the remote target. */
const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U;
static const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U;
/* Context switches are held pending while the scheduler is suspended. Also,
* interrupts must not manipulate the xStateListItem of a TCB, or any of the

Loading…
Cancel
Save