aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-07-18 00:59:49 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-18 00:59:49 +0000
commit711b88243b220e3cd737696da51de70f32bb7d5c (patch)
treea8929adb35764d62c4016b482a4cb4b619be00cb /gcc/cppinit.c
parent5d8fcdcb2ddbd52a35621a7880cf268c50a54027 (diff)
downloadgcc-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/cppinit.c')
-rw-r--r--gcc/cppinit.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index c31b2fd..a58f459 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -114,6 +114,7 @@ static int opt_comp PARAMS ((const void *, const void *));
static void sort_options PARAMS ((void));
#endif
static int parse_option PARAMS ((const char *));
+static int dump_macros_helper PARAMS ((cpp_reader *, cpp_hashnode *));
/* Fourth argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
@@ -891,6 +892,18 @@ cpp_start_read (pfile, print, fname)
return 1;
}
+
+/* Dump out the hash table. */
+static int
+dump_macros_helper (pfile, hp)
+ cpp_reader *pfile;
+ cpp_hashnode *hp;
+{
+ if (hp->type == T_MACRO)
+ _cpp_dump_definition (pfile, hp);
+ return 1;
+}
+
/* This is called at the end of preprocessing. It pops the
last buffer and writes dependency output. It should also
clear macro definitions, such that you could call cpp_start_read
@@ -934,7 +947,7 @@ cpp_finish (pfile, print)
}
if (CPP_OPTION (pfile, dump_macros) == dump_only)
- _cpp_dump_macro_hash (pfile);
+ cpp_forall_identifiers (pfile, dump_macros_helper);
/* Flush any pending output. */
if (print)