GNU bug report logs - #62386
CC Mode 5.35.2 (C++//l); C++ concept indentation

Previous Next

Package: cc-mode;

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

Date: Wed, 22 Mar 2023 15:59:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


Message #32 received at 62386 <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>, 62386 <at> debbugs.gnu.org
Subject: Re: bug#62386: CC Mode 5.35.2 (C++//l); C++ concept indentation
Date: Fri, 14 Apr 2023 08:03:40 -0400
Alan Mackenzie <acm <at> muc.de> writes:

>> Before:
>
>>   template <typename T>
>>   requires (OctetLike<T>
>>             || (std::rank_v<T> == 1 && std::extent_v<T> == 0
>>                 && OctetLike<std::remove_extent_t<T>>))
>>   Chunk(std::shared_ptr<T> const & p, length_t size)
>>   : data_{p, octet_cast(p.get())},
>>     size_{size}
>>   {}
>
>
>> After:
>
>>   template <typename T>
>>   requires (OctetLike<T>
>>     || (std::rank_v<T> == 1 && std::extent_v<T> == 0
>>     && OctetLike<std::remove_extent_t<T>>))
>>   Chunk(std::shared_ptr<T> const & p, length_t size)
>>     : data_{p, octet_cast(p.get())},
>>       size_{size}
>>   {}
>
> This is a difficult one.  Aligning the || under OctetLike causes problems
> when the parenthesis is already far to the right, for example if requires
> is on the same line as template.  Then everything will be indented too
> far to the right.  This dilemma has come up at least twice before.
>
> I think what's worse is the lack of further indentation of the && line.
> I don't know what to do about that, at the moment.

I guess I just see it as the standard parenthesized expression problem
that already exists.  It's generally up to the programmer to make sure
opening parentheses don't happen too far to the right.

I agree about the && line.

> I'm also a little bit worried about the "virtual semicolon" detection on
> some more complicated requires constructs.
>
> Anyhow, I think I'll commit what I've got, and leave these doubts to be
> cleared up later.

Sure.  I'm generally happy with the improvements that have been made so
far.

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




This bug report was last modified 2 years and 34 days ago.

Previous Next


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