[tor-bugs] #32921 [Core Tor/Tor]: Code and script changes to run clang-format without breaking checkSpaces or coccinelle
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Jan 31 02:13:52 UTC 2020
#32921: Code and script changes to run clang-format without breaking checkSpaces or
coccinelle
----------------------------+------------------------------------
Reporter: nickm | Owner: nickm
Type: enhancement | Status: needs_review
Priority: Medium | Milestone: Tor: 0.4.3.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: style, 043-can | Actual Points: 1.5
Parent ID: #29226 | Points:
Reviewer: catalyst | Sponsor:
----------------------------+------------------------------------
Comment (by catalyst):
Comments on the `.clang-format` file:
* `IndentCaseLabels: true` isn't consistent with KNF, nor is it consistent
with how we seem to indent `goto` labels.
* I'm not sure I like `AlignEscapedNewlines: Left`. Our existing practice
seems to somewhat follow what what emacs does, which tries to line up the
newline escaping backslashes of a macro definition so they are at a tab
stop. I'm not sure there's an easy way to get clang-format to do that.
`AlignEscapedNewlines: Right` seems more wrong, though.
* `KeepEmptyLinesAtTheStartOfBlocks: false` isn't consistent with KNF:
functions without local variables are supposed to have an empty line at
the start of the block. But we don't seem to do that consistently if at
all in our existing code, so I guess it's ok.
* `SpaceAfterLogicalNot: true` seems fairly uncommon in the C code I've
seen, which is also consistent with it only being supported in fairly
recent clang-format. I think other tools may expect `SpaceAfterLogicalNot:
false`.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32921#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list