Some points on clang-format usage
Stephan Bergmann
sbergman at redhat.com
Thu Dec 14 10:28:57 UTC 2017
On 12/14/2017 11:08 AM, Stephan Bergmann wrote:
> On 12/14/2017 10:35 AM, Miklos Vajna wrote:
[...]
>> This is due to our explicit AlignTrailingComments=false, it may make
>> sense to consider enabling it (if
>> solenv/clang-format/reformat-formatted-files confirms this solves more
>> problems than it causes).
[...]
> Namely the inconsistency in reformatting from
>
>> void decl1(); // lengthy comment comment comment comment comment
>> comment comment comment
>> // comment comment comment comment comment comment
>> comment pertaining to decl1
>> void decl2() {} // lengthy comment comment comment comment comment
>> comment comment comment
>> // comment comment comment comment comment comment
>> comment pertaining to decl2
>> void decl3();
>
> to
>
>> void decl1(); // lengthy comment comment comment comment comment
>> comment comment comment
>> // comment comment comment comment comment comment comment
>> pertaining to decl1
>> void decl2() {} // lengthy comment comment comment comment comment
>> comment comment comment
>> // comment comment comment comment comment comment comment pertaining
>> to decl2
>> void decl3();
>
> treating comments following function definitions differently than those
> following mere function declarations.
It appears that changing AlignTrailingCommentst to true would solve
that, and would reformat from
> void decl1(); // lengthy comment comment comment comment comment comment comment comment
> // comment comment comment comment comment comment comment pertaining to decl1
> void decl2() {} // lengthy comment comment comment comment comment comment comment comment
> // comment comment comment comment comment comment comment pertaining to decl2
> // Comment pertaining to decl3:
> void decl3();
to
> void decl1(); // lengthy comment comment comment comment comment comment comment comment
> // comment comment comment comment comment comment comment pertaining to decl1
> void decl2() {} // lengthy comment comment comment comment comment comment comment comment
> // comment comment comment comment comment comment comment pertaining to decl2
> // Comment pertaining to decl3:
> void decl3();
(and the changes it would cause to
`solenv/clang-format/reformat-formatted-files` would appear to be OK, too).
I'm somewhat undecided whether or not to do that change to .clang-format
now. My feeling is that reformatting of comments is a pain and a gotcha
anyway.
More information about the LibreOffice
mailing list