Should prvWriteNameToBuffer() be enabled under static allocation?

In tasks.c, is declared and defined with the following compile-time conditionals:

#if ((configUSE_TRACE_FACILITY == 1) && (configUSE_STATS_FORMATTING_FUNCTIONS > 0))
static char *prvWriteNameToBuffer(char *pcBuffer, const char *pcTaskName) PRIVILEGED_FUNCTION;
#endif

… but it is CALLED with the following compile-time switches:

#if ((configUSE_TRACE_FACILITY == 1) && (configUSE_STATS_FORMATTING_FUNCTIONS > 0)                                     \
     && (configSUPPORT_DYNAMIC_ALLOCATION == 1))
void vTaskList(char *pcWriteBuffer) {
  ...
  pcWriteBuffer = prvWriteNameToBuffer(pcWriteBuffer, pxTaskStatusArray[x].pcTaskName);

  ...
}
#endif

This means you’ll get a compile time warning:

Severity	Code	Description	Project	File	Line
Error		'prvWriteNameToBuffer' defined but not used [-Werror=unused-function]	...FreeRTOSV10.0.0\Source\tasks.c	3791

Consequently, if you run with warnings == errors, your compile will fail if configSUPPORT_DYNAMIC_ALLOCATION == 0.

Seems like a bug. Or am I confused?

There are a couple of functions that call prvWriteNameToBuffer(), one requires the following config file settings:

#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )

…and the other

#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )

So it does indeed look like prvWriteNameToBuffer() is only used when configSUPPORT_DYNAMIC_ALLOCATION is 1.

Grateful if you could create a PR to change this.

Gladly. One question: the github FreeRTOS top level shows sources at branch a4b2ae3:

https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/a4b28e35103d699edf074dfff4835921b481b301

Should I base the PR on that, or from the main branch:

https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/main

(or does it matter)? Thanks…

Hmm. Should be at the tip of main.

That makes sense – I’ll use main.