Hello!
I am getting the following warning from my static analyzer:
warning 633: strong type mismatch: extracting 'uint8_t' into 'UBaseType_t' in context 'call'
xSemaphoreCreateBinary();
The reason is that in semphr.h the macro is defined as:
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U )
...
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
But the function declaration is:
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength,
const UBaseType_t uxItemSize,
const uint8_t ucQueueType )
So the second argument (semSEMAPHORE_QUEUE_ITEM_LENGTH) is of type uint8_t, but the function expects UBaseType_t.
This causes a type mismatch warning when the macro is used.
Suggestion:
Please consider changing the definition of semSEMAPHORE_QUEUE_ITEM_LENGTH to use UBaseType_t instead of uint8_t, like this:
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( UBaseType_t ) 0U )
This will avoid the warning and make the types consistent.
Thank you!