diff options
| author | Alan Mackenzie | 2019-01-25 16:14:00 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2019-01-25 16:14:00 +0000 |
| commit | 9078f34e84178553cd59bc03ac1b58cb56038436 (patch) | |
| tree | 9276a06c29fdb72f563459c6a5e159ac1965a837 | |
| parent | a177fe754db3919c1515bdfcd1c2ea28543da8e8 (diff) | |
| download | emacs-9078f34e84178553cd59bc03ac1b58cb56038436.tar.gz emacs-9078f34e84178553cd59bc03ac1b58cb56038436.zip | |
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.el | 3 |
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....\".") | |||
| 1487 | ;; lock context (etc.) fontification. | 1487 | ;; lock context (etc.) fontification. |
| 1488 | (goto-char pos) | 1488 | (goto-char pos) |
| 1489 | (let ((lit-start (c-literal-start)) | 1489 | (let ((lit-start (c-literal-start)) |
| 1490 | old-pos | ||
| 1490 | (new-pos pos) | 1491 | (new-pos pos) |
| 1491 | capture-opener | 1492 | capture-opener |
| 1492 | bod-lim bo-decl) | 1493 | bod-lim bo-decl) |
| @@ -1509,12 +1510,14 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") | |||
| 1509 | (while | 1510 | (while |
| 1510 | ;; Go to a less nested declaration each time round this loop. | 1511 | ;; Go to a less nested declaration each time round this loop. |
| 1511 | (and | 1512 | (and |
| 1513 | (setq old-pos (point)) | ||
| 1512 | (c-syntactic-skip-backward "^;{}" bod-lim t) | 1514 | (c-syntactic-skip-backward "^;{}" bod-lim t) |
| 1513 | (> (point) bod-lim) | 1515 | (> (point) bod-lim) |
| 1514 | (progn (c-forward-syntactic-ws) | 1516 | (progn (c-forward-syntactic-ws) |
| 1515 | ;; Have we got stuck in a comment at EOB? | 1517 | ;; Have we got stuck in a comment at EOB? |
| 1516 | (not (and (eobp) | 1518 | (not (and (eobp) |
| 1517 | (c-literal-start)))) | 1519 | (c-literal-start)))) |
| 1520 | (< (point) old-pos) | ||
| 1518 | (progn (setq bo-decl (point)) | 1521 | (progn (setq bo-decl (point)) |
| 1519 | (or (not (looking-at c-protection-key)) | 1522 | (or (not (looking-at c-protection-key)) |
| 1520 | (c-forward-keyword-clause 1))) | 1523 | (c-forward-keyword-clause 1))) |