diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2000-07-18 00:59:49 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-07-18 00:59:49 +0000 |
commit | 711b88243b220e3cd737696da51de70f32bb7d5c (patch) | |
tree | a8929adb35764d62c4016b482a4cb4b619be00cb /gcc/cpphash.h | |
parent | 5d8fcdcb2ddbd52a35621a7880cf268c50a54027 (diff) | |
download | gcc-711b88243b220e3cd737696da51de70f32bb7d5c.zip gcc-711b88243b220e3cd737696da51de70f32bb7d5c.tar.gz gcc-711b88243b220e3cd737696da51de70f32bb7d5c.tar.bz2 |
[multiple changes]
2000-02-17 Zack Weinberg <zack@wolery.cumb.org>
* cpphash.c: Don't include hashtab.h. Most macro-handling code
moved to cppmacro.c.
(hash_HASHNODE, eq_HASHNODE, _cpp_dump_macro_hash,
dump_hash_helper): Delete.
(expand_hash, higher_prime_number, _cpp_lookup_with_hash,
cpp_forall_identifiers): New. Implement specialized version of
Vlad's expandable hash table.
(cpp_lookup): Use new functions.
(_cpp_init_macros, _cpp_cleanup_macros): Adjust for new
implementation.
* cppmacro.c: New file.
* cppinit.c (dump_macros_helper): New.
(cpp_finish): Iterate over the identifier table directly.
* cpplex.c (parse_name): Calculate the hash of the identifier
while we scan it. Use _cpp_lookup_with_hash when we can.
* cpphash.h: Update prototypes.
(xcnewvec, HASHSTEP): New helper macros.
* cpplib.h: Update prototypes.
* Makefile.in (LIBCPP_OBJS): Add cppmacro.o.
(cppmacro.o): New rule.
(cpphash.o): Update deps.
* cppmain.c: Do not set pfile->printer if no_output is on.
2000-02-15 Neil Booth <neilb@earthling.net>
* cpplib.c: Change all directive-handler functions to return
void, not int.
* cpphash.h: Update typedefs.
From-SVN: r35113
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r-- | gcc/cpphash.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 5f4f86b..98fcbb6 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -72,7 +72,7 @@ struct answer #define COMMENTS (1 << 3) /* Defines one #-directive, including how to handle it. */ -typedef int (*directive_handler) PARAMS ((cpp_reader *)); +typedef void (*directive_handler) PARAMS ((cpp_reader *)); struct directive { directive_handler handler; /* Function to handle directive. */ @@ -202,18 +202,24 @@ extern unsigned char _cpp_IStable[256]; #define CPP_WTRADITIONAL(PF) \ (CPP_OPTION (PF, warn_traditional) && !CPP_IN_SYSTEM_HEADER (PF)) +/* Hash step. The hash calculation is duplicated in cpp_lookup and + parse_name. */ +#define HASHSTEP(r, str) ((r) * 67 + (*str - 113)); + /* Flags for _cpp_init_toklist. */ #define DUMMY_TOKEN 0 #define NO_DUMMY_TOKEN 1 -/* In cpphash.c */ -extern unsigned int _cpp_calc_hash PARAMS ((const U_CHAR *, size_t)); +/* In cppmacro.c */ extern void _cpp_free_definition PARAMS ((cpp_hashnode *)); extern int _cpp_create_definition PARAMS ((cpp_reader *, cpp_hashnode *)); extern void _cpp_dump_definition PARAMS ((cpp_reader *, cpp_hashnode *)); + +/* In cpphash.c */ extern void _cpp_init_macros PARAMS ((cpp_reader *)); extern void _cpp_cleanup_macros PARAMS ((cpp_reader *)); -extern void _cpp_dump_macro_hash PARAMS ((cpp_reader *)); +extern cpp_hashnode *_cpp_lookup_with_hash PARAMS ((cpp_reader*, const U_CHAR *, + size_t, unsigned int)); /* In cppfiles.c */ extern void _cpp_simplify_pathname PARAMS ((char *)); @@ -278,6 +284,7 @@ extern void _cpp_cleanup_stacks PARAMS ((cpp_reader *)); /* Utility routines and macros. */ #define xnew(T) (T *) xmalloc (sizeof(T)) #define xnewvec(T, N) (T *) xmalloc (sizeof(T) * (N)) +#define xcnewvec(T, N) (T *) xcalloc (N, sizeof(T)) #define xobnew(O, T) (T *) obstack_alloc (O, sizeof(T)) /* These are inline functions instead of macros so we can get type |