[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 10 20:56:03 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         |  Actual Points:  1.5
Parent ID:  #29226        |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------
Changes (by nickm):

 * status:  assigned => needs_review
 * keywords:   => style
 * actualpoints:   => 1.5


Comment:

 See branch `clang_format_prep_2` with PR at
 https://github.com/torproject/tor/pull/1649 .  This is the branch to
 review and merge.

 It makes the following kinds of changes:
   * It adds a .clang-format file.
   * It adds an extensible postprocessing tool that works with clang-format
 to do the right thing for our `FOREACH_END` and `MOCK_IMPL` macros.
   * It adds a shell script that applies both of the above to our code.
   * It makes checkSpace.pl tolerate a bunch of things that clang-format
 wants to do in its output.
   * It tweaks our code a little so that, after clang-format is run:
      * The unit tests all pass
      * checkSpace.pl still passes
      * Our coccinelle tests still pass
      * columnar tables are preserved
      * macro stringifications at the start of a line (e.g. `#name`) are no
 longer mangled.

 To see the result of running this formatting on our current code, see
 `demo_clang_foramt_20190110` with PR at
 https://github.com/torproject/tor/pull/1648

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32921#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list