From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Calling C++ hackers. Please try out the new handling of C++11 lambda functions in CC Mode. Date: Sun, 21 Aug 2016 12:24:22 +0000 Message-ID: <20160821122422.GA3813@acm.fritz.box> References: <20160815122412.GA4515@acm.fritz.box> <1471643100.1410.3.camel@gmail.com> <20160820151955.GB2529@acm.fritz.box> <1471730790.1410.16.camel@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1471782313 7896 195.159.176.226 (21 Aug 2016 12:25:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 21 Aug 2016 12:25:13 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Matthias Meulien Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 21 14:25:08 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbRoI-0001e0-Uh for ged-emacs-devel@m.gmane.org; Sun, 21 Aug 2016 14:25:07 +0200 Original-Received: from localhost ([::1]:36488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbRoF-0004F0-Ug for ged-emacs-devel@m.gmane.org; Sun, 21 Aug 2016 08:25:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbRo8-0004Eu-K8 for emacs-devel@gnu.org; Sun, 21 Aug 2016 08:24:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbRo4-0001f8-ES for emacs-devel@gnu.org; Sun, 21 Aug 2016 08:24:55 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:23705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbRo4-0001ew-4A for emacs-devel@gnu.org; Sun, 21 Aug 2016 08:24:52 -0400 Original-Received: (qmail 34330 invoked by uid 3782); 21 Aug 2016 12:24:50 -0000 Original-Received: from acm.muc.de (p548C781C.dip0.t-ipconnect.de [84.140.120.28]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 21 Aug 2016 14:24:49 +0200 Original-Received: (qmail 3840 invoked by uid 1000); 21 Aug 2016 12:24:22 -0000 Content-Disposition: inline In-Reply-To: <1471730790.1410.16.camel@gmail.com> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206720 Archived-At: Hello, Matthias. On Sun, Aug 21, 2016 at 12:06:30AM +0200, Matthias Meulien wrote: > > I'm hoping to get C++11 uniform initialisation working sometime in > > the next few days. > Interesting. As I am using this style of initialization now., so I'll > test your work on my code base. Many thanks in advance! > To test your implementation of C++ lambda functions handling, I've had > to build Emacs from a fresh checkout and just realized that it now > handles C++11 keywords like `nullptr' or `override'; Many thanks to > those who are bringing Emacs to modern C++! > By the way, did you experience the same strange behavior of font > locking when the `override' keyword is added to a constructor? I mean > in: > struct foo : public bar { >   foo() {} >   ~foo() override {} >   void do_something() {} > }; > the function name `~foo' is not fontified. It is if the `override' > keyword is removed... Yes. That's something I've not seen before. > Shall I fill a bug report? If you would, yes please. Would you also please try out on your real code the following patch which is intended to fix the problem. Please either confirm that the bug is fixed, or let me know what's still not working properly. Thanks! After applying the patch (in directory .../lisp/progmodes, you will need to recompile all of cc-*.el, since changes have been made in low level macros. Please send me a private mail if you want any help with the patching or recompilation. diff -r f6121546a9bc cc-engine.el --- a/cc-engine.el Sat Aug 20 20:40:26 2016 +0000 +++ b/cc-engine.el Sun Aug 21 12:04:18 2016 +0000 @@ -7266,6 +7266,12 @@ (goto-char (match-end 1)) (c-forward-syntactic-ws))) + ;; Skip any "WS" identifiers (e.g. "final" or "override" in C++) + (while (looking-at c-type-decl-suffix-ws-ids-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws) + (setq res t)) + (when c-opt-type-concat-key ; Only/mainly for pike. ;; Look for a trailing operator that concatenates the type ;; with a following one, and if so step past that one through @@ -8140,6 +8146,11 @@ (setq type-start (point)) (setq at-type (c-forward-type)))) + ;; Move forward over any "WS" ids (like "final" or "override" in C++) + (while (looking-at c-type-decl-suffix-ws-ids-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws)) + (setq at-decl-or-cast (catch 'at-decl-or-cast diff -r f6121546a9bc cc-langs.el --- a/cc-langs.el Sat Aug 20 20:40:26 2016 +0000 +++ b/cc-langs.el Sun Aug 21 12:04:18 2016 +0000 @@ -1817,7 +1817,7 @@ not the type face." t nil c '("const" "restrict" "volatile") - c++ '("const" "noexcept" "volatile" "throw" "final" "override") + c++ '("const" "noexcept" "volatile" "throw") objc '("const" "volatile")) (c-lang-defconst c-opt-type-modifier-key @@ -1846,6 +1846,18 @@ (c-lang-const c-type-modifier-kwds)) :test 'string-equal)) +(c-lang-defconst c-type-decl-suffix-ws-ids-kwds + "\"Identifiers\" that when immediately following a declarator have semantic +effect in the declaration, but are syntactically like whitespace." + t nil + c++ '("final" "override")) + +(c-lang-defconst c-type-decl-suffix-ws-ids-key + ;; An adorned regexp matching `c-type-decl-suffix-ws-ids-kwds'. + t (c-make-keywords-re t (c-lang-const c-type-decl-suffix-ws-ids-kwds))) +(c-lang-defvar c-type-decl-suffix-ws-ids-key + (c-lang-const c-type-decl-suffix-ws-ids-key)) + (c-lang-defconst c-class-decl-kwds "Keywords introducing declarations where the following block (if any) contains another declaration level that should be considered a class. > -- > Matthias -- Alan Mackenzie (Nuremberg, Germany).