Re: Way to tell in libcpp if something is a macro...

2013-06-26 Thread Tom Tromey
Jakub> Though, for all such changes consider what will happen if people Jakub> compile with -save-temps, or preprocess separately from Jakub> compilation (ccache etc.). Yes, good point. It is useful as a hack but doubtful in other ways. Tom

Re: Way to tell in libcpp if something is a macro...

2013-06-26 Thread Jakub Jelinek
On Wed, Jun 26, 2013 at 11:39:17AM -0600, Tom Tromey wrote: > Call ht_lookup and convert to a cpp hash node, e.g., from grepping: > > return CPP_HASHNODE (ht_lookup (pfile->hash_table, > buf, bufp - buf, HT_ALLOC)); > > Then see if the node's 'type' field is NT_

Re: Way to tell in libcpp if something is a macro...

2013-06-26 Thread Tom Tromey
> "Ed" == Ed Smith-Rowland <3dw...@verizon.net> writes: Ed> I have a situation where I would like to detect if a string is a Ed> currently defined macro. Ed> Something like a Ed> bool cpp_is_macro(const unsigned char *); Ed> would be great. Ed> Or perhaps I could construct something from t

Way to tell in libcpp if something is a macro...

2013-06-26 Thread Ed Smith-Rowland
Greetings, I have a situation where I would like to detect if a string is a currently defined macro. Something like a bool cpp_is_macro(const unsigned char *); would be great. Or perhaps I could construct something from the string and test that. If something like this doesn't exist does