- Operating system: Windows 10
- IDE name and flavor/env: VSCode 1.8.7
I am using SonarLint on VSCode. We use this for our esp-idf projects writing code in C language. I have noticed weird warning when declaring a FreeRTOS task and made a post about it on the ESP32 forums:
After some discussion, it has been suggested that this is a false warning. I have also found another similar instance of this warning:
https://community.sonarsource.com/t/wro … st/58181/3
My full code is as following:
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#define UNUSED(x) (void)(x)
static void HELLO_TASK(void *param);
void app_main(void)
{
printf("Hello world!\n");
// Create hello world task
xTaskCreate(&HELLO_TASK, "HELLO_TASK", 4096, NULL, 3, NULL);
}
static void HELLO_TASK(void *param)
{
UNUSED(param);
for (;;)
{
printf("This is normal message1 without ANSI color code \n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
And it shows up 1 warning:
Make the type of this parameter a pointer-to-const. The current type of "param" is "void *".
But that does not seem correct. Why would I need to to make it const void *param? Is that a valid warning?