[tor-bugs] #18613 [Tor]: Tor could use a set of BUG_ON, BUG, etc macros to help us use tor_assert less.

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Apr 14 14:38:05 UTC 2016


#18613: Tor could use a set of BUG_ON, BUG, etc macros to help us use tor_assert
less.
-------------------------------+------------------------------------
 Reporter:  nickm              |          Owner:  nickm
     Type:  enhancement        |         Status:  needs_revision
 Priority:  High               |      Milestone:  Tor: 0.2.9.x-final
Component:  Tor                |        Version:
 Severity:  Normal             |     Resolution:
 Keywords:  TorCoreTeam201604  |  Actual Points:
Parent ID:                     |         Points:  small
 Reviewer:  dgoulet            |        Sponsor:  SponsorU-can
-------------------------------+------------------------------------
Changes (by dgoulet):

 * status:  needs_review => needs_revision
 * reviewer:   => dgoulet


Comment:

 First thing is that would be nice to identify the `#else/#endif` statement
 that are long in `util_bug.h` because it's already a huge amount of
 defines for which someone can get lost quickly.. Maybe something like:

 {{{
 #ifdef ALL_BUGS_ARE_FATAL
 ...
 #else /* ALL_BUGS_ARE_FATAL */
 ...
 #endif /* ALL_BUGS_ARE_FATAL */
 }}}

 Second, I think you can remove the fragile assert() here because BUG()
 basically does what the fragile assert do except doing it once:
 {{{
 +  if (BUG(conn->linked_conn)) {
      tor_fragile_assert();
 }}}

 Rest lgtm!

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


More information about the tor-bugs mailing list