+2000-12-17 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cpplib.h (struct cpp_reader): Remove references to string_pool
+ and temp_string_pool.
+ * cppinit.c (cpp_create_reader, cpp_cleanup): Similarly; using
+ ident_pool in place.
+ * cpplex.c (parse_number, unescaped_terminator_p, parse_string,
+ save_comment, cpp_token_as_text): Similarly.
+ * cpplib.c (do_define, glue_header_name, parse_assertion): Similarly.
+ * cppmacro.c (make_number_token, builtin_macro, lock_pools,
+ unlock_pools, stringify_arg, paste_tokens): Similarly.
+
Sun Dec 17 12:41:48 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* dwarf2out.c (loc_descriptor_from_tree, case NOP_EXPR): New case.
/* Identifier pool initially 8K. Unaligned, permanent pool. */
_cpp_init_pool (&pfile->ident_pool, 8 * 1024, 1, 0);
- /* String and number pool initially 4K. Unaligned, temporary pool. */
- _cpp_init_pool (&pfile->temp_string_pool, 4 * 1024, 1, 1);
-
/* Argument pool initially 8K. Aligned, temporary pool. */
_cpp_init_pool (&pfile->argument_pool, 8 * 1024, 0, 1);
/* Macro pool initially 8K. Aligned, permanent pool. */
_cpp_init_pool (&pfile->macro_pool, 8 * 1024, 0, 0);
- /* Start with temporary pool. */
- pfile->string_pool = &pfile->temp_string_pool;
-
_cpp_init_hashtable (pfile);
_cpp_init_stacks (pfile);
_cpp_init_includes (pfile);
_cpp_free_lookaheads (pfile);
_cpp_free_pool (&pfile->ident_pool);
- _cpp_free_pool (&pfile->temp_string_pool);
_cpp_free_pool (&pfile->macro_pool);
_cpp_free_pool (&pfile->argument_pool);
int leading_period;
{
cpp_buffer *buffer = pfile->buffer;
- cpp_pool *pool = pfile->string_pool;
+ cpp_pool *pool = &pfile->ident_pool;
unsigned char *dest, *limit;
dest = POOL_FRONT (pool);
if (pfile->state.angled_headers)
return 1;
- start = POOL_FRONT (pfile->string_pool);
+ start = POOL_FRONT (&pfile->ident_pool);
/* An odd number of consecutive backslashes represents an escaped
terminator. */
cppchar_t terminator;
{
cpp_buffer *buffer = pfile->buffer;
- cpp_pool *pool = pfile->string_pool;
+ cpp_pool *pool = &pfile->ident_pool;
unsigned char *dest, *limit;
cppchar_t c;
unsigned int nulls = 0;
line, which we don't want to save in the comment. */
if (pfile->buffer->read_ahead != EOF)
len--;
- buffer = _cpp_pool_alloc (pfile->string_pool, len);
+ buffer = _cpp_pool_alloc (&pfile->ident_pool, len);
token->type = CPP_COMMENT;
token->val.str.len = len;
const cpp_token *token;
{
unsigned int len = cpp_token_len (token);
- unsigned char *start = _cpp_pool_alloc (&pfile->temp_string_pool, len), *end;
+ unsigned char *start = _cpp_pool_alloc (&pfile->ident_pool, len), *end;
end = cpp_spell_token (pfile, token, start);
end[0] = '\0';
if (node)
{
- /* Use the permanent pool for storage. */
- pfile->string_pool = &pfile->ident_pool;
-
if (_cpp_create_definition (pfile, node))
if (pfile->cb.define)
(*pfile->cb.define) (pfile, node);
-
- /* Revert to the temporary pool. */
- pfile->string_pool = &pfile->temp_string_pool;
}
}
cpp_error (pfile, "missing terminating > character");
else
{
- token_mem = _cpp_pool_alloc (pfile->string_pool, total_len);
+ token_mem = _cpp_pool_alloc (&pfile->ident_pool, total_len);
memcpy (token_mem, buffer, total_len);
header->type = CPP_HEADER_NAME;
/* We don't expand predicates or answers. */
pfile->state.prevent_expansion++;
- /* Use the permanent pool for storage (for the answers). */
- pfile->string_pool = &pfile->ident_pool;
-
*answerp = 0;
cpp_get_token (pfile, &predicate);
if (predicate.type == CPP_EOF)
result = cpp_lookup (pfile, sym, len + 1);
}
- pfile->string_pool = &pfile->temp_string_pool;
pfile->state.prevent_expansion--;
return result;
}
/* Memory pools. */
cpp_pool ident_pool; /* For all identifiers, and permanent
numbers and strings. */
- cpp_pool temp_string_pool; /* For temporary numbers and strings. */
cpp_pool macro_pool; /* For macro definitions. Permanent. */
cpp_pool argument_pool; /* For macro arguments. Temporary. */
- cpp_pool* string_pool; /* Either temp_string_pool or ident_pool. */
/* Context stack. */
struct cpp_context base_context;
cpp_token *token;
int number;
{
- unsigned char *buf = _cpp_pool_alloc (pfile->string_pool, 20);
+ unsigned char *buf = _cpp_pool_alloc (&pfile->ident_pool, 20);
sprintf ((char *) buf, "%d", number);
token->type = CPP_NUMBER;
buffer = buffer->prev;
name = buffer->nominal_fname;
- make_string_token (pfile->string_pool, token,
+ make_string_token (&pfile->ident_pool, token,
(const unsigned char *) name, strlen (name));
}
break;
lock_pools (pfile)
cpp_reader *pfile;
{
- _cpp_lock_pool (&pfile->temp_string_pool);
_cpp_lock_pool (&pfile->argument_pool);
}
unlock_pools (pfile)
cpp_reader *pfile;
{
- _cpp_unlock_pool (&pfile->temp_string_pool);
_cpp_unlock_pool (&pfile->argument_pool);
}
cpp_reader *pfile;
macro_arg *arg;
{
- cpp_pool *pool = pfile->string_pool;
+ cpp_pool *pool = &pfile->ident_pool;
unsigned char *start = POOL_FRONT (pool);
unsigned int i, escape_it, total_len = 0, backslash_count = 0;
{
unsigned int total_len = cpp_token_len (lhs) + cpp_token_len (rhs);
unsigned char *result, *end;
- cpp_pool *pool;
- pool = type == CPP_NAME ? &pfile->ident_pool: pfile->string_pool;
- result = _cpp_pool_alloc (pool, total_len + 1);
+ result = _cpp_pool_alloc (&pfile->ident_pool, total_len + 1);
/* Paste the spellings and null terminate. */
end = cpp_spell_token (pfile, rhs, cpp_spell_token (pfile, lhs, result));