From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#10792: 24.0.93; emacs goes comatose opening C header Date: Sat, 11 Feb 2012 22:39:23 +0000 Message-ID: <20120211223923.GE3969@acm.acm> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1329000050 1698 80.91.229.3 (11 Feb 2012 22:40:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Feb 2012 22:40:50 +0000 (UTC) Cc: 10792@debbugs.gnu.org To: John Yates Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 11 23:40:49 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RwLce-0007AT-F2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Feb 2012 23:40:48 +0100 Original-Received: from localhost ([::1]:53807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLcd-0007cb-Tu for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Feb 2012 17:40:47 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLcZ-0007ZM-IX for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 17:40:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwLcY-0002Zr-Gx for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 17:40:43 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:32884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLcX-0002ZP-0O; Sat, 11 Feb 2012 17:40:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RwLdp-0002OG-SC; Sat, 11 Feb 2012 17:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 11 Feb 2012 22:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10792 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: X-Debbugs-Original-Cc: Eli Zaretskii , bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13290000869132 (code B ref -1); Sat, 11 Feb 2012 22:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Feb 2012 22:41:26 +0000 Original-Received: from localhost ([127.0.0.1]:36504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RwLdE-0002ND-Fr for submit@debbugs.gnu.org; Sat, 11 Feb 2012 17:41:25 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:35572) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RwLdB-0002Mx-E1 for submit@debbugs.gnu.org; Sat, 11 Feb 2012 17:41:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwLbm-0002Qc-6j for submit@debbugs.gnu.org; Sat, 11 Feb 2012 17:39:55 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:46618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLbm-0002QY-2n for submit@debbugs.gnu.org; Sat, 11 Feb 2012 17:39:54 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLbk-0007U3-Mm for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 17:39:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwLbc-0002Pw-5K for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 17:39:52 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:17792 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwLbb-0002Pl-Rq for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 17:39:44 -0500 Original-Received: (qmail 31702 invoked by uid 3782); 11 Feb 2012 22:39:42 -0000 Original-Received: from acm.muc.de (pD951A921.dip.t-dialin.net [217.81.169.33]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 11 Feb 2012 23:39:39 +0100 Original-Received: (qmail 6089 invoked by uid 1000); 11 Feb 2012 22:39:23 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56814 Archived-At: 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).