changeset 46983:35f3b5d4f918

(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.
author Martin Stjernholm <mast@lysator.liu.se>
date Tue, 20 Aug 2002 21:58:51 +0000
parents 076f60a8d04b
children a6d9ca6d1a10
files lisp/progmodes/cc-engine.el
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/cc-engine.el	Tue Aug 20 20:35:56 2002 +0000
+++ b/lisp/progmodes/cc-engine.el	Tue Aug 20 21:58:51 2002 +0000
@@ -642,8 +642,9 @@
 	(forward-char))
        ;; Skip preprocessor directives.
        ((and (looking-at "#[ \t]*[a-zA-Z0-9!]")
-	     (progn (skip-chars-backward " \t")
-		    (bolp)))
+	     (save-excursion
+	       (skip-chars-backward " \t")
+	       (bolp)))
 	(end-of-line)
 	(while (and (<= (point) lim)
 		    (eq (char-before) ?\\)
@@ -1245,6 +1246,11 @@
 	      (setq c-state-cache (cdr c-state-cache)))
 	  (setq pairs (car pairs))
 	  (setcar pairs (1- (car pairs)))
+	  (when (consp (car-safe c-state-cache))
+	    ;; There could already be a cons first in `c-state-cache'
+	    ;; if we've jumped over an unbalanced open paren in a
+	    ;; macro below.
+	    (setq c-state-cache (cdr c-state-cache)))
 	  (setq c-state-cache (cons pairs c-state-cache)))
 	(if last-pos
 	    ;; Prepare to loop, but record the open paren only if it's