I want to dump something when I compile the program. How should I do ?

冠人 王 via gcc gcc@gcc.gnu.org
Thu May 17 06:17:00 GMT 2018


My work is to modify the gcc source code so as to customize the warning message, when the programmer writing the program violating some rules. 
When the violation occurs, I want to reveal some message such as "guanjen375 warning: the rule ### is violated" on the window.
How should I do ? Should I modify some file in the gcc source code so that I can print my own message?
Besides, I want to realize how GCC code executed, so I want to insert some code into GCC source code to check waht happens when those code
be executed. I try to use "printf" but failed, the message I print reveals when I make(after configure), but not reveals at compile time
If you do not really understand what do I say, let me show an example:
$gcc -Wunused test.c
test.c:5:6: warning: unused variable ‘a’ [-Wunused-variable]  int a;      ^
becomes
$gcc -Wunused test.c
HI,DAVIDtest.c:5:6: warning: unused variable ‘a’ [-Wunused-variable]  int a;      ^



More information about the Gcc mailing list