[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #18902 [Core Tor/Tor]: Avoid variable shadowing in Tor



#18902: Avoid variable shadowing in Tor
---------------------------+------------------------------
 Reporter:  teor           |          Owner:  cypherpunks
     Type:  defect         |         Status:  assigned
 Priority:  Medium         |      Milestone:  Tor: 0.2.???
Component:  Core Tor/Tor   |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:  easy refactor  |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------

Comment (by teor):

 Replying to [comment:6 teor]:
 > One strategy could be to temporarily change outer and inner names, then
 check using a compiler.
 > There is a risk that inner variables will accidentally be changed to the
 outer variable name, but that's the only risk I can see.

 Here is a detailed strategy I thought of, it might not work:
 * Change outer variable names by appending _o:
   * run compiler with -Wshadow and parse the log to create a patch that
 renames all shadowed declarations to _o, handling SMARTLIST_FOREACH as a
 special case
   * run compiler and rename all undeclared identifiers with _o

 * Change inner variable names by appending _j:
   * run compiler with -Wshadow and rename all shadowed declarations with
 _j
   * run compiler and rename all undeclared identifiers with _j

 * Revert _o patch

 * Check for and fix whitespace manually

 * Remove unnecessary redeclarations manually, if you want to

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18902#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs