Wireshark-dev: [Wireshark-dev] Deleting unused header file inclusions (revisited)
From: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
Date: Mon, 18 May 2020 20:59:28 +0100
Hi,

Do we want to prune unnecessary header file inclusions?  In https://code.wireshark.org/review/#/c/37210/, I have updated tools/delete_includes.py and run it on epan/dissectors.

There are some uncontroversial ones I think, e.g. including <stdio.h> where it isn't needed (maybe someone added some printf() calls and forgot to delete it)?

There are quite a few where a dissector references the header file of another dissector,  but usually only ends up extern'ing the proto entry. or looking up the dissector by name.

But then there are header files that I think maybe it used to be necessary to explicitly include but now are hard to avoid pulling in.  Just by including epan.h, you will already have prefs.h, so there is no need to explicitly include it.  In that case would you rather see it explicitly be included?  For me, my IDE will jump to the header file anyway (I tend to copy code from another dissector then include the header file if I need to).

The changes in gerrit are somewhere in the middle -  I am removing some  header files where they are really not used (e.g. epan/expert.h), but leaving in e.g. epan/tap.h.  Because it took quite a few hours to run, the changes don't exactly correspond to the script, but they are close.

I am not emotionally attached to this change, though I would like to commit the updated script and at least the most obvious ones.  I doubt it will make a measurable difference to compile-time, but it was my very first python script and it previously only worked with automake rather than cmake :)

Best regards,
Martin