This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 01/11] Fix cpp_sys_macro_p with -ftrack-macro-expansion
- From: Dodji Seketeli <dodji at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Tom Tromey <tromey at redhat dot com>, Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Sat, 14 Apr 2012 20:05:13 +0200
- Subject: Re: [PATCH 01/11] Fix cpp_sys_macro_p with -ftrack-macro-expansion
- References: <m3hawr8wpz.fsf@redhat.com> <m38vi38wmm.fsf@redhat.com> <4F8589CC.1060106@redhat.com>
Jason Merrill <jason@redhat.com> writes:
> On 04/10/2012 10:55 AM, Dodji Seketeli wrote:
>> + if (CPP_OPTION (pfile, track_macro_expansion))
>
> I think this should check context->tokens_kind rather than the
> compiler flag.
OK.
Below is the updated patch that does that.
Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk.
libcpp/
* macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion.
---
libcpp/macro.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 54de3e3..4f8e52f 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -2436,7 +2436,12 @@ cpp_get_token_with_location (cpp_reader *pfile, source_location *loc)
int
cpp_sys_macro_p (cpp_reader *pfile)
{
- cpp_hashnode *node = pfile->context->c.macro;
+ cpp_hashnode *node = NULL;
+
+ if (pfile->context->tokens_kind == TOKENS_KIND_EXTENDED)
+ node = pfile->context->c.mc->macro_node;
+ else
+ node = pfile->context->c.macro;
return node && node->value.macro && node->value.macro->syshdr;
}
--
Dodji