[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 Feb 7 14:50:46 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):
Doing a little digging through documentation, it seems like
`StatementMacros` is new in clang-format-8.0, and `SpaceAfterLogicalNot`
is new in clang-format-9.0. The latest branch removes
`SpaceAfterLogicalNot`, which helps with the latter. (If we want to go as
far back as clang-format-3.8 for Debian stretch, we might have to do a lot
more digging.)
Once I comment out those directives, clang-format-6.0 on Ubuntu Xenial
seems to accept the .clang-format file. (We'll have to parameterize the
clang-format executable name in the helper script if we want this to run
easily on Xenial, though, because 3.8 is the default there.)
We can remove `StatementMacros` by changing the ht.h macros to use the
"redeclare incomplete struct" trick for eating semicolons, and adjusting
uses of those macros. (The examples in the comments in ht.h use
semicolons after those macros anyway, even though it might cause compiler
errors/warnings.) We might want to do that as a child ticket of this
ticket.
(Note that we seem to have two readily findable instances of this
technique with different struct tags: `struct dummy_semicolon_eater__` in
src/lib/cc/compat_compiler.h and `struct tor_semicolon_eater` in
src/lib/conf/conftesting.h. We might want to consolidate them. I prefer
the `tor_` prefix for future library-friendliness.)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32921#comment:16>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list