Header Optimization

I am looking for a tool that can do at least one of two things.

  • Guess which headers may be unused and may be deleted.
  • Guess which headers should be included in the file, but included indirectly through the inclusion of other files. Thus, it allows you to compile the file correctly.

Is there such a tool?

+3
source share
2 answers

My colleague wrote a very simple script to achieve some of this (and slow down too ...).

Basically the idea is to try to comment each one includein turn, and then try to compile the object, it does not deal with the inclusion in the headers, but already deletes a significant number of unused files :)

EDIT

for s in sourceFiles:
  while t := commentNextInclude(s):
    if compilationOk(): s := t

, #include , , , , .

script.

+1

GCC "-Wmissing-declarations" "-Wredundant-decls". , , .

+4

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


All Articles