summaryrefslogtreecommitdiff
path: root/libcpp/macro.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-01 18:20:48 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-01 18:20:48 +0000
commit1991d8eb5a4d38308b69ac0c51ef8982936de173 (patch)
treed2d010b50cd8299a7b0f4980f1321627be3431c2 /libcpp/macro.c
parent8c3d82bd0df7e8db842f4c6efbaed6354954a2b7 (diff)
downloadgcc-1991d8eb5a4d38308b69ac0c51ef8982936de173.tar.gz
libcpp
PR preprocessor/30805: * macro.c (paste_tokens): Handle padding token. (paste_tokens): Don't abort unless padding has PASTE_LEFT flag. gcc/testsuite PR preprocessor/30805: * gcc.dg/cpp/pr30805.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129827 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 50bb34ded5f..f3a4420ae40 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -451,7 +451,9 @@ paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs)
false doesn't work, since we want to clear the PASTE_LEFT flag. */
if ((*plhs)->type == CPP_DIV && rhs->type != CPP_EQ)
*end++ = ' ';
- end = cpp_spell_token (pfile, rhs, end, false);
+ /* In one obscure case we might see padding here. */
+ if (rhs->type != CPP_PADDING)
+ end = cpp_spell_token (pfile, rhs, end, false);
*end = '\n';
cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true);
@@ -514,8 +516,10 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
rhs = *FIRST (context).ptoken++;
if (rhs->type == CPP_PADDING)
- abort ();
-
+ {
+ if (rhs->flags & PASTE_LEFT)
+ abort ();
+ }
if (!paste_tokens (pfile, &lhs, rhs))
break;
}