[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Feature request - compiler warning for "if" stmts tha
From: |
Dave Hylands |
Subject: |
RE: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing |
Date: |
Mon, 13 Dec 2004 07:20:00 -0800 |
> > A feature I'm requesting is that the compiler generate a warning for
> > control statements that don't do anything.
>
> -Wextra?
>
> According to the man page:
>
> o An empty body occurs in an if or else statement.
>
> I'd assume this to be warned.
Hey - that's pretty close.
It triggers on the original posters original request:
if ( condition );
{
... Do something ...
}
x.c:8: warning: empty body in an if-statement
And doesn't trigger on my example: if (condition);else{...do
something...}
It still doesn't warn about while/for loops that are similar:
while ( conition );
{
... Do something ...
}
And
for (i=0;i<10;i++);
{
... Do something ...
}
So it's definitely a step in the right direction.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/