From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Alan Mackenzie <acm@muc.de>
Newsgroups: gmane.emacs.bugs
Subject: bug#34594: cc-mode needs to support "final" in C++ classes
Date: Sat, 13 Apr 2019 13:36:45 +0000
Message-ID: <20190413133645.GB13636@ACM>
References: <bddcd0f6ba238510a0fecbb63ef3bce5.squirrel@dancol.org>
	<b5cedc33f9814f598ca543f59d44e045.squirrel@dancol.org>
	<40982e49-bc1e-5164-bfc7-428860ce6391@dancol.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="85153"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Mutt/1.10.1 (2018-07-13)
Cc: 34594@debbugs.gnu.org
To: Daniel Colascione <dancol@dancol.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 13 15:37:14 2019
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256)
	(Exim 4.89)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1hFIqG-000Lyi-KQ
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 15:37:12 +0200
Original-Received: from localhost ([127.0.0.1]:51913 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1hFIqF-0001QM-E6
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 09:37:11 -0400
Original-Received: from eggs.gnu.org ([209.51.188.92]:58704)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hFIq7-0001QG-64
	for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 09:37:04 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hFIq6-00019r-91
	for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 09:37:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:44815)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1hFIq6-00019j-3I; Sat, 13 Apr 2019 09:37:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1hFIq5-0007rx-T4; Sat, 13 Apr 2019 09:37:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Alan Mackenzie <acm@muc.de>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org
Resent-Date: Sat, 13 Apr 2019 13:37:01 +0000
Resent-Message-ID: <handler.34594.B34594.155516261130229@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 34594
X-GNU-PR-Package: emacs,cc-mode
X-GNU-PR-Keywords: confirmed
Original-Received: via spool by 34594-submit@debbugs.gnu.org id=B34594.155516261130229
	(code B ref 34594); Sat, 13 Apr 2019 13:37:01 +0000
Original-Received: (at 34594) by debbugs.gnu.org; 13 Apr 2019 13:36:51 +0000
Original-Received: from localhost ([127.0.0.1]:58359 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1hFIpv-0007rV-0E
	for submit@debbugs.gnu.org; Sat, 13 Apr 2019 09:36:51 -0400
Original-Received: from colin.muc.de ([193.149.48.1]:56199 helo=mail.muc.de)
	by debbugs.gnu.org with smtp (Exim 4.84_2)
	(envelope-from <acm@muc.de>) id 1hFIpt-0007rK-5P
	for 34594@debbugs.gnu.org; Sat, 13 Apr 2019 09:36:49 -0400
Original-Received: (qmail 60228 invoked by uid 3782); 13 Apr 2019 13:36:46 -0000
Original-Received: from acm.muc.de (p2E5D5F4C.dip0.t-ipconnect.de [46.93.95.76]) by
	colin.muc.de (tmda-ofmipd) with ESMTP;
	Sat, 13 Apr 2019 15:36:45 +0200
Original-Received: (qmail 25232 invoked by uid 1000); 13 Apr 2019 13:36:45 -0000
Content-Disposition: inline
In-Reply-To: <40982e49-bc1e-5164-bfc7-428860ce6391@dancol.org>
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
X-Primary-Address: acm@muc.de
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 209.51.188.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:157583
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/157583>

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)))
> >