cpplib problem

Ulrich Drepper drepper@redhat.com
Mon Mar 13 20:46:00 GMT 2000


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.

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.

The patch below is tested.

2000-03-13  Ulrich Drepper  <drepper@redhat.com>

	* cppinit.c (initialize_builtins): Initialize defn field of new
	hash table entry.
	* cpphash.c (_cpp_dump_definition): Don't do anything if this is
	a builtin.

Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppinit.c,v
retrieving revision 1.64
diff -u -u -b -r1.64 cppinit.c
--- cppinit.c	2000/03/13 22:01:07	1.64
+++ cppinit.c	2000/03/14 04:41:35
@@ -662,6 +662,7 @@
       len = strlen (b->name);
       hp = _cpp_make_hashnode (b->name, len, b->type, -1);
       hp->value.cpval = val;
+      hp->value.defn = NULL;
       *(htab_find_slot (pfile->hashtab, (void *)hp, 1)) = hp;
 
       if ((b->flags & DUMP) && CPP_OPTIONS (pfile)->debug_output)
Index: cpphash.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpphash.c,v
retrieving revision 1.55
diff -u -u -b -r1.55 cpphash.c
--- cpphash.c	2000/03/13 22:01:07	1.55
+++ cpphash.c	2000/03/14 04:41:40
@@ -1633,6 +1633,10 @@
      long len;
      DEFINITION *defn;
 {
+  /* We don't emit the builtins.  */
+  if (defn == NULL)
+    return;
+
   if (pfile->lineno == 0)
     _cpp_output_line_command (pfile, same_file);
 


-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


More information about the Gcc-patches mailing list