From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: "Daniel Colascione" <dancol@dancol.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#34594: cc-mode needs to support "final" in C++ classes
Date: Wed, 20 Feb 2019 11:34:21 -0800
Message-ID: <b5cedc33f9814f598ca543f59d44e045.squirrel@dancol.org>
References: <bddcd0f6ba238510a0fecbb63ef3bce5.squirrel@dancol.org>
Mime-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="39728"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: SquirrelMail/1.4.23 [SVN]
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 Wed Feb 20 20:35:16 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 1gwXeD-000A8X-34
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 20:35:14 +0100
Original-Received: from localhost ([127.0.0.1]:47575 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 1gwXeC-0007Hu-30
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Feb 2019 14:35:12 -0500
Original-Received: from eggs.gnu.org ([209.51.188.92]:56178)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gwXe3-0007HJ-Rh
	for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 14:35:04 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gwXe3-0004LO-33
	for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 14:35:03 -0500
Original-Received: from debbugs.gnu.org ([209.51.188.43]:57800)
	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 1gwXe2-0004JA-2J
	for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 14:35:03 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gwXe1-0002Dl-MO
	for bug-gnu-emacs@gnu.org; Wed, 20 Feb 2019 14:35:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: "Daniel Colascione" <dancol@dancol.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 20 Feb 2019 19:35:01 +0000
Resent-Message-ID: <handler.34594.B34594.15506912668491@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 34594
X-GNU-PR-Package: emacs
Original-Received: via spool by 34594-submit@debbugs.gnu.org id=B34594.15506912668491
	(code B ref 34594); Wed, 20 Feb 2019 19:35:01 +0000
Original-Received: (at 34594) by debbugs.gnu.org; 20 Feb 2019 19:34:26 +0000
Original-Received: from localhost ([127.0.0.1]:58566 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1gwXdS-0002Ct-A4
	for submit@debbugs.gnu.org; Wed, 20 Feb 2019 14:34:26 -0500
Original-Received: from dancol.org ([96.126.100.184]:44016)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <dancol@dancol.org>) id 1gwXdO-0002Cj-Nu
	for 34594@debbugs.gnu.org; Wed, 20 Feb 2019 14:34:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; 
	s=x; 
	h=Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:To:From:Subject:Date:References:In-Reply-To:Message-ID;
	bh=qvHigOw+flKsGRCTL+MXF35RulQyT1NhSOSx3Gy10/Y=; 
	b=Gx2MX+VUu37gqRwIvIJXC4Ox65DV3hRpZeQ26YmARHML4X5vNR0eZnCM0KoegP48HCPcwzKMo1VR5wo5eBmy9pqQunmc2hBF5s1ppoHe7XWOWUV6QYIET7ZiNXVzOCW1vM7d4zSPB+FlXdRKX2vjxrhSOJexhUYkcY1rKDRKRh/rWR0XgVAq5P4B20rysch1J+zhF4d2powgpDZm5aBxcQDsd68DwilI+DZYfiEp815mShd4ErX1laIzBrviTAq2K/ymS1WfGnqlGbgwWmLfa/anB2G25t5AmpQn/TO5oWQjVO3hY7Gympm4AdE2K2Li7ZZ5+BDUtAtuMl+UJA4BzA==;
Original-Received: from localhost ([127.0.0.1] helo=dancol.org)
	by dancol.org with esmtp (Exim 4.84_2)
	(envelope-from <dancol@dancol.org>)
	id 1gwXdN-0005lN-1o; Wed, 20 Feb 2019 11:34:21 -0800
Original-Received: from 127.0.0.1 (SquirrelMail authenticated user dancol)
	by dancol.org with HTTP; Wed, 20 Feb 2019 11:34:21 -0800
In-Reply-To: <bddcd0f6ba238510a0fecbb63ef3bce5.squirrel@dancol.org>
X-Priority: 3 (Normal)
Importance: Normal
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:155600
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/155600>

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