emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C99 compound literals in c-mode


From: Alan Mackenzie
Subject: Re: C99 compound literals in c-mode
Date: Thu, 24 Aug 2017 16:37:16 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Nikolai.

On Wed, Aug 23, 2017 at 12:01:34 +0200, Nikolai Weibull wrote:
> On Sun, Aug 20, 2017 at 10:40 PM, Alan Mackenzie <address@hidden> wrote:
> > Hello, Nikolai.

> > On Tue, Aug 15, 2017 at 11:57:25 +0200, Nikolai Weibull wrote:

> >> struct a {
> >>         int b;
> >> };

> > This seems to be correctly analysed and indented by CC Mode.  You can
> > see this by doing C-c C-s on any line to get the syntactic analysis.
> > On the middle line, this shows ((inclass 332) (topmost-intro 332))
> > (where the "332" may vary, depending on the position in the file).
> > The "inclass" bit causes an indentation of c-basic-offset (here 8)
> > columns.

> > What indentation do you want here?

> Sorry, this was just there to give a complete example, it indents
> correctly as is.

OK.

> >> int
> >> main(void)
> >> {
> >>         return (struct a){
> >>                 0
> >>                         }.b;
> >> }

> > Here, the "0" line is being wrongly analysed as a
> > statement-block-intro, when it should be a brace-list-intro.  The
> > problem is that brace lists are recognised only by their context in
> > the source code, rather than their internal structure.  When a brace
> > list can appear virtually anywhere, this doesn't make sense.

> > The following patch causes brace lists to be recognised by their
> > internal structure too.  Would you please apply it to CC Mode (in
> > directory .../lisp/progmodes), try it out, and let me know how well it
> > solves the problems with compound literals.

> This seems to be a patch for a newer version of CC Mode than that
> installed with my Emacs (25.2.1 via MacPorts).  The function
> c-looking-at-statement-block isn’t even defined.

Apologies, I didn't read your original post properly.  There have indeed
been quite a few changes to CC Mode since the code freeze for Emacs 25.2.

Would it be OK if I sent you a tarball (format .tar.gz) of the up to date
CC Mode sources (including this patch)?  The total size is around 440 kB.

>   Nikolai

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]