summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-01-25 16:14:00 +0000
committerAlan Mackenzie <acm@muc.de>2019-01-25 16:14:00 +0000
commit9078f34e84178553cd59bc03ac1b58cb56038436 (patch)
tree9276a06c29fdb72f563459c6a5e159ac1965a837
parenta177fe754db3919c1515bdfcd1c2ea28543da8e8 (diff)
downloademacs-9078f34e84178553cd59bc03ac1b58cb56038436.tar.gz
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.
-rw-r--r--lisp/progmodes/cc-mode.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8cbb4e86123..5283cfea6eb 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -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)))