git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] clang-format: add a comment about the meaning/status of the

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Oct 3, 2017, 01:08 UTC
Message-ID
<57ab6f76-e150-26ab-3671-b14e0247a553@ramsayjones.plus.com>
In-Reply-To
<20171002172135.GB5189@google.com>
On 02/10/17 18:21, Brandon Williams wrote:
Show 44 quoted lines
> On 10/02, Junio C Hamano wrote:
>> From: Stephan Beyer <s-beyer@gmx.net>
>>
>> Having a .clang-format file in a project can be understood in a way that
>> code has to be in the style defined by the .clang-format file, i.e., you
>> just have to run clang-format over all code and you are set.
>>
>> This unfortunately is not yet the case in the Git project, as the
>> format file is still work in progress.  Explain it with a comment in
>> the beginning of the file.
>>
>> Additionally, the working clang-format version is mentioned because the
>> config directives change from time to time (in a compatibility-breaking way).
>>
>> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>>
>>  * So here is a counter-proposal in a patch form.  I agree that my
>>    earlier suggestion was unnecessarily verbose; this one spends
>>    just as many lines and not more than the v2 round of Stephan's
>>    patch.
>>
>>  .clang-format | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/.clang-format b/.clang-format
>> index 56822c116b..7670eec8df 100644
>> --- a/.clang-format
>> +++ b/.clang-format
>> @@ -1,4 +1,8 @@
>> -# Defaults
>> +# This file is an example configuration for clang-format 5.0.
>> +#
>> +# Note that this style definition should only be understood as a hint
>> +# for writing new code. The rules are still work-in-progress and does
>> +# not yet exactly match the style we have in the existing code.
> 
> Thanks for writing up this header comment to the .clang-format file,
> it's something I definitely should have included when I introduced it.
> 
> And I like the wording that you've both settled on, as it reflects our
> intentions (of having the code eventually conform to the format rules)
> and making note that this set of rules still needs to be tuned.
Just for the record, I have 'clang-format version 3.8.0-2ubuntu4
 (tags/RELEASE_380/final)' on Linux Mint 18.2, which requires me
to comment out:
    AlignEscapedNewlines: Left
    BreakStringLiterals: false
    PenaltyBreakAssignment: 100
And on cygwin, I have 'clang-format version 4.0.1
 (tags/RELEASE_401/final)', which requires me to
comment out:
    AlignEscapedNewlines: Left
    PenaltyBreakAssignment: 100
So, I don't think I can play along! :(

[When playing with 3.8 on Linux, I noted that clang-format seemed to ignore *all* settings in .clang-format, if it found *any* config that it didn't know about! Not very friendly. :-P ]

ATB, Ramsay Jones

Previous: Brandon WilliamsNext: Junio C Hamano
Message 14 of 15 in “clang-format: adjust line break penalties”
  1. clang-format: adjust line break penaltiesJohannes Schindelin, Sep 29, 2017
  2. Jonathan NiederSep 29, 2017
  3. Brandon WilliamsSep 29, 2017
  4. Stephan BeyerSep 29, 2017
  5. Jonathan NiederSep 29, 2017
  6. Add a comment to .clang-format about the meaning of the fileStephan Beyer, Sep 30, 2017
  7. Junio C HamanoOct 1, 2017
  8. Add a comment to .clang-format about the meaning of the fileStephan Beyer, Oct 1, 2017
  9. Junio C HamanoOct 1, 2017
  10. Stephan BeyerOct 1, 2017
  11. clang-format: add a comment about the meaning/status of theJunio C Hamano, Oct 1, 2017
  12. Stephan BeyerOct 2, 2017
  13. Brandon WilliamsOct 2, 2017
  14. Ramsay JonesOct 3, 2017
  15. Junio C HamanoOct 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.