GNU bug report logs - #22079
CC Mode 5.33 (C++/l); C++ cache inconsistency

Previous Next

Package: cc-mode;

Reported by: Michael Welsh Duggan <mwd <at> md5i.com>

Date: Thu, 3 Dec 2015 04:29:02 UTC

Severity: normal

Full log


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

From: Michael Welsh Duggan <mwd <at> md5i.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Michael Welsh Duggan <mwd <at> md5i.com>, 22079 <at> debbugs.gnu.org
Subject: Re: bug#22079: CC Mode 5.33 (C++/l); C++ cache inconsistency
Date: Fri, 04 Dec 2015 11:54:04 -0500
Alan Mackenzie <acm <at> muc.de> writes:

> Hello, Michael.
>
> Thanks for another bug report.
>
> On Wed, Dec 02, 2015 at 11:28:00PM -0500, Michael Welsh Duggan wrote:

[...]

> I see you are using a relatively recent snapshot of the savannah master
> or emacs-25 branch (from ~26th November).
>
> The cause of the problem is not hard to track down.  On 11th November, I
> committed a fix "CC Mode: Respect users' settings of
> open-paren-in-column-0-is-defun-start.", which does precisely what it
> says.  Previously, I had bound open-paren-in-column-0-is-defun-start to
> nil around certain primitive calls for the sake of accurate scanning.
>
> The problem with binding o-p-i-c-0-i-d-s to nil is that it makes CC Mode
> very slow, particularly in big files, where continually scanning from
> the beginning of the file is sub-optimal.
>
> In the scenario you documented, we have ....
>
>
>
>> namespace std {                                    <=============== B
>> 
>> static_assert(ipfix::traits::is_same<uint8_t, unsigned char>,
>>               "Assumption that uint8_t is unsigned char is false");
>> 
>> template<>
>> struct char_traits<ipfix::traits::enable_if<
>>     ipfix::traits::is_signed<char>, unsigned char>>
>> {                                                  <=============== A
>>     typedef unsigned char                 char_type;
>>     typedef char_traits<char>::int_type   int_type;
>>     typedef char_traits<char>::off_type   off_type;
>>     typedef char_traits<char>::pos_type   pos_type;
>>     typedef char_traits<char>::state_type state_type;
>
> [ .... ]
>
> The actual top level (I think) is the brace at B.  CC Mode has, however,
> taken the brace at A (in column 0) to be a top level brace.
>
> This is a difficult problem to resolve satisfactorally, in general.
> What you could do is set open-paren-etc. to nil, or even set it to nil
> buffer locally for some files.  When I tried this on traits.hpp, it
> scanned without any parse state inconsistencies.

Indeed, the problem goes away with open-paren-in-column-0-is-defun-start
set to nil.  This is good, since the coding style my group uses includes
(innamespace . 0) in the c-offsets-alist.

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)




This bug report was last modified 9 years and 293 days ago.

Previous Next


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