From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12222 invoked by alias); 29 Jul 2004 09:43:03 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12213 invoked by uid 48); 29 Jul 2004 09:43:03 -0000 Date: Thu, 29 Jul 2004 09:43:00 -0000 Message-ID: <20040729094303.12212.qmail@sourceware.org> From: "brendan at zen dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20020820073602.7652.ac131313@redhat.com> References: <20020820073602.7652.ac131313@redhat.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/7652] -Wswitch-break : Warn if a switch case falls through X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg03463.txt.bz2 List-Id: ------- Additional Comments From brendan at zen dot org 2004-07-29 09:43 ------- An alternative between "warn about all fall-throughs" and "never do it" would be quite useful. If you have case 0: case 1: foo(); default: bar(); gcc could warn only on the 'case 1' line, since it will see that there are statements between it and the default beneath it without a 'break' intervening. The fact that 'case 0' falls into 'case 1' won't be warned, since there are no actions between them. Most of the time, users will have a good reason to do multiple cases, but less often will someone want case 0: bar(i); case 1: foo(i); break; For those instances, they'll probably not be using -Wswitch-break (defaulting to off) anyway. At any rate, it'll much more common to make the mistake of omitting the break, compared to coding it to have statements between cases without 'break'. My opinion, anyway. B -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652