GNU bug report logs - #25869
CC Mode 5.32.99 (C/l); Sometimes Emacs use 100% CPU on comment-dwim for a long time

Previous Next

Package: cc-mode;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Sat, 25 Feb 2017 10:58:01 UTC

Severity: normal

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: Alan Mackenzie <acm <at> muc.de>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 25869 <at> debbugs.gnu.org
Subject: bug#25869: CC Mode 5.32.99 (C/l); Sometimes Emacs use 100% CPU on comment-dwim for a long time
Date: Sun, 5 Mar 2017 22:11:09 +0000
Hello, Mohammed.

On Sat, Feb 25, 2017 at 16:26:58 +0530, Mohammed Sadiq wrote:

> When writing code, I encountered a bug in comment-dwim, which takes 100%
> CPU for a long time, and then failing to comment the line.

> How to reproduce using the following code:
> 1. Mark some line in the first function.
>    Eg: g_type_ensure (CC_TYPE_INFO_OVERVIEW);
>    do C-a C-SPC C-e
> 2. Do comment-dwim
>    ie, M-;

> The code that produced the issue is the following:
> Note: if I remove the array at the bottom of code, M-; begins to work
> fine. The code follows is an excerpt from gnome-control-center.

First of all, thank you for such a detailed and complete bug report.

The bug that this code triggers has been in CC Mode for quite some
while, but it takes a rather unusual combination of constructs in the C
source to trigger it.

What is happening is that the M-; first inserts "/* ".  This causes all
the code up to the next terminating "*/" to become, temporarily, a
comment.  One of CC Mode's functions moves forward over this comment.  A
bit later on, it has cause to move backwards over it, but only moves as
far back as the "/*" which was the original start of the second comment
(but is now merely part of the first comment).  This is the bug, I
think.

This might be quite tricky to fix.  Give me a little time, please!

[ snip source code ]

> Thanks

[ CC Mode configuration dump appreciated, but snipped. ]

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 8 years and 46 days ago.

Previous Next


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