Automatically delete unnecessary #include statements

Possible duplicates:
C / C ++: Detecting redundant #includes?
How can I detect unnecessary #include files in a large C ++ project?

Hello,

I have discussed numerous discussions on how to reduce build time for C / C ++ projects. Usually a good optimization is to get rid of #include statements using forward declarations. Now I was wondering:

Maybe a tool that can calculate the #include dependency tree between the header of C / C ++ files (I know that mkdep on Linux can do this), and then starts the "delete header file / recompile" cycle? It would be great if the tool could try to remove nodes from the dependency tree (for example, remove #include statments from files) and then rebuild the project to see if everything works.

You don’t have to be very smart (for example, refactoring the code to make header files unnecessary with pointers instead of values, etc.), but I believe that many of the projects I worked on had simple unnecessary #include instructions. This usually happens with refactoring code and moving it, but then forgets to take #include.

Does anyone know if such a tool exists?

+3
1

, . , , hilight multiple .. (, , doxygen), . , anser "" - , !

+1

Source: https://habr.com/ru/post/1713431/


All Articles