bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7722: 24.0.50; Finding this C++ header file drops emacs into a infin


From: Chong Yidong
Subject: bug#7722: 24.0.50; Finding this C++ header file drops emacs into a infinite loop
Date: Wed, 26 Jan 2011 19:55:15 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Chong Yidong <cyd@stupidchicken.com> writes:

>> 1. emacs -Q bug.hpp
>> 2. emacs loops infinitely using 100% CPU resources
>>
>> The offending file is that (according to the original reporter, the
>> spaces and empty lines are needed):
>
> I can reproduce this (file attached for convenience).  Alan, could you
> take a look?  Looks like a loop in c-forward-<>-arglist-recur:

In the meantime, I have added the following hack/workaround to the
emacs-23 branch, which seems to break the loop.  Let me know if you find
a fix that's safer (since we are well into the 23.3 pretest).

*** lisp/progmodes/cc-engine.el 2011-01-02 23:50:46 +0000
--- lisp/progmodes/cc-engine.el 2011-01-27 00:49:22 +0000
***************
*** 4393,4398 ****
--- 4393,4400 ----
        (goto-char safe-pos)
        t)))
  
+ (defvar c-forward-<>-arglist-recur-depth)
+ 
  (defun c-forward-<>-arglist (all-types)
    ;; The point is assumed to be at a "<".  Try to treat it as the open
    ;; paren of an angle bracket arglist and move forward to the
***************
*** 4418,4424 ****
        ;; If `c-record-type-identifiers' is set then activate
        ;; recording of any found types that constitute an argument in
        ;; the arglist.
!       (c-record-found-types (if c-record-type-identifiers t)))
      (if (catch 'angle-bracket-arglist-escape
          (setq c-record-found-types
                (c-forward-<>-arglist-recur all-types)))
--- 4420,4427 ----
        ;; If `c-record-type-identifiers' is set then activate
        ;; recording of any found types that constitute an argument in
        ;; the arglist.
!       (c-record-found-types (if c-record-type-identifiers t))
!       (c-forward-<>-arglist-recur--depth 0))
      (if (catch 'angle-bracket-arglist-escape
          (setq c-record-found-types
                (c-forward-<>-arglist-recur all-types)))
***************
*** 4434,4439 ****
--- 4437,4450 ----
        nil)))
  
  (defun c-forward-<>-arglist-recur (all-types)
+ 
+   ;; Temporary workaround for Bug#7722.
+   (when (boundp 'c-forward-<>-arglist-recur--depth)
+     (if (> c-forward-<>-arglist-recur--depth 100)
+       (error "Max recursion depth reached in <> arglist")
+       (setq c-forward-<>-arglist-recur--depth
+           (1+ c-forward-<>-arglist-recur--depth))))
+ 
    ;; Recursive part of `c-forward-<>-arglist'.
    ;;
    ;; This function might do hidden buffer changes.






reply via email to

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