Check result from c-backward-token-2 to avoid infinite loop

This fixes bug #33784.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): While moving back
over enclosing parentheses, check that c-backward-token-2 actually moves.
This commit is contained in:
Alan Mackenzie 2018-12-20 12:21:16 +00:00
parent f4ea746451
commit 081fb694c3

View file

@ -1284,8 +1284,8 @@ casts and declarations are fontified. Used on level 2 and higher."
(save-excursion (save-excursion
(goto-char match-pos) (goto-char match-pos)
(while (while
(progn (c-backward-token-2) (and (zerop (c-backward-token-2))
(eq (char-after) ?\())) (eq (char-after) ?\()))
(looking-at c-arithmetic-op-regexp))) (looking-at c-arithmetic-op-regexp)))
(cons nil nil)) (cons nil nil))
;; In a C++ member initialization list. ;; In a C++ member initialization list.