From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Benjamin Moody Newsgroups: gmane.emacs.bugs Subject: bug#4289: 23.1; Incorrect indentation in C, following certain 'case' labels Date: Sat, 29 Aug 2009 16:59:54 -0400 Message-ID: <87eiqupc8l.fsf@bigdeer.rsh.net> Reply-To: Benjamin Moody , 4289@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1251613885 14873 80.91.229.12 (30 Aug 2009 06:31:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Aug 2009 06:31:25 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 30 08:31:18 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mhdwb-0000pt-QO for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Aug 2009 08:31:18 +0200 Original-Received: from localhost ([127.0.0.1]:48765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mhdwa-0000tH-QZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Aug 2009 02:31:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhV8Z-0000vM-SO for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:07:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhV8U-0000u6-Sq for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:07:03 -0400 Original-Received: from [199.232.76.173] (port=36339 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhV8U-0000u3-FB for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:06:58 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:45999) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MhV8T-0003ia-QZ for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:06:58 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7TL6skN021423; Sat, 29 Aug 2009 14:06:55 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n7TL56Z0020282; Sat, 29 Aug 2009 14:05:06 -0700 Resent-Date: Sat, 29 Aug 2009 14:05:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Benjamin Moody Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sat, 29 Aug 2009 21:05:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4289 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125157961018659 (code B ref -1); Sat, 29 Aug 2009 21:05:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 29 Aug 2009 21:00:10 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7TL08fY018615 for ; Sat, 29 Aug 2009 14:00:09 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhV1s-0001FD-Fo for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:00:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhV1n-0001EB-NL for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:00:08 -0400 Original-Received: from [199.232.76.173] (port=34540 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhV1n-0001E8-Kp for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:00:03 -0400 Original-Received: from qw-out-1920.google.com ([74.125.92.149]:58348) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MhV1n-0002oZ-1G for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 17:00:03 -0400 Original-Received: by qw-out-1920.google.com with SMTP id 5so1043446qwf.24 for ; Sat, 29 Aug 2009 14:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:message-id:from :to:subject; bh=DtS9U9tS7IeDf47bdZy7T0m3ZYsVqDx+lgx++8YSFUQ=; b=ilSBSpI4dRBeUCisy/E22g0EeGktsw8lmTN/AhqeEKnFeU9CoYgT383PrCJy825dRA 6m1WEDyjlZ3w4otwOYuHm1T+DXNJIuPqgv1HZfQvk+dvCUb1QtvgMYcHmL4co6wea/Nc iL69BKGDLpuCRPLxR3x0UwxXhOv2y9y6XY4LY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:message-id:from:to:subject; b=LMhtVSL84b/BZoQpOePe7aU7J6qJrbcwMJMwtoZ+7D7moNaF+lsn7wYjHf0KaHoERC GexPI9iKfk+3V6osbL9ZrBk9Aei3ei6xmoIm2/cyCGKor7dwKHGD//4V30W3/OsbAQZe h+0/5DMnK9FfBYQsneVufvSUmhopSxX1jFu/8= Original-Received: by 10.224.14.143 with SMTP id g15mr2210203qaa.123.1251579600568; Sat, 29 Aug 2009 14:00:00 -0700 (PDT) Original-Received: from bigdeer.rsh.net (c-24-60-162-5.hsd1.ma.comcast.net [24.60.162.5]) by mx.google.com with ESMTPS id 6sm4212299qwd.2.2009.08.29.13.59.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 29 Aug 2009 13:59:59 -0700 (PDT) Original-Received: from localhost ([127.0.0.1] helo=bigdeer.rsh.net ident=benjamin) by bigdeer.rsh.net with esmtp (Exim 4.69) (envelope-from ) id 1MhV1f-0007w0-84 for bug-gnu-emacs@gnu.org; Sat, 29 Aug 2009 16:59:55 -0400 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sat, 29 Aug 2009 17:07:03 -0400 X-Mailman-Approved-At: Sun, 30 Aug 2009 02:31:10 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30658 Archived-At: In Emacs 23.1, I've found an issue with the indentation rules for C mode. In some circumstances, following a series of multiple labels, the second and subsequent statements are not indented properly. For example, in the following code: void foo(int x) { switch (x) { case 1: case 2: printf("aaa"); break; case '3': case '4': printf("bbb"); break; } } the second 'break' statement should be indented by 4 spaces, to align with the 'printf'. This problem seems to appear when there are multiple labels (either normal named labels, 'case' labels, or 'default' labels) in a row, with no intervening statments, and either the first or the last such label is a 'case' label with a character constant as its value. This problem does NOT occur with Emacs 22.3. It does occur in C++ and ObjC modes as well. It affects indentation using either TAB or M-x indent-region. A workaround is to place the character constant(s) in parentheses. This is obviously not a serious problem, but it is a somewhat annoying one which would be nice to see fixed. Benjamin Moody In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2009-08-03 on nautilus, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10402000 configured using `configure '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: C/l Minor modes in effect: iswitchb-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t abbrev-mode: t Recent input: C-x C-f / t m p / t e s t . c v o i d SPC f o o ( i n t SPC x ) { s w i t c h SPC ( x ) SPC { c a s d e e 1 SPC SPC 1 : c a s e SPC 2 : p r i n t f ( " a a a " ) ; b r e a k ; c a s e SPC ' 3 ' : c a s e SPC ' 4 ' : p r i n t f ( " b b b " ) ; b r e a k j ; ; } } M-x r e p o r t - e m a Recent messages: Setting up ede... Loading `eieio': old-style backquotes detected! Setting up ede...done Setting up eieio...done Setting up semantic...done Setting up speedbar...done Setting up cedet-contrib...done Loading /etc/emacs/site-start.d/55ecb.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. (New file)