gcj/89 patch: emit dependencies in preferred order

Anthony Green green@cygnus.com
Sun Feb 13 11:50:00 GMT 2000


The following reply was made to PR gcj/89; it has been noted by GNATS.

From: Anthony Green <green@cygnus.com>
To: gcc-patches@gcc.gnu.org
Cc: java-gnats@sourceware.cygnus.com
Subject: gcj/89 patch: emit dependencies in preferred order
Date: Sun, 13 Feb 2000 11:46:44 -0800

 This patch fixes PR gcj/89.  It changes `gcj -M' to emit dependencies
 in the preferred order.
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=89
 
 
 2000-02-13  Anthony Green  <green@cygnus.com>
 
         * jcf-depend.c (add_entry): Add entries to the end of the list.
 
 Index: gcc/java/jcf-depend.c
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/jcf-depend.c,v
 retrieving revision 1.7
 diff -u -r1.7 jcf-depend.c
 --- jcf-depend.c	2000/01/21 20:57:00	1.7
 +++ jcf-depend.c	2000/02/13 19:40:11
 @@ -78,22 +78,30 @@
    *entp = NULL;
  }
  
 -/* Helper to add to entry list.  */
 +/* Helper to add to the end of the entry list.  */
  static void
  add_entry (entp, name)
       struct entry **entp;
       const char *name;
  {
 -  struct entry *ent;
 +  struct entry *ent, *last;
  
 -  for (ent = *entp; ent != NULL; ent = ent->next)
 +  for (last = ent = *entp; ent != NULL; last = ent, ent = ent->next)
      if (! strcmp (ent->file, name))
        return;
  
    ent = (struct entry *) xmalloc (sizeof (struct entry));
    ent->file = xstrdup (name);
 -  ent->next = *entp;
 -  *entp = ent;
 +  ent->next = NULL;
 +
 +  if (last == NULL)
 +    {
 +      // This is only true the first time through, when the entry list
 +      // is empty.
 +      *entp = ent;
 +    }     
 +  else
 +    last->next = ent;
  }
  
  /* Call this to reset the dependency module.  This is required if
 
 -- 
 Anthony Green                                                        Red Hat
                                                        Sunnyvale, California


More information about the Java-prs mailing list