From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Noam Postavsky <npostavs@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#30735: 25.3; slow comment c++-mode
Date: Tue, 13 Mar 2018 11:39:16 -0400
Message-ID: <CAM-tV-8bOzqPVacT2bmCBhj+8gDjh+J5R01LhiN0-wTkr3DceQ@mail.gmail.com>
References: <1520364356.10274.1.camel@googlemail.com>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1520956393 24644 195.159.176.226 (13 Mar 2018 15:53:13 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 13 Mar 2018 15:53:13 +0000 (UTC)
Cc: Alan Mackenzie <acm@muc.de>, 30735@debbugs.gnu.org
To: Nil Geisweiller <ngeiswei@googlemail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 13 16:53:08 2018
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1evmEa-0006C6-LR
	for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Mar 2018 16:53:04 +0100
Original-Received: from localhost ([::1]:40702 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1evmGd-0007FH-OX
	for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Mar 2018 11:55:11 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48504)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1evm22-00025f-MQ
	for bug-gnu-emacs@gnu.org; Tue, 13 Mar 2018 11:40:10 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1evm21-00006b-NZ
	for bug-gnu-emacs@gnu.org; Tue, 13 Mar 2018 11:40:06 -0400
Original-Received: from debbugs.gnu.org ([208.118.235.43]:51806)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1evm1y-0008VX-3H; Tue, 13 Mar 2018 11:40:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1evm1x-00057E-Nz; Tue, 13 Mar 2018 11:40:01 -0400
X-Loop: help-debbugs@gnu.org
In-Reply-To: <1520364356.10274.1.camel@googlemail.com>
Resent-From: Noam Postavsky <npostavs@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org
Resent-Date: Tue, 13 Mar 2018 15:40:01 +0000
Resent-Message-ID: <handler.30735.B30735.152095556519609@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 30735
X-GNU-PR-Package: emacs,cc-mode
X-GNU-PR-Keywords: 
Original-Received: via spool by 30735-submit@debbugs.gnu.org id=B30735.152095556519609
	(code B ref 30735); Tue, 13 Mar 2018 15:40:01 +0000
Original-Received: (at 30735) by debbugs.gnu.org; 13 Mar 2018 15:39:25 +0000
Original-Received: from localhost ([127.0.0.1]:59703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1evm1M-00056D-Oh
	for submit@debbugs.gnu.org; Tue, 13 Mar 2018 11:39:24 -0400
Original-Received: from mail-oi0-f53.google.com ([209.85.218.53]:33132)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <npostavs@gmail.com>) id 1evm1K-00055x-TV
	for 30735@debbugs.gnu.org; Tue, 13 Mar 2018 11:39:23 -0400
Original-Received: by mail-oi0-f53.google.com with SMTP id e9so45073oii.0
	for <30735@debbugs.gnu.org>; Tue, 13 Mar 2018 08:39:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 
	h=mime-version:from:date:message-id:subject:to:cc;
	bh=bH+pyHZRsQw/6uqVGJycw1sL0LJ2rNU0JjQm21rkDJU=;
	b=kv4US7AggrAJewCgLW9k1epd0SExPcHpGvp14Z3nK4JFc8GELP8/RbLMmP5opxzCZs
	vKbUMYEJno8hvLknAOeMYZvSQ8hw5lPk/tam6C3zOReFzX1+GPXutPJs7dkmkVo99e6/
	p0qXzLxZvpPnUZjegMTw+ivwi8rCDH7+gM7fHHx+WLdvHcdJfgzTAAVgpdbWIBLQxaoh
	rpPzs7AQkdk12wXMRWALUHna8keRee76sni5cFc5ROSZFqwQMxEgfAa+vr5+aVGdF6jV
	6lH7CWzy0/vgD0AZpezQg+DhR5mY8r051KpzJyUxpfbT/UQtxeFu9vQ7JMKTFAiFqns6
	UgCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc;
	bh=bH+pyHZRsQw/6uqVGJycw1sL0LJ2rNU0JjQm21rkDJU=;
	b=Devx07EMbI9k7dmsxu9EuQTn0qq8aFAqDIgrLx/4EG48C4lW1aopJoKqlOE/q4GfyV
	bLyaDoX1MPf30OxK39If7VVhZdg5qnHqplciiloiwXVVhl1D0AIIODrdNao9/3wrHLS5
	HQq20gzSzD8enZuLr7Z2cwJXL1W+c5hJp2ggQQXk1tIPC9+bgjWGI93vvoYFCSX+H4hu
	i6khVovFmUe64txuMi8tJlN7sD563VKwEJTDOIS1Z0l/f8A26kyPAOQS3RAd6CK5fsjT
	yt/m2ybU3qIifCxtG+nBwp4yI/1jOevsNDsm4wAWRPWFkpvBBjUKugLjlFzVVujLoYOS
	IUpQ==
X-Gm-Message-State: AElRT7GX5sAKeW/tBc56DWHlszu/ZXpPCWDPHl/dm2v27Onw2X5tjRLH
	ZJ4vaFy9FgF942sLYd9mKa2/p2MuYYMIiPmgIlI=
X-Google-Smtp-Source: AG47ELt0Q7wzMHyS7+pgHa8gcJvsrOU83tzS/nKr7m8eADLjft+KgmPBFxf5gWKc4HzSswuZtdadDUb6YKG5dDDsiec=
X-Received: by 10.202.85.143 with SMTP id j137mr718489oib.211.1520955557171;
	Tue, 13 Mar 2018 08:39:17 -0700 (PDT)
Original-Received: by 10.74.212.23 with HTTP; Tue, 13 Mar 2018 08:39:16 -0700 (PDT)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 208.118.235.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:144193
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/144193>

On Sun, Mar 11, 2018 at 4:15 PM, Nil Geisweiller
<ngeiswei@googlemail.com> wrote:

> Unfortunately, I couldn't apply the patch completely because I couldn't get
> my hand on the source code of 25.3.1, only 25.3.

25.3 is the same as 25.3.1, the ".1" just refers to the build number
(i.e., how many times you've built that version of Emacs).

That said, it seems that the patch is against emacs-26 or master, not
25.3. In particular, the first hunk:

@@ -4677,10 +4677,10 @@
           (t 'c)))            ; Assuming the range is valid.
     range))

-(defsubst c-determine-limit-get-base (start try-size)
+(defsubst c-determine-limit-get-base (start try-size &optional abs-limit)
   ;; Get a "safe place" approximately TRY-SIZE characters before START.
-  ;; This doesn't preserve point.
-  (let* ((pos (max (- start try-size) (point-min)))
+  ;; This defsubst doesn't preserve point.
+  (let* ((pos (max (- start try-size) (point-min) (or abs-limit 0)))
      (base (c-state-semi-safe-place pos))
      (s (save-restriction
           (widen)

In 25.3, the end context would look like this:

     (base (c-state-semi-safe-place pos))
     (s (parse-partial-sexp base pos)))
    (if (or (nth 4 s) (nth 3 s))    ; comment or string