Wireshark-dev: Re: [Wireshark-dev] Script used to automatically delete unused #includes
From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Sun, 8 Feb 2015 19:01:44 +0100


On Mon, Jan 5, 2015 at 12:56 AM, Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx> wrote:
Hi,

I have attached the script that I used over the past week or 2 to detect and delete unneeded #includes.  I am not sure whether it is fit for submitting to the tools folder in its current state.

By my count it deleted > 1400 #includes, although:
- not all source files were scanned (e.g. plugins, epan other than dissectors)
- a few includes later needed to be restored

The script works by attempting to build without each #include, and permanently removing all that seem not to be needed.  Ideally, a script like this would be run in the least forgiving environment available and any added warnings seen after a deletion would be treated as failure.  I am currently building under VS 2010 EE, which is maybe the most forgiving environment we support.  The Ubuntu build done by the Petri Dish definitely helped, but new errors were still seen after committing the changes.

My reluctance to commit the script in its current form is because:
- while I hope it was worth running once, I'm not sure it'll be worth doing again.  Having said that, the script has some cowardly rules for not deleting includes that a better version on a less forgiving build environment could discard.  I doubt you could even measure the difference it makes to a clean build time, but hopefully removing some clutter was helpful.
- it is hard-coded to build with nmake.  I'm not sure how best to choose between make/Makefile and nmake/Makefile.nmake
- the results always need to be treated with care, and I wouldn't want someone to  run the script for several hours to find that they can't commit the result.

I'd be very happy if someone wants to further develop and run the script, but unless someone feels differently I'll assume that it shouldn't be committed as it stands.

Best regards,
Martin 
Hi Martin,

May be push your script on tools ? (for don't forget...)



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe