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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Nicholas Drozd <nicholasdrozd <at> gmail.com>
Subject: bug#36484: closed (Re: bug#36484: c-mode hangs on macro with comment)
Date: Wed, 17 Jul 2019 08:23:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#36484: c-mode hangs on macro with comment

which was filed against the emacs,cc-mode package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 36484 <at> debbugs.gnu.org.

-- 
36484: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36484
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Nicholas Drozd <nicholasdrozd <at> gmail.com>
Cc: 36484-done <at> debbugs.gnu.org
Subject: Re: bug#36484: c-mode hangs on macro with comment
Date: Wed, 17 Jul 2019 08:22:10 +0000
Hello, Nicholas.

On Thu, Jul 04, 2019 at 12:08:14 -0500, Nicholas Drozd wrote:
> Works for me!

That's great, thanks.  I'm closing the bug with this post.

> Attached is a patch for an added cc-mode test case. 

The patch works fine, too, thanks.  But I got bogged down on the
copyright assignment sort of things for the patch.

Have you signed copyright assignment papers for Emacs?  (I think you
have, judging by the number of commits in your name, but I don't know
where to look to check.)

Otherwise, it would appear that your patch is a "trivial" patch, in that
it is less than 15 lines long.  But I think that only applies when the
total number of lines you've contributed to Emacs is less than about 15.

So, sorry about all this non-creative stuff, but would you please tell
me whether or not you've signed an Emacs copyright assignment.  Then I
should be able to commit your patch.

> By the way, I came across this issue because a similar line appears in
> a winning entry to the 1988 International Obfuscated C Code Contest
> (https://www.ioccc.org/1988/dale.c). That line is included in the test
> case.

> Trivia question: which Emacs maintainer is a past IOCCC winner?

I don't know (and haven't cheated by researching it ;-), but if I had to
guess, I'd say Paul Eggert.

[ snip patch ].

-- 
Alan Mackenzie (Nuremberg, Germany).

[Message part 3 (message/rfc822, inline)]
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 2 days ago.

Previous Next


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