Commit 49fe13f6 by Neil Booth Committed by Neil Booth

cpplib.h (struct cpp_reader): Remove references to string_pool and temp_string_pool.

        * 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.

From-SVN: r38336
parent ed972b14
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.
......
......@@ -513,18 +513,12 @@ cpp_create_reader (lang)
/* 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);
......@@ -568,7 +562,6 @@ cpp_cleanup (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);
......
......@@ -539,7 +539,7 @@ parse_number (pfile, number, c, leading_period)
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);
......@@ -618,7 +618,7 @@ unescaped_terminator_p (pfile, dest)
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. */
......@@ -640,7 +640,7 @@ parse_string (pfile, token, 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;
......@@ -738,7 +738,7 @@ save_comment (pfile, token, from)
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;
......@@ -1378,7 +1378,7 @@ cpp_token_as_text (pfile, token)
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';
......
......@@ -457,15 +457,9 @@ do_define (pfile)
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;
}
}
......@@ -531,7 +525,7 @@ glue_header_name (pfile, header)
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;
......@@ -1487,9 +1481,6 @@ parse_assertion (pfile, answerp, type)
/* 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)
......@@ -1507,7 +1498,6 @@ parse_assertion (pfile, answerp, type)
result = cpp_lookup (pfile, sym, len + 1);
}
pfile->string_pool = &pfile->temp_string_pool;
pfile->state.prevent_expansion--;
return result;
}
......
......@@ -512,10 +512,8 @@ struct cpp_reader
/* 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;
......
......@@ -125,7 +125,7 @@ make_number_token (pfile, token, number)
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;
......@@ -162,7 +162,7 @@ builtin_macro (pfile, token)
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;
......@@ -237,7 +237,6 @@ static void
lock_pools (pfile)
cpp_reader *pfile;
{
_cpp_lock_pool (&pfile->temp_string_pool);
_cpp_lock_pool (&pfile->argument_pool);
}
......@@ -245,7 +244,6 @@ static void
unlock_pools (pfile)
cpp_reader *pfile;
{
_cpp_unlock_pool (&pfile->temp_string_pool);
_cpp_unlock_pool (&pfile->argument_pool);
}
......@@ -288,7 +286,7 @@ stringify_arg (pfile, arg)
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;
......@@ -397,10 +395,8 @@ paste_tokens (pfile, lhs, rhs)
{
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment