Skip to content

tasks: fully initialize xYieldPendings for MISRA 9.3 - #1498

Open
20000419 wants to merge 1 commit into
FreeRTOS:mainfrom
20000419:fix/xyieldpendings-misra-9.3
Open

20000419 wants to merge 1 commit into
FreeRTOS:mainfrom
20000419:fix/xyieldpendings-misra-9.3

Conversation

@20000419

Copy link
Copy Markdown

Description

With configNUMBER_OF_CORES > 1, tasks.c initializes
xYieldPendings[ configNUMBER_OF_CORES ] as { pdFALSE }. Only the
first element is named, which breaks MISRA C:2012 Rule 9.3 (arrays
shall not be partially initialized).

Switch the initializer to { 0 }, same pattern as the MPU object-pool
fix in #973. pdFALSE is ((BaseType_t) 0) in projdefs.h, so every
core still starts clear — no behavior change.

Test Steps

Confirm the initializer in tasks.c and that pdFALSE is 0 in
projdefs.h. Startup on an SMP build is enough to show the array is
still usable.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • [N/A] I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Fixes #1491

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

With configNUMBER_OF_CORES > 1, = { pdFALSE } only names the first
element and leaves the rest implicitly zero (Rule 9.3). Use = { 0 }
like the MPU object pool fix in FreeRTOS#973. Same value: pdFALSE is 0.

Fixes FreeRTOS#1491

Signed-off-by: 20000419 <lzy20000419@outlook.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MISRA C 2012 Rule 9.3 violation in SMP configuration: xYieldPendings is partially initialized

1 participant