diff options
| author | Alan Mackenzie | 2008-06-21 08:47:10 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2008-06-21 08:47:10 +0000 |
| commit | 5922fd0ee09f51cfc4f3aa160d9bd4a7b23493e4 (patch) | |
| tree | 4c2b688b906d7f7814163d9971f68b7715a59e93 | |
| parent | 6971de0774e58cb945a59a71be95b1f1b0e64b71 (diff) | |
| download | emacs-5922fd0ee09f51cfc4f3aa160d9bd4a7b23493e4.tar.gz emacs-5922fd0ee09f51cfc4f3aa160d9bd4a7b23493e4.zip | |
(c-guess-basic-syntax CASE 5D.5): Fix an infinite loop on invalid syntax.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 15 |
1 files changed, 9 insertions, 6 deletions
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." | |||
| 8251 | (c-add-syntax 'inher-cont (c-point 'boi))) | 8251 | (c-add-syntax 'inher-cont (c-point 'boi))) |
| 8252 | 8252 | ||
| 8253 | ;; CASE 5D.5: Continuation of the "expression part" of a | 8253 | ;; CASE 5D.5: Continuation of the "expression part" of a |
| 8254 | ;; top level construct. | 8254 | ;; top level construct. Or, perhaps, an unrecognised construct. |
| 8255 | (t | 8255 | (t |
| 8256 | (while (and (eq (car (c-beginning-of-decl-1 containing-sexp)) | 8256 | (while (and (setq placeholder (point)) |
| 8257 | (eq (car (c-beginning-of-decl-1 containing-sexp)) | ||
| 8257 | 'same) | 8258 | 'same) |
| 8258 | (save-excursion | 8259 | (save-excursion |
| 8259 | (c-backward-syntactic-ws) | 8260 | (c-backward-syntactic-ws) |
| 8260 | (eq (char-before) ?})))) | 8261 | (eq (char-before) ?})) |
| 8262 | (< (point) placeholder))) | ||
| 8261 | (c-add-stmt-syntax | 8263 | (c-add-stmt-syntax |
| 8262 | (if (eq char-before-ip ?,) | 8264 | (cond |
| 8265 | ((eq (point) placeholder) 'statement) ; unrecognised construct | ||
| 8263 | ;; A preceding comma at the top level means that a | 8266 | ;; A preceding comma at the top level means that a |
| 8264 | ;; new variable declaration starts here. Use | 8267 | ;; new variable declaration starts here. Use |
| 8265 | ;; topmost-intro-cont for it, for consistency with | 8268 | ;; topmost-intro-cont for it, for consistency with |
| 8266 | ;; the first variable declaration. C.f. case 5N. | 8269 | ;; the first variable declaration. C.f. case 5N. |
| 8267 | 'topmost-intro-cont | 8270 | ((eq char-before-ip ?,) 'topmost-intro-cont) |
| 8268 | 'statement-cont) | 8271 | (t 'statement-cont)) |
| 8269 | nil nil containing-sexp paren-state)) | 8272 | nil nil containing-sexp paren-state)) |
| 8270 | )) | 8273 | )) |
| 8271 | 8274 | ||