Unused function warnings

Hello.
When I try to build FreeRTOS v10.4.1 for ARM CM3, the “portmacro.h” file under “Source/portable/GCC/ARM_CM3” contains definitions of some static inline functions:
xPortIsInsideInterrupt
vPortRaiseBASEPRI
ulPortRaiseBASEPRI
vPortSetBASEPRI
Since this file is included by many files (including kernel files, e.g. queue.c, tasks.c, timers.c ) which are not using some or all of these funcions, I receive the “defined but not used [-Wunused-function]” compilation warning.
(I also receive the “always_inline function might not be inlinable [-Wattributes]” due to the definition of:
#define portFORCE_INLINE inline attribute( ( always_inline ) ) ).

How can I overcome these problems to receive a warning free compilation?

Thanks,
Eyal.

We aim to have no compiler warnings with the -Wall -Wextra command line options. I’m not sure if they already include the -Wattributes and -Wunused-function options, so I added those two options manually, and didn’t receive these compiler warnings. The attached shows the build output when using the following compiler version (it only has a .h extension so I can attach it to this post - it’s not actually a header file):

C:\Temp\FreeRTOS_clean\FreeRTOS\Demo\CORTEX_MPS2_QEMU_IAR_GCC\build\gcc>arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

compiler-output.h (21.5 KB)

As Richard did not get any of these warnings with arm-none-eabi-gcc, would you tell us which compiler and version are you using?

Hi all & thanks.
I’m using the following compiler:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150303 (release) [ARM/embedded-4_9-branch revision 221220]
And by the way the FreeRTOS co I’m using:

  • e74a3a4c2 2020-09-18 | Update kernel version string to 10.4.1 (HEAD, tag: V10.4.1) [David Chalco]

Please note that I received the unused-function warning also with the following compiler:
arm-linux-gnueabi-gcc (GNU Toolchain for the A-profile Architecture 8.2-2018-08 (arm-rel-8.23)) 8.2.1 20180802

I would recommend updating to a modern compiler version, you will probably get many benefits. If you still get warnings then please also post the command line you are using.