From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Marshall, Simon" Newsgroups: gmane.emacs.devel Subject: RE: Font-lock does not fontify const pointer declaration Date: Thu, 17 Apr 2008 13:14:33 +0100 Message-ID: <6EE216E1AA959543A555C60FF34FB76703C6BED5__44582.8507341959$1208434892$gmane$org@maileube01.misys.global.ad> References: <81CCA6588E60BB42BE68BD029ED482600A82C2AF@wimex2.wim.midas-kapiti.com> <20080417084918.GA2019@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1208434852 3200 80.91.229.12 (17 Apr 2008 12:20:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Apr 2008 12:20:52 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 17 14:21:12 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JmT2F-0006pi-Qk for ged-emacs-devel@m.gmane.org; Thu, 17 Apr 2008 14:16:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JmT1a-0006p1-IH for ged-emacs-devel@m.gmane.org; Thu, 17 Apr 2008 08:15:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JmT10-0006Z3-DY for emacs-devel@gnu.org; Thu, 17 Apr 2008 08:14:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JmT0x-0006X4-Vf for emacs-devel@gnu.org; Thu, 17 Apr 2008 08:14:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JmT0x-0006WV-GV for emacs-devel@gnu.org; Thu, 17 Apr 2008 08:14:55 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JmT0w-0002Q3-PH for emacs-devel@gnu.org; Thu, 17 Apr 2008 08:14:55 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JmT0w-0003mc-4c for emacs-pretest-bug@gnu.org; Thu, 17 Apr 2008 08:14:54 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JmT0q-0002OO-Ii for emacs-pretest-bug@gnu.org; Thu, 17 Apr 2008 08:14:54 -0400 Original-Received: from cluster-a.mailcontrol.com ([80.69.8.190]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JmT0p-0002N4-8U; Thu, 17 Apr 2008 08:14:48 -0400 Original-Received: from maileube01.misys.global.ad ([217.196.233.105]) by rly31a.srv.mailcontrol.com (MailControl) with ESMTP id m3HCEOBT001341; Thu, 17 Apr 2008 13:14:34 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Font-lock does not fontify const pointer declaration Thread-Index: AcigZYbVtAdndJ/pSBOs9Czjneu3ggAHjwzw X-Scanned-By: MailControl A-08-00-04 (www.mailcontrol.com) on 10.65.0.141 X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95401 Archived-At: Hi Alan, again, thanks, this fixes the problem in 22.2. (I also compiled cc-fonts.el.)=20 Simon. -----Original Message----- From: Alan Mackenzie [mailto:acm@muc.de]=20 Sent: 17 April 2008 09:49 To: Marshall, Simon Cc: 'bug-cc-mode@gnu.org'; 'emacs-pretest-bug@gnu.org' Subject: Re: Font-lock does not fontify const pointer declaration Good Morning, Simon! On Thu, Sep 14, 2006 at 03:32:38PM +0100, Marshall, Simon wrote: > Emacs 19-21 fontifies the following C/C++ snippet: > int *p; // ok > const int *p; // ok > int *const p; // not ok in CVS emacs > const int *const p; // not ok in CVS emacs > so that "p" is in font-lock-variable-name-face.=20=20 > In Emacs CVS, it does not fontify "p" when p is declared as a const pointer. This was a bug in one of the regexps parsing declarators, namely c-type-decl-prefix-key. It was recognising "const" as an identifier, because the explicit check for "const\|throw\|volatile" came later in the regexp than "[[:alpha:]_]....". Please apply the following patch, which fixes it, and let me know if it works or not. PLEASE NOTE: because a macro in cc-langs has changed, you need to recompile cc-{mode,engine}.el. Here's a recipe for this, after patching the files: M-x byte-compile-file cc-langs.el M-x load-file cc-langs.elc M-x byte-compile-file cc-mode.el M-x load-file cc-mode.elc M-x byte-compile-file cc-engine.el M-x load-file cc-engine.el M-x c++-mode Index: cc-langs.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cc-mode/cc-mode/cc-langs.el,v retrieving revision 5.267.2.16 diff -c -r5.267.2.16 cc-langs.el *** cc-langs.el 15 Apr 2008 20:05:59 -0000 5.267.2.16 --- cc-langs.el 17 Apr 2008 08:12:30 -0000 *************** *** 2596,2610 **** c++ (concat "\\(" "[*\(&]" "\\|" ! (concat "\\(" ; 2 ;; If this matches there's special treatment in ;; `c-font-lock-declarators' and ;; `c-font-lock-declarations' that check for a ;; complete name followed by ":: *". (c-lang-const c-identifier-start) "\\)") - "\\|" - (c-lang-const c-type-decl-prefix-key) "\\)" "\\([^=3D]\\|$\\)") pike "\\(\\*\\)\\([^=3D]\\|$\\)") --- 2596,2610 ---- c++ (concat "\\(" "[*\(&]" "\\|" ! (c-lang-const c-type-decl-prefix-key) ! "\\|" ! (concat "\\(" ; 3 ;; If this matches there's special treatment in ;; `c-font-lock-declarators' and ;; `c-font-lock-declarations' that check for a ;; complete name followed by ":: *". (c-lang-const c-identifier-start) "\\)") "\\)" "\\([^=3D]\\|$\\)") pike "\\(\\*\\)\\([^=3D]\\|$\\)") Index: cc-engine.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cc-mode/cc-mode/cc-engine.el,v retrieving revision 5.539.2.17 diff -c -r5.539.2.17 cc-engine.el *** cc-engine.el 15 Apr 2008 20:05:59 -0000 5.539.2.17 --- cc-engine.el 17 Apr 2008 08:12:35 -0000 *************** *** 5399,5406 **** ;; `c-font-lock-declarators'.) (while (and (looking-at c-type-decl-prefix-key) (if (and (c-major-mode-is 'c++-mode) ! (match-beginning 2)) ! ;; If the second submatch matches in C++ then ;; we're looking at an identifier that's a ;; prefix only if it specifies a member pointer. (when (setq got-identifier (c-forward-name)) --- 5400,5407 ---- ;; `c-font-lock-declarators'.) (while (and (looking-at c-type-decl-prefix-key) (if (and (c-major-mode-is 'c++-mode) ! (match-beginning 3)) ! ;; If the third submatch matches in C++ then ;; we're looking at an identifier that's a ;; prefix only if it specifies a member pointer. (when (setq got-identifier (c-forward-name)) Index: cc-fonts.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cc-mode/cc-mode/cc-fonts.el,v retrieving revision 5.205.2.6 diff -c -r5.205.2.6 cc-fonts.el *** cc-fonts.el 15 Apr 2008 18:31:12 -0000 5.205.2.6 --- cc-fonts.el 17 Apr 2008 08:12:36 -0000 *************** *** 866,873 **** ;; `c-forward-decl-or-cast-1'.) (while (and (looking-at c-type-decl-prefix-key) (if (and (c-major-mode-is 'c++-mode) ! (match-beginning 2)) ! ;; If the second submatch matches in C++ then ;; we're looking at an identifier that's a ;; prefix only if it specifies a member pointer. (progn --- 866,873 ---- ;; `c-forward-decl-or-cast-1'.) (while (and (looking-at c-type-decl-prefix-key) (if (and (c-major-mode-is 'c++-mode) ! (match-beginning 3)) ! ;; If the third submatch matches in C++ then ;; we're looking at an identifier that's a ;; prefix only if it specifies a member pointer. (progn > Simon. --=20 Alan Mackenzie (Nuremberg, Germany). "Misys" is the trade name for Misys plc (registered in England and Wales).= Registration Number: 01360027. Registered office: Burleigh House, Chapel O= ak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating c= ompanies please go to http://www.misys.com/html/about_us/group_operating_co= mpanies/. This email and any attachments have been scanned for known viruse= s using multiple scanners.=20 =20 We believe that this email and any attachments are virus free, however the = recipient must take full responsibility for virus checking. This email mess= age is intended for the named recipient only. It may be privileged and/or c= onfidential. If you are not the named recipient of this email please notify= us immediately and do not copy it or use it for any purpose, nor disclose = its contents to any other person. This email does not constitute the commen= cement of legal relations between you and Misys plc. Please refer to the ex= ecuted contract between you and the relevant member of the Misys group for = the identity of the contracting party with which you are dealing.=20