[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34186: 26.1; locking up

From: Alan Mackenzie
Subject: bug#34186: 26.1; locking up
Date: Fri, 25 Jan 2019 16:30:07 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Eli and Michael.

On Thu, Jan 24, 2019 at 19:41:21 +0200, Eli Zaretskii wrote:
> > From: Michael Menefee <address@hidden>
> > Date: Thu, 24 Jan 2019 10:32:34 -0600
> > Cc: address@hidden

> > I have found the minimum necessary to consistently reproduce.  copy/paste 
> > this into something.c to see if you
> > get same results:

> > void *AVL_first(AVL_t *);
> > void *AVL_last(AVL_t *);
> > #define (<--- locks up with pressing open parenthesis

> Thanks, now I can reproduce this.  Alan, please take a look.

I've committed the following fix to the emacs-26 branch.  I'm closing
the bug.

@Michael: This patch should apply cleanly to your Emacs 26.1 version (in
directory .../emacs/lisp/progmodes).  If you apply it, please
byte-compile the file before using it.  (If you want any help with the
patching and/or byte-compiling, feel free to send me private email.)

commit 9078f34e84178553cd59bc03ac1b58cb56038436
Author: Alan Mackenzie <address@hidden>
Date:   Fri Jan 25 16:14:00 2019 +0000

    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.

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8cbb4e8612..5283cfea6e 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1487,6 +1487,7 @@ c-fl-decl-start
   ;; lock context (etc.) fontification.
   (goto-char pos)
   (let ((lit-start (c-literal-start))
+       old-pos
        (new-pos pos)
        bod-lim bo-decl)
@@ -1509,12 +1510,14 @@ c-fl-decl-start
        ;; Go to a less nested declaration each time round this loop.
+        (setq old-pos (point))
         (c-syntactic-skip-backward "^;{}" bod-lim t)
         (> (point) bod-lim)
         (progn (c-forward-syntactic-ws)
                ;; Have we got stuck in a comment at EOB?
                (not (and (eobp)
+        (< (point) old-pos)
         (progn (setq bo-decl (point))
                (or (not (looking-at c-protection-key))
                    (c-forward-keyword-clause 1)))

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]