# Unused function warnings

**URL:** <https://forums.freertos.org/t/unused-function-warnings/15188>\
**Category:** Kernel\
**Created:** [May 30, 2022, 1:38pm UTC](https://forums.freertos.org/t/unused-function-warnings/15188 "2022-05-30T13:38:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eyal](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Eyal](https://forums.freertos.org/u/Eyal)\
**Post date:** [May 30, 2022, 1:38pm UTC](https://forums.freertos.org/t/unused-function-warnings/15188/1 "2022-05-30T13:38:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [May 30, 2022, 3:54pm UTC](https://forums.freertos.org/t/unused-function-warnings/15188/2 "2022-05-30T15:54:07Z")

</div>

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):

```auto
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](https://forums.freertos.org/uploads/short-url/fMixu5qKe9tKCNG5pbdWPvPbZ4l.h) (21.5 KB)

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [May 31, 2022, 4:31am UTC](https://forums.freertos.org/t/unused-function-warnings/15188/3 "2022-05-31T04:31:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Eyal](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Eyal](https://forums.freertos.org/u/Eyal)\
**Post date:** [May 31, 2022, 7:03am UTC](https://forums.freertos.org/t/unused-function-warnings/15188/4 "2022-05-31T07:03:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [May 31, 2022, 2:08pm UTC](https://forums.freertos.org/t/unused-function-warnings/15188/5 "2022-05-31T14:08:28Z")

</div>

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.
