From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19052 invoked by alias); 21 Aug 2002 16:23:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19044 invoked from network); 21 Aug 2002 16:23:56 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 21 Aug 2002 16:23:56 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id g7LGNp00002933; Wed, 21 Aug 2002 12:23:52 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g7LGNoL2002932; Wed, 21 Aug 2002 12:23:50 -0400 (EDT) Message-Id: <200208211623.g7LGNoL2002932@hiauly1.hia.nrc.ca> Subject: PATCH: fix warning and return value for remove_dup_nonsys_dirs To: dave@hiauly1.hia.nrc.ca (John David Anglin) Date: Wed, 21 Aug 2002 09:31:00 -0000 From: "John David Anglin" Cc: neil@daikokuya.co.uk, zack@codesourcery.com, nathan@cs.bris.ac.uk, nathan@codesourcery.com, gcc-patches@gcc.gnu.org In-Reply-To: from "John David Anglin" at Aug 20, 2002 04:07:37 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-08/txt/msg01302.txt.bz2 > 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 * 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; }