FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.71k stars 1.11k forks source link

Change UBaseType_t to BaseType_t for a boolean variable #1072

Closed kar-rahul-aws closed 4 months ago

kar-rahul-aws commented 4 months ago

Description

MISRA-C 2012 rule 10.4 states that : _Both operands of an operator in which the usual arithmetic conversions are performed shall have the same _essential type category__.

In tasks.c , Line 3937 else if( uxHigherPriorityReadyTasks != pdFALSE )

Where uxHigherPriorityReadyTasks is an unsigned char and pdFALSE is a signed char, thereby violating the rule.

This PR addresses this issue by making the variable xHigherPriorityReadyTasks a signed char.

Test Steps

NA

Checklist:

Related Issue

1066

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

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

htibosch commented 4 months ago

Although this PR is merged and closed, I put in my two cents: within FreeRTOS+TCP and FreeRTOS+FAT we chose BaseType_t as a standard "boolean" value. I most cases, this will be optimised away.

And also we added pdTRUE_SIGNED and pdTRUE_UNSIGNED when a comparison was made with either BaseType_t and UBaseType_t.

I hope that these defines will be adopted by the kernel one day.