Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists