This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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_MACRO.
> 
> I think that should work.

Though, for all such changes consider what will happen if people
compile with -save-temps, or preprocess separately from compilation (ccache
etc.).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]