Opened 7 weeks ago

Last modified 5 weeks ago

#32655 assigned task

Try finding unused includes by compiling without each include

Reported by: teor Owned by: teor
Priority: Medium Milestone: Tor: 0.4.3.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: teor-backlog
Cc: nickm Actual Points:
Parent ID: #32522 Points: 3
Reviewer: Sponsor:


In #32522, we deleted some includes and PRIVATE defines, because they were duplicate (or the defines were never actually checked in the headers).

But we could go further, using this algorithm:

  1. Make sure all the files are sorted
  2. Find all the includes (and maybe PRIVATE defines)
  3. Delete the first include
  4. Try compiling
  5. If the include is required to compile, revert
  6. Try again from step 3, with the next include

We'd need to skip conditional includes, and check the results in CI before merging.

I'll wait until #32522 is reviewed, and also see if we want this task on our roadmap.

Child Tickets

Change History (1)

comment:1 Changed 5 weeks ago by teor

We need to remove cross-header dependencies using #32798, before this kind of script will give us good results.

Note: See TracTickets for help on using tickets.