From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie 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: <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 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: 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) id 1hFIq5-0007rx-T4; Sat, 13 Apr 2019 09:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" 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: 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 ) 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 ) 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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157583 Archived-At: 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))) > >