emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two more CC Mode bugs fixed. For Emacs 26?


From: Alan Mackenzie
Subject: Two more CC Mode bugs fixed. For Emacs 26?
Date: Tue, 19 Dec 2017 19:52:05 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]