+2003-04-24 Neil Booth <neil@daikokuya.co.uk>
+
+ * cpplex.c (cpp_token_len): Tighten up.
+ (cpp_token_as_text): Need extra byte now.
+ * cpplib.c (glue_header_name): Need extra 2 bytes.
+ * cppmacro.c (cpp_macro_definition): Need extra byte.
+
2003-04-24 Alexander Kabaev <kan@FreeBSD.ORG>
* config/sparc/sparc.md (umulsidi3, mulsidi3): Avoid using
return result;
}
-/* An upper bound on the number of bytes needed to spell TOKEN,
- including preceding whitespace. */
+/* An upper bound on the number of bytes needed to spell TOKEN.
+ Does not include preceding whitespace. */
unsigned int
cpp_token_len (token)
const cpp_token *token;
switch (TOKEN_SPELL (token))
{
- default: len = 0; break;
+ default: len = 4; break;
case SPELL_LITERAL: len = token->val.str.len; break;
case SPELL_IDENT: len = NODE_LEN (token->val.node); break;
}
- /* 1 for whitespace, 4 for comment delimiters. */
- return len + 5;
+
+ return len;
}
/* Write the spelling of a token TOKEN to BUFFER. The buffer must
cpp_token_as_text (pfile, token)
cpp_reader *pfile;
const cpp_token *token;
-{
- unsigned int len = cpp_token_len (token);
+{
+ unsigned int len = cpp_token_len (token) + 1;
unsigned char *start = _cpp_unaligned_alloc (pfile, len), *end;
end = cpp_spell_token (pfile, token, start);
break;
}
- len = cpp_token_len (token);
+ len = cpp_token_len (token) + 2; /* Leading space, terminating \0. */
if (total_len + len > capacity)
{
capacity = (capacity + len) * 2;
if (token->type == CPP_MACRO_ARG)
len += NODE_LEN (macro->params[token->val.arg_no - 1]);
else
- len += cpp_token_len (token); /* Includes room for ' '. */
+ len += cpp_token_len (token) + 1; /* Includes room for ' '. */
if (token->flags & STRINGIFY_ARG)
len++; /* "#" */
if (token->flags & PASTE_LEFT)