Fix a loop in c-fl-decl-start. This fixes bug #34186.

* lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations
c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter
doesn't come back to the position before the former, and break out of the
enclosing loop if it does.
This commit is contained in:
Alan Mackenzie 2019-01-25 16:14:00 +00:00
parent a177fe754d
commit 9078f34e84

View file

@ -1487,6 +1487,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
;; lock context (etc.) fontification.
(goto-char pos)
(let ((lit-start (c-literal-start))
old-pos
(new-pos pos)
capture-opener
bod-lim bo-decl)
@ -1509,12 +1510,14 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
(while
;; Go to a less nested declaration each time round this loop.
(and
(setq old-pos (point))
(c-syntactic-skip-backward "^;{}" bod-lim t)
(> (point) bod-lim)
(progn (c-forward-syntactic-ws)
;; Have we got stuck in a comment at EOB?
(not (and (eobp)
(c-literal-start))))
(< (point) old-pos)
(progn (setq bo-decl (point))
(or (not (looking-at c-protection-key))
(c-forward-keyword-clause 1)))