On Tue, 2023-02-28 at 10:18 +0100, Shengyu Huang wrote:
> Hi Dave,
> 
> Do you want me to follow the steps 7-10
> (https://gcc-newbies-guide.readthedocs.io/en/latest/how-to-improve-th
> e-location-of-a-diagnostic.html) or tell you where I add the code
> simply? Basically, I added
> 
> warning_at (DECL_SOURCE_LOCATION (node->decl), 0, "hello world, I’m
> compiling %qE", node->decl);
> 
> to the loop of cgraph_node inside impl_run_checkrs (logger *logger)
> of analyzer/engine.cc <http://engine.cc/>. 
> 
> (I also tried adding this code to cgraph_node::cgraphunit.cc
> <http://cgraphunit.cc/> in cgraphunit.cc <http://cgraphunit.cc/>, and
> then I found out the warning_at is different in that scope…but inform
> would work.)

Did you get it to output your messages?

The next thing to do might be to try stepping through the code in the
debugger; that's often a good way to learn about a new codebase.  See:
  https://gcc-newbies-guide.readthedocs.io/en/latest/debugging.html
and maybe have a look at the support scripts mentioned on that page.


BTW, are you building trunk, or GCC 12?  I've made a *lot* of changes
to the analyzer in trunk, so it would be good for you to be working
with something that's reasonably up-to-date.

> 
> Best,
> Shengyu
> 
> P.S. Shall I continue put mailing list in my cc? Not sure the
> community wants to receive that many GSoC related emails.

I'd prefer to keep the mailing list involved in the conversation, as
other new contributors to GCC might find the info useful, and other
existing GCC contributors might have input on some of the discussion.

Thanks
Dave

> 
> > On 22 Feb 2023, at 16:43, David Malcolm <dmalc...@redhat.com>
> > wrote:
> > 
> > Sorry, I was unclear; I was referring to this part of my guide:
> > https://gcc-newbies-guide.readthedocs.io/en/latest/getting-started.html#hello-world-from-the-compiler
> > 
> > i.e. try writing a new warning that simply emits something like:
> > 
> > test.c:2:1: warning: hello world, I'm compiling 'main'
> >    2 | int main ()
> >      |     ^~~~
> > 
> > for each function that it sees.
> 

Reply via email to