This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
I want to dump something when I compile the program. How should I do ?
- From: "冠人 王 via gcc" <gcc at gcc dot gnu dot org>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 17 May 2018 06:17:20 +0000 (UTC)
- Subject: I want to dump something when I compile the program. How should I do ?
- References: <1203265537.2309564.1526537840163.ref@mail.yahoo.com>
- Reply-to: 冠人 王 <guanjen375 at yahoo dot com dot tw>
- Reply-to: 冠人 王 <guanjen375 at yahoo dot com dot tw>
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; ^