This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Merge cpplib and front end hashtables, part 1
Neil Booth wrote:-
> Scrap this. I've got a better idea. You give cpplib some text you
> want macro expanded. You don't give cpplib any macro definitions, but
> instead give it a callback where it enquires whether a macro is
> defined at that location in the source file. GDB does it's stuff to
> figure that out, which I imagine is pretty easy and fast.
>
> If so, your callback routine calls cpp_define () with the macro
> definition, and returns to cpplib, which continues to try to expand
> the macro expression.
>
> This way, we can do lazy insertion of macros and be very efficient
> about it, and fully free them all after the one expansion. Yeah!
> However, this callback check would get in cpplib's fast path I think;
> we'd need to be careful we don't penalize GCC to a noticable extent to
> benefit GDB.
The more I think about this, the more I like it. It'd only be a
couple of lines in cpp_get_token, which we could conditionally compile
in a #ifdef ... #endif so as not to hurt GCC, and one or two in
another place to give you a way to flush macro memory, and that'd be
it. I'll try and knock something up in the next day or so.
Cheers,
Neil.
- References:
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1
- Re: Merge cpplib and front end hashtables, part 1