From: Alan Mackenzie Date: Sat, 21 Jun 2008 08:47:10 +0000 (+0000) Subject: (c-guess-basic-syntax CASE 5D.5): Fix an infinite loop on invalid syntax. X-Git-Tag: emacs-pretest-22.2.90~113 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5922fd0ee09f51cfc4f3aa160d9bd4a7b23493e4;p=emacs.git (c-guess-basic-syntax CASE 5D.5): Fix an infinite loop on invalid syntax. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 0282b156bb0..c9a836ff198 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8251,21 +8251,24 @@ comment at the start of cc-engine.el for more info." (c-add-syntax 'inher-cont (c-point 'boi))) ;; CASE 5D.5: Continuation of the "expression part" of a - ;; top level construct. + ;; top level construct. Or, perhaps, an unrecognised construct. (t - (while (and (eq (car (c-beginning-of-decl-1 containing-sexp)) + (while (and (setq placeholder (point)) + (eq (car (c-beginning-of-decl-1 containing-sexp)) 'same) (save-excursion (c-backward-syntactic-ws) - (eq (char-before) ?})))) + (eq (char-before) ?})) + (< (point) placeholder))) (c-add-stmt-syntax - (if (eq char-before-ip ?,) + (cond + ((eq (point) placeholder) 'statement) ; unrecognised construct ;; A preceding comma at the top level means that a ;; new variable declaration starts here. Use ;; topmost-intro-cont for it, for consistency with ;; the first variable declaration. C.f. case 5N. - 'topmost-intro-cont - 'statement-cont) + ((eq char-before-ip ?,) 'topmost-intro-cont) + (t 'statement-cont)) nil nil containing-sexp paren-state)) ))