aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-12 23:46:05 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-12 23:46:05 +0000
commitd35364d13e14ba0eea541a77484c716f1cf82195 (patch)
treea98d122ee7a482f328ecd041626122a0cd1beaa8 /gcc/cpplib.h
parent6973bf5482d8a5a150c3ee1424bf7e154e61dd51 (diff)
downloadgcc-d35364d13e14ba0eea541a77484c716f1cf82195.zip
gcc-d35364d13e14ba0eea541a77484c716f1cf82195.tar.gz
gcc-d35364d13e14ba0eea541a77484c716f1cf82195.tar.bz2
Convert cpplib to use libiberty/hashtab.c.
* cpplib.h (struct cpp_reader): Make hashtab and all_include_files of type 'struct htab *'. Delete HASHSIZE and ALL_INCLUDE_HASHSIZE macros. * cpphash.h: Update prototypes. (struct hashnode): Remove next, prev, and bucket_hdr members. Make length a size_t. Add hash member. (struct ihash): Remove next member. Add hash member. Make name a flexible array member. * cppfiles.c: Include hashtab.h. (include_hash): Delete. (IHASHSIZE): New macro. (hash_IHASH, eq_IHASH, _cpp_init_include_hash): New functions. (cpp_included): Do the hash lookup here. (_cpp_find_include_file): Rewrite. (cpp_read_file): Put the "fake" hash entry into the hash table. Honor the control_macro, if it turns out we've seen the file before. Don't push the buffer here. (_cpp_read_include_file): Push the buffer here. (OMODES): New macro. Use it whenever we call open(2). * cpphash.c: Include hashtab.h. (hash_HASHNODE, eq_HASHNODE, del_HASHNODE, dump_hash_helper, _cpp_init_macro_hash, _cpp_dump_macro_hash, _cpp_make_hashnode, _cpp_lookup_slot): New functions. (HASHSIZE): new macro. (hashf, _cpp_install, _cpp_delete_macro): Delete. (_cpp_lookup): Use hashtab.h routines. * cppinit.c: Include hashtab.h. (cpp_reader_init): Call _cpp_init_macro_hash and _cpp_init_include_hash. Don't allocate hashtab directly. (cpp_cleanup): Just call htab_delete on pfile->hashtab and pfile->all_include_files. (initialize_builtins): Use _cpp_make_hashnode and htab_find_slot to add hash entries. (cpp_finish): Just call _cpp_dump_macro_hash. * cpplib.c: Include hashtab.h. (do_define): Use _cpp_lookup_slot and _cpp_make_hashnode to create hash entries. (do_pragma_poison, do_assert): Likewise. (do_include): Don't push the buffer here. Don't increment system_include_depth unless _cpp_read_include_file succeeds. (do_undef, do_unassert): Use _cpp_lookup_slot and htab_clear_slot or htab_remove_elt. (do_pragma_implementation): Use alloca to create copy. * Makefile.in: Update dependencies. From-SVN: r32497
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 85b1df2..7906d0c 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -121,6 +121,7 @@ struct cpp_buffer
};
struct file_name_map_list;
+struct htab;
/* Maximum nesting of cpp_buffers. We use a static limit, partly for
efficiency, and partly to limit runaway recursion. */
@@ -155,12 +156,10 @@ struct cpp_reader
int buffer_stack_depth;
/* Hash table of macros and assertions. See cpphash.c */
-#define HASHSIZE 1403
- struct hashnode **hashtab;
+ struct htab *hashtab;
/* Hash table of other included files. See cppfiles.c */
-#define ALL_INCLUDE_HASHSIZE 71
- struct ihash *all_include_files[ALL_INCLUDE_HASHSIZE];
+ struct htab *all_include_files;
/* Chain of `actual directory' file_name_list entries,
for "" inclusion. */
@@ -503,7 +502,6 @@ extern void output_line_command PARAMS ((cpp_reader *,
extern int cpp_included PARAMS ((cpp_reader *, const char *));
extern int cpp_read_file PARAMS ((cpp_reader *, const char *));
-
#ifdef __cplusplus
}
#endif