FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2007 Threads] Nested extern declaration - extern or auto ?Posted by Srdan Suka on June 19, 2007 Hi,
I am using WinARM (GCC 4.1.2) to compile project with FreeRTOS for LPC2138 (GCC_ARM7). GNU C standard compiler is gnu99 which doesn't allow nested functions (link below).
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Nested-Functions.html#Nested-Functions
There are several warnings about nested function definitions (see below).
pxCurrentTCB and ulCriticalNesting are declared as extern volatile... (extern volatile void * volatile pxCurrentTCB; extern volatile unsigned portLONG ulCriticalNesting;)
"A nested function always has no linkage. Declaring one with extern or static is erroneous. If you need to declare the nested function before its definition, use auto (which is otherwise meaningless for function declarations)." (from http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Nested-Functions.html#Nested-Functions)
Could this be a fix for this warnings or they are harmless?
Thanks,
Srdan Suka
-------- begin (mode: RUN_FROM_ROM) -------- arm-elf-gcc (GCC) 4.1.2 (WinARM 4/2007) Copyright (C) 2006 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.
Assembling (ARM-only): boot.S arm-elf-gcc -c -mcpu=arm7tdmi-s -mthumb-interwork -I. -x assembler-with-cpp -DRUN_FROM_ROM -D__WinARM__ -Wa,-adhlns=boot.lst,--gdwarf-2 boot.S -o boot.o
Compiling C (ARM-only): FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c arm-elf-gcc -c -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2 -DRUN_FROM_ROM -DGCC_ARM7 -D__WinARM__ -D THUMB_INTERWORK -Os -Wall -Wextra -Wcast-align -Wimplicit -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wbad-function-cast -Wsign-compare -Waggregate-return -Wa,-adhlns=FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.lst -I./FreeRTOS/Source/include -I./FreeRTOS/Source/portable/GCC/ARM7_LPC2000 -I./FreeRTOS/Common/include -Wcast-qual -MD -MP -MF .dep/portISR.o.d -Wnested-externs -std=gnu99 -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c -o FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.o FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c: In function 'vPortISRStartFirstTask': FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:92: warning: nested extern declaration of 'pxCurrentTCB' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:92: warning: nested extern declaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:92: warning: redundant redeclaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:74: warning: previous definition of 'ulCriticalNesting' was here FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c: In function 'vPortYieldProcessor': FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:112: warning: nested extern declaration of 'pxCurrentTCB' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:112: warning: redundant redeclaration of 'pxCurrentTCB' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:92: warning: previous declaration of 'pxCurrentTCB' was here FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:112: warning: nested extern declaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:112: warning: redundant redeclaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:74: warning: previous definition of 'ulCriticalNesting' was here FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:118: warning: nested extern declaration of 'pxCurrentTCB' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:118: warning: redundant redeclaration of 'pxCurrentTCB' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:112: warning: previous declaration of 'pxCurrentTCB' was here FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:118: warning: nested extern declaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:118: warning: redundant redeclaration of 'ulCriticalNesting' FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portISR.c:74: warning: previous definition of 'ulCriticalNesting' was here
..............................
RE: Nested extern declaration - extern or auto ?Posted by Richard on June 19, 2007 These are not warnings about nested functions - FreeRTOS.org does not have any nested functions. The code compiles with dozens of compilers so there is no way nested functions could ever be included.
They are warnings about variables being declared extern when they are in already in scope. This is completely harmless and the warning can be ignored. I am curious as to why you see them though as I have not seem them before (that I remember).
The warning cannot be avoided by changing the code, as the macros in which the extern declarations appear are called from places where the variables ulCriricalNesting and pxCurrentTCB are indeed out of scope.
Do you get the warnings when compiling an unmodified GCC project from the FreeRTOS.org download?
Regards.
RE: Nested extern declaration - extern or autPosted by Srdan Suka on June 20, 2007 The project is from Martin Thomas (http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/#FreeRTOS_MCB2130)
port from lpc2106 to 2138.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|