aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stjernholm2002-08-20 21:59:10 +0000
committerMartin Stjernholm2002-08-20 21:59:10 +0000
commit0e35704fe37533a3b089c0b5fa8303e98baba562 (patch)
treea6b0126b0d2b8adeb389d3b6d85ee8f26ee46f61
parent23d468dadde98fecb74c19b8be0917f7aa20cff6 (diff)
downloademacs-0e35704fe37533a3b089c0b5fa8303e98baba562.tar.gz
emacs-0e35704fe37533a3b089c0b5fa8303e98baba562.zip
(c-forward-syntactic-ws): Fixed a bug that could cause an infinite
loop if something that looks like a macro begins in the middle of a line. (c-parse-state): Fixed a bug that could cause `c-state-cache' to contain two conses in sequence when there's an unbalanced open paren in a macro.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/cc-engine.el10
2 files changed, 18 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 30a1e186768..1ea63117124 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12002-08-20 Martin Stjernholm <bug-cc-mode@gnu.org>
2
3 * progmodes/cc-engine.el (c-forward-syntactic-ws): Fixed a bug
4 that could cause an infinite loop if something that looks like
5 a macro begins in the middle of a line.
6
7 * progmodes/cc-engine.el (c-parse-state): Fixed a bug that
8 could cause `c-state-cache' to contain two conses in sequence
9 when there's an unbalanced open paren in a macro.
10
12002-08-20 Glenn Morris <gmorris@ast.cam.ac.uk> 112002-08-20 Glenn Morris <gmorris@ast.cam.ac.uk>
2 12
3 * progmodes/fortran.el (fortran-current-defun): Use save-excursion. 13 * progmodes/fortran.el (fortran-current-defun): Use save-excursion.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 3994c5cc22c..4fdfbcf9502 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -642,8 +642,9 @@ specified."
642 (forward-char)) 642 (forward-char))
643 ;; Skip preprocessor directives. 643 ;; Skip preprocessor directives.
644 ((and (looking-at "#[ \t]*[a-zA-Z0-9!]") 644 ((and (looking-at "#[ \t]*[a-zA-Z0-9!]")
645 (progn (skip-chars-backward " \t") 645 (save-excursion
646 (bolp))) 646 (skip-chars-backward " \t")
647 (bolp)))
647 (end-of-line) 648 (end-of-line)
648 (while (and (<= (point) lim) 649 (while (and (<= (point) lim)
649 (eq (char-before) ?\\) 650 (eq (char-before) ?\\)
@@ -1245,6 +1246,11 @@ you need both the type of a literal and its limits."
1245 (setq c-state-cache (cdr c-state-cache))) 1246 (setq c-state-cache (cdr c-state-cache)))
1246 (setq pairs (car pairs)) 1247 (setq pairs (car pairs))
1247 (setcar pairs (1- (car pairs))) 1248 (setcar pairs (1- (car pairs)))
1249 (when (consp (car-safe c-state-cache))
1250 ;; There could already be a cons first in `c-state-cache'
1251 ;; if we've jumped over an unbalanced open paren in a
1252 ;; macro below.
1253 (setq c-state-cache (cdr c-state-cache)))
1248 (setq c-state-cache (cons pairs c-state-cache))) 1254 (setq c-state-cache (cons pairs c-state-cache)))
1249 (if last-pos 1255 (if last-pos
1250 ;; Prepare to loop, but record the open paren only if it's 1256 ;; Prepare to loop, but record the open paren only if it's