Search code examples
gccmakefilearmcc

Detect large files being included while compiling


I'm using armcc/gcc for a code base that contains large header files (>20MB hardware CSR files). I want to be able to detect any file that includes this large header file, since I'm trying to root-cause my super-slow build.

Is there an option I could use in one of these compilers to warn me about the size of a file (including the size of the headers that it might be including)?


Solution

  • You can put to your large header file:

    #warning This large header is included
    

    Then in every translation unit you'll get a compiller (GCC) warning message pointing you to what source file has that header included (directly or indirectly).