avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Help, Compiler ignores some part of the function!


From: Nigel Winterbottom
Subject: RE: [avr-gcc-list] Help, Compiler ignores some part of the function!
Date: Sat, 3 Dec 2005 21:30:43 -0000

> On Sat, 3 Dec 2005 21:16, MuRaT KaRaDeNiZ wrote:
> > I'm compiling with -Wall, but no warning appears for the
> local variable
> > "controller", that it is not utilized properly.
>
> Yeah, it won't warn you about those sort of problems alas.
>


Oh yes it will,  but you have to add the specific warning

-Wunreachable-code

I had to perform much hacking of your code sample to get it to compile.
When you enable the above warning you'll receive the following compiler
messages:

avr-gcc -c -mmcu=atmega32 -gdwarf-2 -Os -funsigned-char -funsigned-bitfields
 -fpack-struct -fshort-enums -fno-loop-optimize -mcall-prologues -Wall -Wstr
ict-prototypes -Wunreachable-code -Wno-char-subscripts -Wsign-compare -W -Wa
,-adhlns=murat.lst  -std=gnu99 -MD -MP -MF .dep/murat.o.d murat.c -o

murat.c:14: warning: function declaration isn't a prototype
murat.c: In function `ProcessPID_Vertical':
murat.c:69: warning: will never be executed

Line 69 is, of course: controller = (int)
 p1*error*PTERM_AMPLIFICATION_MAGNITUDE_V ...

Nigel Winterbottom






reply via email to

[Prev in Thread] Current Thread [Next in Thread]