Re: Adding new rule into compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-06-06 02:02 +0800, 李宗霖 wrote:
> Hello,
> 
> I'm a gcc beginner from Taiwan.
> Nice to meet you.
> 
> I would like to add some new rule into compiler so that it can detect the
> extra error/warning.
> But I don't know which file is the one do the action.
> Can you give some advice about the relationship of gcc files?

info gccint.  Though it is quite outdated :(

Generally at first you should add an option like "Wfoo" in common.opt or other
(language specific) opt file, for e.g.:

Wfoo
Common Var(flag_warn_foo) Warning
Warn about misusage of foo.

Then you can get the value of this option from the variable flag_warn_foo in
(auto generated) options.h.

Then just implement the warning option (call warning_at to output the
diagnostic) in language FE or the middle end.

At last add a test for -Wfoo in gcc/testsuite/gcc.dg (for C) or
gcc/testsuite/g++.dg (for C++).  Now you can build modified GCC and run the
testsuite to make sure there is no regression, and -Wfoo is working properly.
-- 
Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux