[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Warning if no break between two case ?
From: |
Peter Lund |
Subject: |
Re: [Tinycc-devel] Warning if no break between two case ? |
Date: |
Sun, 07 Oct 2007 18:47:55 +0200 |
On Sat, 2007-10-06 at 17:37 +0800, ShangHongzhang 62185 wrote:
> How to output a warning if there is no any 'break' statement between two
> 'case' statements?
>
> for example:
>
> switch (a)
> {
> case 1:
> ... // there is no break, I want TCC to show some warning in this case
> case 2:
> ...
> break;
> }
>
> So, what could I do to achieve this?
You often don't want a warning.
It is also hard work to create a warning isn't too trigger-happy.
Consider:
switch (a) {
case 1:
if (a)
return 8;
else
return 9;
case 2:
xx();
do {
...
if (...)
goto common;
...
} while (1);
case 3:
...
longjmp(...);
case 4:
...
}
-Peter