all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: John Yates <john@yates-sheets.org>
Cc: 10792@debbugs.gnu.org
Subject: bug#10792: 24.0.93; emacs goes comatose opening C header
Date: Sat, 11 Feb 2012 22:39:23 +0000	[thread overview]
Message-ID: <20120211223923.GE3969@acm.acm> (raw)
In-Reply-To: <CAJnXXohsDMGvHa=e_pxcRFUMTx8YgSB4Oxk6+f8os0WjMRoStQ@mail.gmail.com>

Hi, John

On Sat, Feb 11, 2012 at 12:26:36PM -0500, John Yates wrote:
> When I attemt to visit the following header emacs locks up.  If
> I make the contents of the macro significantly shorted emacs is
> able to open and fontlock it successfully.  To me this suggests
> some form of n-squared processing.

> #define PARSE_TYPE_LIST \
> _EMIT_(PT_ZERO,            "*ZERO*"            ) _DELIM_ \
> _EMIT_(PT_CHAR1,           "CHAR"              ) _DELIM_ \
> _EMIT_(PTN_CHAR1,          "CHAR"              ) _DELIM_ \
  ..... ..... ..... ..... .....
> _EMIT_(PT_SYNTH1,          "SYNTH1"            ) _DELIM_ \
> _EMIT_(PT_SYNTH2,          "SYNTH2"            ) _DELIM_ \
> _EMIT_(PT_SYNTH4,          "SYNTH4"            ) _DELIM_ \
> _EMIT_(PT_END,             "*END*"             )

Would you try this patch, please, and let me know how it goes.
Thanks for the bug report.



*** orig/cc-engine.el	2012-02-11 20:16:13.000000000 +0000
--- cc-engine.el	2012-02-11 22:30:58.000000000 +0000
***************
*** 2130,2136 ****
      (widen)
      (save-excursion
        (let ((c c-state-nonlit-pos-cache)
! 	    pos npos lit macro-beg)
  	;; Trim the cache to take account of buffer changes.
  	(while (and c (> (car c) c-state-nonlit-pos-cache-limit))
  	  (setq c (cdr c)))
--- 2130,2136 ----
      (widen)
      (save-excursion
        (let ((c c-state-nonlit-pos-cache)
! 	    pos npos lit macro-beg macro-end)
  	;; Trim the cache to take account of buffer changes.
  	(while (and c (> (car c) c-state-nonlit-pos-cache-limit))
  	  (setq c (cdr c)))
***************
*** 2144,2171 ****
  	    ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
  	    (and
  	     (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
  	     (progn
  	       (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
  	       (cond
  		((null lit)
- 		 (setq pos npos)
  		 t)
  		((<= (cdr lit) here)
! 		 (setq pos (cdr lit))
  		 t)
  		(t
- 		 (setq pos (car lit))
  		 nil))))
  
! 	  (goto-char pos)
! 	  (when (and (c-beginning-of-macro) (/= (point) pos))
! 	      (setq macro-beg (point))
! 	      (c-syntactic-end-of-macro)
! 	      (or (eobp) (forward-char))
! 	      (setq pos (if (<= (point) here)
! 			    (point)
! 			  macro-beg)))
! 	    (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
  
  	(if (> pos c-state-nonlit-pos-cache-limit)
  	    (setq c-state-nonlit-pos-cache-limit pos))
--- 2144,2182 ----
  	    ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
  	    (and
  	     (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+ 
+ 	     ;; Test for being in a literal.
  	     (progn
  	       (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
  	       (cond
  		((null lit)
  		 t)
  		((<= (cdr lit) here)
! 		 (setq npos (cdr lit))
! 		 t)
! 		(t
! 		 nil)))
! 
! 	     ;; Test for being in a macro.
! 	     (progn
! 	       (goto-char npos)
! 	       (setq macro-beg
! 		     (and (c-beginning-of-macro) (/= (point) npos) (point)))
! 	       (when macro-beg
! 		 (c-syntactic-end-of-macro)
! 		 (or (eobp) (forward-char))
! 		 (setq macro-end (point)))
! 	       (cond
! 		((null macro-beg)
! 		 t)
! 		((<= macro-end here)
! 		 (setq npos macro-end)
  		 t)
  		(t
  		 nil))))
  
! 	  (setq pos npos)
! 	  (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
  
  	(if (> pos c-state-nonlit-pos-cache-limit)
  	    (setq c-state-nonlit-pos-cache-limit pos))



-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2012-02-11 22:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-11 17:26 bug#10792: 24.0.93; emacs goes comatose opening C header John Yates
2012-02-11 19:55 ` Eli Zaretskii
2012-02-11 20:14   ` Andreas Schwab
2012-02-11 20:05 ` Alan Mackenzie
2012-02-11 20:17   ` Eli Zaretskii
2012-02-11 20:22     ` Alan Mackenzie
2012-02-11 20:38       ` Eli Zaretskii
2012-02-11 21:53         ` Alan Mackenzie
2012-02-11 22:39 ` Alan Mackenzie [this message]
2012-02-12  0:28   ` John Yates
2012-02-12  0:53     ` John Yates
2012-02-14  5:45     ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120211223923.GE3969@acm.acm \
    --to=acm@muc.de \
    --cc=10792@debbugs.gnu.org \
    --cc=john@yates-sheets.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.