Type pointer targets in passing argument 3 of 'xTaskNotifyWait' differ in signedness [-Wpointer-sign]

The compiler throws the above warning when an integer value is passed to xTaskNotifyWait. The prototype for xTaskNotifyWait() is BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) and the third argument is an int32_t pointer. I did understand what’s wrong with my code. It’s been days since I have been struggling with this code and I need some serious help.

void led_task(void *params) {
 
    int32_t count_led = 0;
 
    while(1) {
 
        if(xTaskNotifyWait(0, 0, &count_led, portMAX_DELAY) != pdFALSE) {      
 
            GPIO_ToggleBits(GPIOB, GPIO_Pin_0);
            sprintf(msg1, "Count:%ld\r\n", count_led);
            print_msg(msg1);
 
        }
    }
 
}

BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait )

Take a careful look at the above xTaskNotifyWait() prototype, the third argument is expecting a uint32_t address, not an int32_t. There is a difference in signedness between uint32_t and int32_t (unsigned vs unsigned).

1 Like

Thanks for correcting me. That was a silly mistake on my part. But I have changed the int32_t variable to uint32_t but still, the error persists.

void led_task(void *params) {
 
    uint32_t count_led = 0;
 
    while(1) {
 
        if(xTaskNotifyWait(0, 0, &count_led, portMAX_DELAY) != pdFALSE) {      
 
            GPIO_ToggleBits(GPIOB, GPIO_Pin_0);
            sprintf(msg1, "Count:%ld\r\n", count_led);
            print_msg(msg1);
 
        }
    }
}

Any reason?

Clean the project and rebuild the project once again.

Thank you bro. The code compiling fine. No warnings now.