This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Way to tell in libcpp if something is a macro...
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Ed Smith-Rowland <3dw4rd at verizon dot net>, gcc-patches <gcc at gcc dot gnu dot org>
- Date: Wed, 26 Jun 2013 19:41:32 +0200
- Subject: Re: Way to tell in libcpp if something is a macro...
- References: <51CB0DF0 dot 1000505 at verizon dot net> <87wqpgpy9m dot fsf at fleche dot redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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