From d873d8274339cd0a352eb4cf287f6b04eeb08c1d Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Wed, 21 Aug 2002 17:07:26 +0000 Subject: [PATCH] * cppinit.c (remove_dup_nonsys_dirs): Fix warning and return value. From-SVN: r56493 --- gcc/ChangeLog | 4 ++++ gcc/cppinit.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2424aa26badf..670b10d3eaad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2002-08-21 John David Anglin + + * cppinit.c (remove_dup_nonsys_dirs): Fix warning and return value. + 2002-08-21 Joseph S. Myers * c-decl.c (grokdeclarator): Make invalid combinations with long, diff --git a/gcc/cppinit.c b/gcc/cppinit.c index bdee5a66b31e..99dd9490646b 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -303,12 +303,14 @@ remove_dup_nonsys_dirs (pfile, head_ptr, end) 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) @@ -327,6 +329,10 @@ remove_dup_nonsys_dirs (pfile, head_ptr, end) } } + if (!sysdir) + for (cur = *head_ptr; cur != end; cur = cur->next) + prev = cur; + return prev; } -- 2.43.5