diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-03-30 17:00:52 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-03-30 17:00:52 +0200 |
commit | a37a7b8a0199e76227055ed537c54ddd022eb8a5 (patch) | |
tree | bc2a897e2a2dd4b1d895bf4aa97e109f744873b2 /libcpp | |
parent | 665733c1215086f71896682d631dd03aec7710d2 (diff) | |
download | gcc-a37a7b8a0199e76227055ed537c54ddd022eb8a5.zip gcc-a37a7b8a0199e76227055ed537c54ddd022eb8a5.tar.gz gcc-a37a7b8a0199e76227055ed537c54ddd022eb8a5.tar.bz2 |
re PR target/39558 (Bad interaction of decls named 'vector' and -maltivec vector support)
PR target/39558
* macro.c (cpp_get_token): If macro_to_expand returns NULL
and used some tokens, add CPP_PADDING before next token.
* gcc.target/powerpc/altivec-29.c: New test.
From-SVN: r145297
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 6 | ||||
-rw-r--r-- | libcpp/macro.c | 34 |
2 files changed, 36 insertions, 4 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index a9841c7..4bf5869 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2009-03-30 Jakub Jelinek <jakub@redhat.com> + + PR target/39558 + * macro.c (cpp_get_token): If macro_to_expand returns NULL + and used some tokens, add CPP_PADDING before next token. + 2009-03-29 Joseph Myers <joseph@codesourcery.com> PR preprocessor/34695 diff --git a/libcpp/macro.c b/libcpp/macro.c index 3a20c36..fc70be6 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1260,10 +1260,36 @@ cpp_get_token (cpp_reader *pfile) /* Conditional macros require that a predicate be evaluated first. */ - if (((!(node->flags & NODE_CONDITIONAL)) - || (pfile->cb.macro_to_expand - && (node = pfile->cb.macro_to_expand (pfile, result)))) - && (ret = enter_macro_context (pfile, node, result))) + if ((node->flags & NODE_CONDITIONAL) != 0) + { + if (pfile->cb.macro_to_expand) + { + bool whitespace_after; + const cpp_token *peek_tok = cpp_peek_token (pfile, 0); + + whitespace_after = (peek_tok->type == CPP_PADDING + || (peek_tok->flags & PREV_WHITE)); + node = pfile->cb.macro_to_expand (pfile, result); + if (node) + ret = enter_macro_context (pfile, node, result); + else if (whitespace_after) + { + /* If macro_to_expand hook returned NULL and it + ate some tokens, see if we don't need to add + a padding token in between this and the + next token. */ + peek_tok = cpp_peek_token (pfile, 0); + if (peek_tok->type != CPP_PADDING + && (peek_tok->flags & PREV_WHITE) == 0) + _cpp_push_token_context (pfile, NULL, + padding_token (pfile, + peek_tok), 1); + } + } + } + else + ret = enter_macro_context (pfile, node, result); + if (ret) { if (pfile->state.in_directive || ret == 2) continue; |