Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Version 8.1.1, build defect at tasks.c

Posted by jkovacic on August 30, 2014

I just tried to port the new version 8.1.1 to my hobby project.

I use the toolchain Sourcery CodeBench Lite Edition for ARM EABI (GCC based, for ARM), my compiler settings are very strict (each warning is treated as an error) and it returns the following error when compiling tasks.c:

~~~~~~ arm-none-eabi-gcc -c -mcpu=arm926ej-s -Wall -Wextra -Werror -IFreeRTOS/Source/include/ -IDemo/ -IFreeRTOS/Source/portable/GCC/ARM926EJ-S/ FreeRTOS/Source/tasks.c -o obj/tasks.o FreeRTOS/Source/tasks.c: In function 'pvTaskIncrementMutexHeldCount': FreeRTOS/Source/tasks.c:3604:1: error: control reaches end of non-void function [-Werror=return-type] cc1: all warnings being treated as errors ~~~~~~

In other words, when configUSE_MUTEXES is not set, the function pvTaskIncrementMutexHeldCount does not return anzthing although it is declared to return a void* casted pointer.

My temporary workaround is to return NULL in such cases (as implemented here). Anyway, I would like to hear what is supposed to be returned at such an occasion (maybe pxCurrentTCB?) so that I can fix it ASAP.

BTW, how come, this wasn't detected by compilers that support MISRA standards?


Version 8.1.1, build defect at tasks.c

Posted by davedoors on August 30, 2014

Probably because when configUSE_MUTEXES is not set pvTaskIncrementMutexHeldCount() is never called and there is no path to it for the checker. Because of that it is not actually possible for control to reach the end of the function without returning something because the function is not called and in most cases the symbol will not be in the binary.

All the same, something should be done to remove the warning.


Version 8.1.1, build defect at tasks.c

Posted by richard_damon on August 30, 2014

If pvTaskIncrementMutexCount() is never called if configUSEMUTEXES is not defined, then pvTaskIncrementMutexCount itself should not be defined if configUSEMUTEXES is not defined.


Version 8.1.1, build defect at tasks.c

Posted by rtel on August 30, 2014

Probably because when configUSE_MUTEXES is not set pvTaskIncrementMutexHeldCount() is never called and there is no path to it for the checker

Actually a simpler reason than that - the checking is done with all options turned on so it views the code without the conditional compilation.

If pvTaskIncrementMutexCount() is never called if configUSEMUTEXES is not defined, then pvTaskIncrementMutexCount itself should not be defined if configUSEMUTEXES is not defined.

I think in the original 8.1.0 implementation there was a reason why that was not done, but I would agree with you now.

The change to completely compile out the pvTaskIncrementMutexHeldCount() function when configUSE_MUTEXES is not defined will not change the behaviour of the code at all, and will not change anybodies binaries built from the code. That considered, plus the fact that 8.1.1 has only just been uploaded during the weekend and not announced, I will simply overwrite the 8.1.1 zip file in SourceForge with the version that does not generate the warning.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS