GNU bug report logs - #34594
cc-mode needs to support "final" in C++ classes

Previous Next

Packages: emacs, cc-mode;

Reported by: "Daniel Colascione" <dancol <at> dancol.org>

Date: Wed, 20 Feb 2019 18:49:02 UTC

Severity: minor

Tags: confirmed

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: 34594 <at> debbugs.gnu.org
Subject: bug#34594: cc-mode needs to support "final" in C++ classes
Date: Sat, 13 Apr 2019 13:36:45 +0000
Hello, Daniel.

I've fixed this in master, pretty much as you suggested.

Feel free to try out the fix, and to tell me it isn't quite working.
;-)

-- 
Alan Mackenzie (Nuremberg, Germany).


On Fri, Apr 12, 2019 at 19:54:36 -0700, Daniel Colascione wrote:
> + Alan

> On 2/20/19 11:34 AM, Daniel Colascione wrote:
> >> Consider this:
> >>
> >> 1 struct QueryCache final : BasePyObject, SupportsGcClear,
> >> 2                           HasDict, SupportsWeakRefs
> >>
> >> Without the "final", line 2 is classified as inher-cont.  With the
> >> "final", it gets topmost-intro-cont and wrong indentation.
> > 
> > Proposed fix:
> > 
> > diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
> > index b4c12896f3..121888d825 100644
> > --- a/lisp/progmodes/cc-engine.el
> > +++ b/lisp/progmodes/cc-engine.el
> > @@ -12268,6 +12268,9 @@ c-guess-basic-syntax
> >   			(if (eq (char-after) ?<)
> >   			    (zerop (c-forward-token-2 1 t indent-point))
> >   			  t)
> > +			(if (looking-at "final\\>[^_]")
> > +			    (c-forward-token-2 1 nil indent-point)
> > +			  t)
> >   			(eq (char-after) ?:))))
> >   	    (goto-char placeholder)
> >   	    (c-add-syntax 'inher-cont (c-point 'boi)))
> > 




This bug report was last modified 6 years and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.