diff options
author | Dodji Seketeli <dodji@redhat.com> | 2012-04-30 11:41:08 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2012-04-30 13:41:08 +0200 |
commit | 4e65a47055ed1e7fb0068125bd95708ed86ab9af (patch) | |
tree | cb06d4cddefb62836bf30b0c556b2a4a8ff20057 | |
parent | b38086f06abab6f679bc6e63d833b8d853a5e04f (diff) | |
download | gcc-4e65a47055ed1e7fb0068125bd95708ed86ab9af.zip gcc-4e65a47055ed1e7fb0068125bd95708ed86ab9af.tar.gz gcc-4e65a47055ed1e7fb0068125bd95708ed86ab9af.tar.bz2 |
Fix cpp_sys_macro_p with -ftrack-macro-expansion
cpp_sys_macro_p crashes when -ftrack-macro-expansion is on. The issue
can be reproduced by running the tests:
runtest --tool gcc --tool_opts="-ftrack-macro-expansion" cpp.exp=sysmac1.c
runtest --tool gcc --tool_opts="-ftrack-macro-expansion" cpp.exp=sysmac2.c
This is because it just doesn't support that mode. Fixed thus.
Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk.
Note that the bootstrap with -ftrack-macro-expansion turned on
exhibits other separate issues that are addressed in subsequent
patches. This patch just fixes one class of problems.
The patch does pass bootstrap with -ftrack-macro-expansion turned off,
though.
libcpp/
* macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion.
From-SVN: r186965
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/macro.c | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 4b66c841..c4f7c5a 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-30 Dodji Seketeli <dodji@redhat.com> + + Fix cpp_sys_macro_p with -ftrack-macro-expansion + * macro.c (cpp_sys_macro_p): Support -ftrack-macro-expansion. + 2012-04-29 Dodji Seketeli <dodji@redhat.com> * lex.c (lex_raw_string): Change C++ style comments into C style 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; } |