[tor-bugs] #31759 [Core Tor/Tor]: Make "annotate_ifdef_directives" script comply with line-width limits

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 26 22:16:30 UTC 2019


#31759: Make "annotate_ifdef_directives" script comply with line-width limits
--------------------------+------------------------------------
 Reporter:  nickm         |          Owner:  nickm
     Type:  defect        |         Status:  needs_revision
 Priority:  Medium        |      Milestone:  Tor: 0.4.2.x-final
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:  042-should    |  Actual Points:  .1
Parent ID:  #31713        |         Points:
 Reviewer:  catalyst      |        Sponsor:  Sponsor31-can
--------------------------+------------------------------------

Comment (by nickm):

 It looks like the fixup was squashed into the "remove some cases of double
 negation" commit.  Here is the code diff between the old version of that
 commit, and the new one.
 {{{
      expr = expr.strip()
      # See whether we match !(...), with no intervening close-parens.
 -    m = re.match(r'^!\s*\(([^\)*])\)$', expr)
 +    m = re.match(r'^!\s*\(([^\)]*)\)$', expr)
      if m:
          return m.group(1)
 -    # See whether we match !defined(...), with no intervening close-
 parens.
 -    m = re.match(r'^!\s*(defined\([^\)]*\))$', expr)
 +
 +
 +    # See whether we match !?defined(...), with no intervening close-
 parens.
 +    m = re.match(r'^(!?)\s*(defined\([^\)]*\))$', expr)
      if m:
 -        return m.group(1)
 +        if m.group(1) == "!":
 +            prefix = ""
 +        else:
 +            prefix = "!"
 +        return prefix + m.group(2)

      return "!(%s)" % expr
 }}}

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


More information about the tor-bugs mailing list