[tor-bugs] #28193 [Core Tor/Tor]: Compile-time assertion

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Nov 4 21:53:43 UTC 2018


#28193: Compile-time assertion
--------------------------+----------------------------------
 Reporter:  riastradh     |          Owner:  (none)
     Type:  enhancement   |         Status:  needs_revision
 Priority:  Medium        |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:  nickm         |        Sponsor:
--------------------------+----------------------------------

Comment (by riastradh):

 1. I don't think there's any situation in which you need to pass arguments
 through to another macro with extra parentheses around them unless the
 downstream macro fails to parenthesize some expression itself.  x can't
 have commas except within balanced parentheses in CTASSERT, so it can't be
 confused for two macro arguments when expanding into CTASSERT_EXPN.
 CTASSERT_EXPN, in turn, via CTASSERT_DECL, will parenthesize x in the end.

    It won't hurt, so if you want to be paranoid (which is understandable
 among the sharp edges of the C preprocessor) you can add the parentheses,
 but there's no need.

 2. GCC 4.8 enabled -Wunused-local-typedefs in -Wall by default.  If you
 don't subscribe to this warning option, then ATTR_UNUSED is not necessary.
 Even if it turned out to be necessary in some scenario, the only adverse
 effects of failing to have it will be that the compiler yells at you, so
 if you want to remove it, be my guest.

 3. I put the copying notice on so there would be no questions about
 whether it is available under a licence acceptable for Tor without having
 to go through the rigmarole of signing a CLA to hand it over to the Tor
 Project, Inc., in case you happen to have such a process.

    You are welcome to use this code under the standard Tor 3-clause BSD
 licence.  Can also just substitute 'The NetBSD Foundation, Inc.' for my
 name if that would be less complicated, since you already have the same
 licence text and same copyright holder in the top-level LICENSE file.  I
 don't have a preference -- I just want to minimize hassle for everyone
 around.

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


More information about the tor-bugs mailing list