• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Automatically Remove Unused #import Directives
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatically Remove Unused #import Directives


  • Subject: Automatically Remove Unused #import Directives
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 27 Oct 2008 22:38:07 -0700

After major remodeling of a project, I'm going to have about a hundred files with an average of maybe 20 #import directives at the top of each one, and half of them will be no longer necessary since the symbols that required them were removed or moved to other files during remodeling.

Of course a good remodel will many remove spaghetti dependencies, but the un/necessary #imports may still be rather tedious to discern by inspection.

Is there any script or other automatic means for removing the #import directives that are no longer needed?

Thanks,

Jerry Krinock

P.S.  It seems that a brute-force algorithm exists:

For each .m file in project,
   Remove all the #imports,
   Compile
   Count number of errors/warnings
   Repeat with each removed #import:
      Restore it
      Compile
      Count number of errors/warnings
      If fewer, leave this #import restored
      Else, remove it permanently
   }
}

Maybe some re-repeating or recursion would be necessary, but probably running such a thing all night would achieve upper-90s percent accuracy.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Automatically Remove Unused #import Directives
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Using Subversion with Xcode 3.1.1 on local network?
  • Next by Date: Re: Automatically Remove Unused #import Directives
  • Previous by thread: Xcode Build Script Problem with openssl
  • Next by thread: Re: Automatically Remove Unused #import Directives
  • Index(es):
    • Date
    • Thread