From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#27130: c-mode indentation mistreats structs in function arguments Date: Wed, 02 Dec 2020 10:55:26 +0100 Message-ID: <871rg85y7l.fsf@gnus.org> References: <87zh2zaykj.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8650"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Sam Pagenkopf , 27130@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 02 11:24:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkPJ2-00029L-B5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Dec 2020 11:24:16 +0100 Original-Received: from localhost ([::1]:49218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkPJ1-0006hV-Bk for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Dec 2020 05:24:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkOrh-0006Tp-UP for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 04:56:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkOrh-0004Ap-M3; Wed, 02 Dec 2020 04:56:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkOrh-00025q-JF; Wed, 02 Dec 2020 04:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 02 Dec 2020 09:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27130 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: confirmed Original-Received: via spool by 27130-submit@debbugs.gnu.org id=B27130.16069029418007 (code B ref 27130); Wed, 02 Dec 2020 09:56:01 +0000 Original-Received: (at 27130) by debbugs.gnu.org; 2 Dec 2020 09:55:41 +0000 Original-Received: from localhost ([127.0.0.1]:34262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkOrN-000255-3W for submit@debbugs.gnu.org; Wed, 02 Dec 2020 04:55:41 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:58566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkOrJ-00024o-C5 for 27130@debbugs.gnu.org; Wed, 02 Dec 2020 04:55:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OjCMzlvF+Bq9aDydDRX4JgH72wy+xojO+fHy++xOeME=; b=i32GAJnc/QRCT8RvjcmJjEoAnp NGeSILhDtuK4t8wfNLJBlxy9MTWTllwYFJTBbWWuq/mbyvOqTqcbeechahNWj/Cqe1pr9A82DU62P /Z5eLXDOnRmmN7oGqYQm77jMRqsRSzSc+zDl4+6Cg3PYqk3LYFu7api06XX9IpLjqkP4=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkOrA-0004ZZ-8Z; Wed, 02 Dec 2020 10:55:30 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEXp5OKzpqKKeHVS PTv///9X6rKaAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+QMAgklKYtopboAAAGSSURBVDjLbZMLtsMg CETRbgBxA4obaHT/e3sDfpK2j9M0jdeBwRIKhEiNI9OJqBTJnwNAuUHoADP+UZDnyh8gKGUqW1G+ FMl3tvJRY6Zi/gV8in+DsH7m8lVjg1hiXbs5WY0bhLqyjMofYKUKqfWCzn8AtTau/xQkBsZxFesG quMNgM7hg5I8wRWbAQ+AGlaqBlDQudQFcIMpzjiPUQRZUtIKoC5lsh1SAXBXRLxCQrUA0EZNwTLJ AlXQc0hpDBgj3y72SSpFVNjAFUhPgFbp6qAracfjXAbIVdMGQ+b+jgvZsM2AzAY5ApinLuJgnLPS 1n3SNNdsQE2BC+m6tX5AWwqYtWGJAJeDtP5o1LT5enVpVzup7shdxgTVgWUh+3r1tEAhq30GyhQz +LFqrq8b8BqzBdpcv4j4U6ELuCLcoLbu4E3TLq3X5AA2EA1M1auOCeirxgY2u/xk+QBbfXQC0JZb 4mcy1d0epsT9LMdNp8KWps8FJG/F7ANgn8nYbu10Yc1f9gO6vxrknoN747COMPEfhaRNUtUweIMA AAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMTItMDJUMDk6Mzc6NDErMDA6MDBEeQz4AAAAJXRFWHRk YXRlOm1vZGlmeQAyMDIwLTEyLTAyVDA5OjM3OjQxKzAwOjAwNSS0RAAAAABJRU5ErkJggg== X-Now-Playing: David Sylvian's _Brilliant Trees_: "Red Guitar" In-Reply-To: (Alan Mackenzie's message of "Mon, 30 Nov 2020 17:04:34 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:194774 Archived-At: Alan Mackenzie writes: > Hello, Lars. > > On Mon, Nov 30, 2020 at 12:11:56 +0100, Lars Ingebrigtsen wrote: >> Sam Pagenkopf writes: > >> > In emacs 25.2.1. > >> > Relevant code: > >> > draw_add(&battle.draw, (Drawn){ >> > .kind = DRAW_RECT, >> > .size = {40,24}, >> > .pos.border = { >> > .align = {ALIGN_LEFT, ALIGN_TOP}, >> > .dist = 3 >> > } >> > } >> > ); > >> > My guess is that it's reading (Drawn){...} as a statement, and the , as >> > the (,) C operator. > >> I'm not sure how this should be indented (as I didn't even know that >> that was valid C). But that does look wrong, in any case. (I've >> confirmed that it indents it the same way in Emacs 28.) > >> Alan? > > That's strange. In my Emacs 28 copy, I get this indentation: > > int main () > { > draw_add(&battle.draw, (Drawn){ > .kind = DRAW_RECT, > .size = {40,24}, > .pos.border = { > .align = {ALIGN_LEFT, ALIGN_TOP}, > .dist = 3 > } > } > ); > } > > , which apart from the closing parenthesis being indented too far, looks > basically OK. I was thinking the next-to-last } was in a somewhat odd place (the one that closes the Drawn), but on the other hand I don't really know where else it should be. On the third hand... int main () { draw_add(&battle.draw, (Drawn) { .kind = DRAW_RECT, .size = {40,24}, .pos.border = { .align = {ALIGN_LEFT, ALIGN_TOP}, .dist = 3 } } ); } Now the end brace looks correct to me. So perhaps it should be indented the same way in the original case? That is: int main () { draw_add(&battle.draw, (Drawn) { .kind = DRAW_RECT, .size = {40,24}, .pos.border = { .align = {ALIGN_LEFT, ALIGN_TOP}, .dist = 3 } } ); } I'm talking about the braces only -- as you point out, the end parenthesis is a different matter. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no