GNU bug report logs - #36484
c-mode hangs on macro with comment

Previous Next

Packages: cc-mode, emacs;

Reported by: Nicholas Drozd <nicholasdrozd <at> gmail.com>

Date: Wed, 3 Jul 2019 00:38:02 UTC

Severity: normal

Fixed in version 27.1

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Drozd <nicholasdrozd <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: c-mode hangs on macro with comment
Date: Tue, 2 Jul 2019 19:36:52 -0500
Here's a simple C program:

#define x /***/5
int main(void) {
    return x;
}

`gcc -Wall` compiles it without any warnings, but opening it causes
Emacs to hang, and sometimes even to freeze hard.

It has something to do with the macro, but I haven't been able to
figure out exactly what's going on.

Here's a test function with an even smaller reproducing example:

(defun c-mode-hang ()
  (interactive)
  (with-temp-buffer
    (insert "#define /***/5")
    (c-mode)))

Running that function under the profiler suggests that the problem is
in `c-end-of-macro`:

- c-extend-region-for-CPP          13869  98%
  - c-end-of-macro                     10470  74%
    c-forward-single-comment        2759  19%

This may have something to do with commit 39acaf, or maybe 6b5388.

GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2019-06-30




This bug report was last modified 6 years and 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.