ssuka wrote on Tuesday, 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
…