From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: C99 compound literals in c-mode Date: Tue, 15 Aug 2017 11:57:17 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1502791174 16433 195.159.176.226 (15 Aug 2017 09:59:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 Aug 2017 09:59:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 15 11:59:31 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhYdG-0003tN-Vo for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 11:59:31 +0200 Original-Received: from localhost ([::1]:49722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhYdM-0000QA-0i for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 05:59:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhYbY-0007kg-BL for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:57:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhYbU-00073N-C8 for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:57:44 -0400 Original-Received: from [195.159.176.226] (port=47960 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhYbU-000732-5W for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:57:40 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dhYbH-0005yZ-9U for emacs-devel@gnu.org; Tue, 15 Aug 2017 11:57:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:uDfmJLe9nRGgj4M6xgnYJbLpl5Q= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217566 Archived-At: On Tue, Aug 15 2017, Stefan Monnier wrote: >> C-mode doesn’t seem to understand C99’s compound literals, resulting in >> rather broken indentation. Is this correct and, if so, how difficult would >> it be to add support for it? > > Could you show some example problematic code? I think code like this: int foo (void) { return (struct bar) { .f1 = 10, .f2 = 20, }; } should be indented better. Maybe so: return (struct bar) { .f1 = 10, .f2 = 20, }; There are also strange interactions with declarations, eg. adding a a declaration before the return changes the indentation to: int foo (void) { int i = 1; return (struct bar) { .f1 = 10, .f2 = 20, }; } Helmut