diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-05-20 06:26:45 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-05-20 06:26:45 +0000 |
commit | 2a967f3d3a45294640e155381ef549e0b8090ad4 (patch) | |
tree | 31a2cc3c54959e2908bad78e488472f5e3ce3d69 /gcc/cpplex.c | |
parent | 9e800206badd2be563d344e4a0aee83e3ac96f03 (diff) | |
download | gcc-2a967f3d3a45294640e155381ef549e0b8090ad4.zip gcc-2a967f3d3a45294640e155381ef549e0b8090ad4.tar.gz gcc-2a967f3d3a45294640e155381ef549e0b8090ad4.tar.bz2 |
Makefile.in (OBJS, [...]): Update.
* Makefile.in (OBJS, LIBCPP_OBJS, LIBCPP_DEPS,
cpplib.o, cpphash.o, fix-header): Update.
(hashtable.o): New target.
* c-common.h: Include cpplib.h. Define C_RID_CODE and
struct c_common_identifier here.
* c-lang.c (c_init_options): Update. Call set_identifier_size.
* c-lex.c (c_lex): Update.
* c-pragma.h: Update.
* c-tree.h (struct lang_identifier): Contain c_common_identifier.
Delete rid_code.
(C_RID_CODE): Delete.
* cpphash.c: Rewrite to use hashtable.c.
* cpphash.h: Update include guards.
(struct cpp_reader): Remove hashtab.
hash_ob and buffer_ob are no longer pointers. Add hash_table
and our_hashtable.
(HASHSTEP, _cpp_init_hashtable, _cpp_lookup_with_hash): Delete.
(_cpp_cleanup_hashtable): Rename _cpp_destroy_hashtable.
(_cpp_cleanup_stacks): Rename _cpp_init_directives.
* cppinit.c (cpp_create_reader): Update.
* cpplex.c (cpp_ideq, parse_identifier, cpp_output_token): Update.
(cpp_interpret_charconst): Eliminate warning.
* cpplib.c (do_pragma, do_endif, push_conditional,
cpp_push_buffer, cpp_pop_buffer): Update.
(_cpp_init_stacks): Rename cpp_init_directives.
(_cpp_cleanup_stacks): Remove.
* cpplib.h: Update include guards. Include tree-core.h and c-rid.h.
(cpp_hashnode, cpp_token, NODE_LEN, NODE_NAME,
cpp_forall_identifiers, cpp_create_reader): Update.
(C_RID_CODE, cpp_make_node): New.
(c_common_identifier): New identifier node for C front ends.
* cppmain.c (main): Update.
* fix-header.c (read_scan_file): Update.
* flags.h (id_clash_len): Make unsigned.
* ggc.h (ggc_mark_nonnull_tree): New.
* hashtable.c: New.
* hashtable.h: New.
* stringpool.c: Update comments and copyright. Update to use
hashtable.c.
* toplev.c (approx_sqrt): Move to hashtable.c.
(id_clash_len): Make unsigned.
* toplev.h (ident_hash): New.
* tree.c (gcc_obstack_init): Move to hashtable.c.
* tree.h: Include hashtable.h.
(IDENTIFIER_POINTER, IDENTIFIER_LENGTH): Update.
(GCC_IDENT_TO_HT_IDENT, HT_IDENT_TO_GCC_IDENT): New.
(struct tree_identifier): Update.
(make_identifier): New.
cp:
* cp-tree.h (struct lang_identifier, C_RID_YYCODE): Update.
(C_RID_CODE): Remove.
* lex.c (cxx_init_options): Call set_identifier_size. Update.
(init_parse): Don't do it here.
objc:
* objc-act.c (objc_init_options): Call set_identifier_size. Update.
From-SVN: r42334
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r-- | gcc/cpplex.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 30f739d..290d339 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -479,22 +479,14 @@ parse_identifier (pfile, c) { cpp_hashnode *result; cpp_buffer *buffer = pfile->buffer; - unsigned char *dest, *limit; - unsigned int r = 0, saw_dollar = 0; - - dest = POOL_FRONT (&pfile->ident_pool); - limit = POOL_LIMIT (&pfile->ident_pool); + unsigned int saw_dollar = 0, len; + struct obstack *stack = &pfile->hash_table->stack; do { do { - /* Need room for terminating null. */ - if (dest + 1 >= limit) - limit = _cpp_next_chunk (&pfile->ident_pool, 0, &dest); - - *dest++ = c; - r = HASHSTEP (r, c); + obstack_1grow (stack, c); if (c == '$') saw_dollar++; @@ -524,11 +516,12 @@ parse_identifier (pfile, c) cpp_pedwarn (pfile, "'$' character(s) in identifier"); /* Identifiers are null-terminated. */ - *dest = '\0'; + len = obstack_object_size (stack); + obstack_1grow (stack, '\0'); /* This routine commits the memory if necessary. */ - result = _cpp_lookup_with_hash (pfile, - dest - POOL_FRONT (&pfile->ident_pool), r); + result = (cpp_hashnode *) + ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED); /* Some identifiers require diagnostics when lexed. */ if (result->flags & NODE_DIAGNOSTIC && !pfile->skipping) @@ -1905,7 +1898,8 @@ cpp_interpret_charconst (pfile, token, warn_multi, traditional, pchars_seen) const unsigned char *limit = str + token->val.str.len; unsigned int chars_seen = 0; unsigned int width, max_chars, c; - HOST_WIDE_INT result = 0, mask; + unsigned HOST_WIDE_INT mask; + HOST_WIDE_INT result = 0; #ifdef MULTIBYTE_CHARS (void) local_mbtowc (NULL, NULL, 0); |