Tags out of gcc

2014-10-04 Thread Adrian May
Hi All, I have this brainstorm which I'd like to get some feedback on. I reckon it's a bad idea to make source browsing info with a separate program like cscope or etags. I reckon it's the compiler's job. Why? (1) Because only the compiler can do it authoritatively, after all, it decides what's

Re: Tags out of gcc

2014-10-04 Thread Richard Kenner
> I reckon it's a bad idea to make source browsing info with a separate > program like cscope or etags. I reckon it's the compiler's job. One of the issues with soure browsing is that you want to be able to do it in the presence of syntax errors. That can make it harder for the compiler to do it

Re: Tags out of gcc

2014-10-04 Thread Adrian May
Well it seems to be able to report a lot of syntax errors even if they're close together, so it must be getting back on its feet fairly quickly. I don't know how that works. Maybe it just scoots along to the next semicolon or maybe you explicitly have productions like "if (syntax error) { ... }".

Re: Tags out of gcc

2014-10-04 Thread Richard Kenner
> Well it seems to be able to report a lot of syntax errors even if > they're close together, so it must be getting back on its feet fairly > quickly. I don't know how that works. Maybe it just scoots along to > the next semicolon or maybe you explicitly have productions like "if > (syntax error) {

RE: Tags out of gcc

2014-10-04 Thread Manuel López-Ibáñez
> I imagine doing it for c++ and outputting cscope format which is > reasonably expressive and popular. > > I have no idea how hard it would be, but if I can bug people for help > I'd be willing to give it a shot. There are two ways to do this with GCC. One is trivial and one is hard, but the hard

Re: Tags out of gcc

2014-10-04 Thread Jonathan Wakely
On 4 October 2014 15:47, Manuel López-Ibáñez wrote: > The trivial one is that you build a plugin > (https://gcc.gnu.org/onlinedocs/gccint/Plugins.html) and hook it at > PLUGIN_FINISH_DECL (and perhaps also at PLUGIN_FINISH_TYPE, not sure > about that). You can then run the plugin in the same comman

Re: Tags out of gcc

2014-10-04 Thread Manuel López-Ibáñez
On 4 October 2014 21:07, Jonathan Wakely wrote: > On 4 October 2014 15:47, Manuel López-Ibáñez wrote: >> The trivial one is that you build a plugin >> (https://gcc.gnu.org/onlinedocs/gccint/Plugins.html) and hook it at >> PLUGIN_FINISH_DECL (and perhaps also at PLUGIN_FINISH_TYPE, not sure >> abou

Re: Tags out of gcc

2014-10-04 Thread Adrian May
At first sight, I prefer the hooks approach. Not just cos I'm a noob (although that is a compelling reason in itself) but also because it happens during the main compile. A separate innovation could have different flags so it wouldn't be authoritative anymore. But it absolutely has to follow the p