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: Two more CC Mode bugs fixed. For Emacs 26? Date: Tue, 19 Dec 2017 19:52:05 +0000 Message-ID: <20171219195205.GA31877@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1513713171 19138 195.159.176.226 (19 Dec 2017 19:52:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 19 Dec 2017 19:52:51 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: John Ciolfi To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 19 20:52:47 2017 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 1eRNwU-0004e5-3u for ged-emacs-devel@m.gmane.org; Tue, 19 Dec 2017 20:52:46 +0100 Original-Received: from localhost ([::1]:34526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRNyS-0001u8-Dj for ged-emacs-devel@m.gmane.org; Tue, 19 Dec 2017 14:54:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRNxE-0001sI-Nu for emacs-devel@gnu.org; Tue, 19 Dec 2017 14:53:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRNxB-0005IG-JC for emacs-devel@gnu.org; Tue, 19 Dec 2017 14:53:32 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:18117 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1eRNxB-0005Ew-Be for emacs-devel@gnu.org; Tue, 19 Dec 2017 14:53:29 -0500 Original-Received: (qmail 67455 invoked by uid 3782); 19 Dec 2017 19:53:25 -0000 Original-Received: from acm.muc.de (p548C7195.dip0.t-ipconnect.de [84.140.113.149]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 19 Dec 2017 20:53:24 +0100 Original-Received: (qmail 31991 invoked by uid 1000); 19 Dec 2017 19:52:05 -0000 Content-Disposition: inline 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 [fuzzy] X-Received-From: 193.149.48.1 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:221256 Archived-At: Hello, Emacs. Thanks to John Ciolfi for reporting the following two bugs, which are now fixed in standalone CC Mode: 1/- In #include "b.hpp"//Comment , the fontification goes haywire. This is triggered by the lack of a space between the second " and //. The mechanism is an attempted optimisation in the "state cache" whereby 'category text properties are placed around the CPP construct not including the comment. Since there's no character between the CPP construct and the comment, there's nowhere to put this text property, so things go wrong. The solution is to remove this "optimisation" entirely. It didn't really make much difference to CC Mode's run time anyway. 2/- In a section of comment where doc comments should start, the doc comment sometimes doesn't get fontified as such, e.g., when CC Mode is set up for doxygen comments: // Function: foo /** * Comment line 1 foo foo foo foo foo foo foo foo foo @b one * Comment line 2 foo foo foo foo foo foo foo foo foo foo foo foo * foo foo foo foo foo foo foo , the lines from that starting with "/**" ought to get c-doc-face, but don't. The mechanism here is again a lack of a space. c-font-lock-doc-comments is trying to check whether the "/**" is itself within a comment or string, and does so by testing the face of the character immediately before. This is the newline after "foo", which has comment-face, so the function assumes that "/**" is inside a comment and fails to do the right thing. The solution is to check rigorously whether the "/**" is inside a comment. This is no problem now that processor cycles are a deal more plentiful than when this code was originally written. ######################################################################### I'd like to commit these two fixes to the release branch. 1/- because it is relatively important, and 2/- because it is cheap and very low risk. What do people, Eli and others, say? -- Alan Mackenzie (Nuremberg, Germany).