This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib problem
- To: Ulrich Drepper <drepper at cygnus dot com>
- Subject: Re: cpplib problem
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Mon, 13 Mar 2000 21:59:01 -0800
- Cc: gcc-patches at sourceware dot cygnus dot com
- References: <m3g0tup3d8.fsf@localhost.localnet>
On Mon, Mar 13, 2000 at 08:44:35PM -0800, Ulrich Drepper wrote:
> The current egcs cannot generate dependencies using -dM correctly. I
> don't know when this was introduced since the last time I successfully
> compiled glibc is several weeks back.
Dependencies? You mean the report on macros defined, right? That is
broken...
$ echo "#define foo bar" | ./cpp -dM
Segmentation fault
$
> Anyhow, looking at the crash I think I came up with a usable patch.
> The only thing I could imagine people might want is to not use NULL as
> the indicator for an builtin and instead use, say, (void*)-1. This
> would help catching other initialization errors.
This patch can't possibly be right. The value field of struct
hashnode is a union.
The right patch should be to have dump_hash_helper verify that the
type field is T_MACRO. Here's a patch that does that. (Looks like we
need to emit newlines there, too.)
With this applied:
$ echo "#define foo bar" | ./cpp -dM
#define foo bar
$
I take it you got all the way to the glibc testsuite? Last time I
tried to compile libc with a gcc snapshot, it would crash inside the
dynamic linker while trying to run rpcgen.
zw
* cpphash.c (dump_hash_helper): Only dump nodes of type
T_MACRO. Emit a newline after each definition.
===================================================================
Index: cpphash.c
--- cpphash.c 2000/03/13 22:01:07 1.55
+++ cpphash.c 2000/03/14 05:57:04
@@ -1727,7 +1727,11 @@ dump_hash_helper (h, p)
HASHNODE *hp = (HASHNODE *)h;
cpp_reader *pfile = (cpp_reader *)p;
- _cpp_dump_definition (pfile, hp->name, hp->length, hp->value.defn);
+ if (hp->type == T_MACRO)
+ {
+ _cpp_dump_definition (pfile, hp->name, hp->length, hp->value.defn);
+ CPP_PUTC (pfile, '\n');
+ }
return 1;
}