Search code examples
gccg++gcc-warningbuildbot

Split gcc output by thread/job


I want to do statistics on compiler warnings per compilation unit based on the compiler output of gcc/g++. This is no problem with -j1 but with multiple threads, e.g. -j4, the output is completely mixed. Can I either

  • get the compiler to write the output per compiler thread to different files/outputs or
  • "atomically" print all output/warnings for a single compilation unit together?

I'm using gcc/g++ 8.1 and (if this helps) buildbot.


Solution

  • Recent enough versions of GNU make have an option, -O, which controls the behavior of parallel output:

    It is a good idea to specify -O each time you request a parallel build with a -j option.