On Thu, May 17 2018, 冠人 王 via gcc wrote:
> 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

For this purpose, use fprintf to write your debug message to stderr.

> 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;  
>     ^

Reply via email to