I'm working on a C++ project with g++. I'm using #pragma
messages to print various diagnostic messages (what parts of classes are being compiled, etc). At first it was useful, but as the inclusion chains started growing, it got out of hand.
When I compile any of my objects, I am guaranteed to get at least 3 messages similar to:
In file included from cgCore.h:10:0
from cgutCore.h:3
from cgutSrvWrapper.h:11
from cgutSrv1.h:5
from cgutSrv1.cpp:9
XnInterface.h:14:17: note: #pragma message: Compiling XnInterface for SERVER use
#pragma message "Compiling XnInterface for SERVER use"
^
When I do a full build, I get hundreds of them. I want the actual message (XnInterface.h:14...) printed, but not the rest of it. I don't really care where it was included from in this context, and it makes actual warnings difficult to spot.
I figured out I can disable the last two lines with -fno-diagnostics-show-caret
, but cannot find an option to not print the include chain.
I don't want to include them as system headers with -i/INCLUDE
because then the entire message is removed. Is it possible to just disable the inclusion chain? The g++ manpage was not designed for late-night reading, so I admit I may have missed something.
Google was no help. I couldn't come up with a search query that would return even related results.
The relevant code from XnInterface.h, fwiw:
#ifndef __CGUT_SERVER
...non-server code...
#else
#pragma message "Compiling XnInterface for SERVER use"
...munged server code...
#endif
And, on a related note, God forbid I upset Boost. It barfed so hard I had to catch it with less. Most of it was "In file included from..."
Any and all help is greatly appreciated!!
Referring to the GCC source, diagnostic.c
, function diagnostic_report_current_module
, line 528, the loop occurs unconditionally after printing the name of the offending file. You can modify that and rebuild GCC, else you're out of luck.