This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: fix warning and return value for remove_dup_nonsys_dirs


> Installed!  I suggest waiting a few days to see if the change causes
> any problems before considering the branch.  I will work up something
> for the relevant changes.html(s).

I don't know how I missed this.  The return value of remove_dup_nonsys_dirs
isn't correct if there are no system directories.  The enclosed patch
fixes the problem.

Tested with a bootstrap and check on hppa-linux with no regressions.

OK for main?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-08-21  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* cppinit.c (remove_dup_nonsys_dirs): Fix warning and return value.

Index: cppinit.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.259
diff -u -3 -p -r1.259 cppinit.c
--- cppinit.c	20 Aug 2002 19:56:29 -0000	1.259
+++ cppinit.c	21 Aug 2002 16:04:16 -0000
@@ -303,12 +303,14 @@ remove_dup_nonsys_dirs (pfile, head_ptr,
      struct search_path **head_ptr;
      struct search_path *end;
 {
-  struct search_path *prev, *cur, *other;
+  int sysdir = 0;
+  struct search_path *prev = NULL, *cur, *other;
 
   for (cur = *head_ptr; cur; cur = cur->next)
     {
       if (cur->sysp)
 	{
+	  sysdir = 1;
 	  for (other = *head_ptr, prev = NULL;
 	       other != end;
 	       other = other ? other->next : *head_ptr)
@@ -326,6 +328,10 @@ remove_dup_nonsys_dirs (pfile, head_ptr,
 	    }
 	}
     }
+
+  if (!sysdir)
+    for (cur = *head_ptr; cur != end; cur = cur->next)
+      prev = cur;
 
   return prev;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]