aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.columbia.edu>1999-04-26 16:41:02 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-04-26 16:41:02 +0000
commit3caee4a8ee44a285efab9a80cf765c05f3209eb5 (patch)
tree5c575c1ae52f10bc1eebdcf45ba407212d863336 /gcc/cppinit.c
parent641be6fea8860669fb0535babeab8cfbe17b8413 (diff)
downloadgcc-3caee4a8ee44a285efab9a80cf765c05f3209eb5.zip
gcc-3caee4a8ee44a285efab9a80cf765c05f3209eb5.tar.gz
gcc-3caee4a8ee44a285efab9a80cf765c05f3209eb5.tar.bz2
cpphash.c (dump_definition): New function.
1999-04-26 19:16 -0400 Zack Weinberg <zack@rabi.columbia.edu> * cpphash.c (dump_definition): New function. * cpphash.h: Prototype it. * cpplib.c (handle_directive): Don't output anything here. Streamline. (pass_thru_directive): Take a length, not a pointer to the end. All callers changed. (do_define): Handle -dD, -dN, -g3 entirely here. Streamline. (do_include): Handle -dI here. (do_ident): Correct to match cccp. (do_pragma): Copy the pragma through here. (do_assert, do_unassert): Tidy. * cppinit.c (cpp_finish): If -dM was specified, walk the macro hash table and call dump_definition on all the entries. * cppmain.c: cpp_finish may produce output. From-SVN: r26659
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 6f2a997..9b2ecca 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -1094,6 +1094,25 @@ cpp_finish (pfile)
}
}
}
+
+ if (opts->dump_macros == dump_only)
+ {
+ int i;
+ HASHNODE *h;
+ MACRODEF m;
+ for (i = HASHSIZE; --i >= 0;)
+ {
+ for (h = pfile->hashtab[i]; h; h = h->next)
+ if (h->type == T_MACRO)
+ {
+ m.defn = h->value.defn;
+ m.symnam = h->name;
+ m.symlen = h->length;
+ dump_definition (pfile, m);
+ CPP_PUTC (pfile, '\n');
+ }
+ }
+ }
}
/* Handle one command-line option in (argc, argv).