diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df595298021..6cd1f287de2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-04-14 Mike Stump + + * config/darwin-c.c (framework_construct_pathname): We must + find all headers of a framework in the first instance of it + found in the seach path. + 2005-04-14 Kazu Hirata PR tree-optimization/21021 diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index feb26f185d2..58366f75745 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -270,6 +270,26 @@ framework_construct_pathname (const char *fname, cpp_dir *dir) strncpy (&frname[frname_len], ".framework/", strlen (".framework/")); frname_len += strlen (".framework/"); + if (fast_dir == 0) + { + frname[frname_len-1] = 0; + if (stat (frname, &st) == 0) + { + /* As soon as we find the first instance of the framework, + we stop and never use any later instance of that + framework. */ + add_framework (fname, fname_len, dir); + } + else + { + /* If we can't find the parent directory, no point looking + further. */ + free (frname); + return 0; + } + frname[frname_len-1] = '/'; + } + /* Append framework_header_dirs and header file name */ for (i = 0; framework_header_dirs[i].dirName; i++) { @@ -280,11 +300,7 @@ framework_construct_pathname (const char *fname, cpp_dir *dir) &fname[fname_len]); if (stat (frname, &st) == 0) - { - if (fast_dir == 0) - add_framework (fname, fname_len, dir); - return frname; - } + return frname; } free (frname); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eed557ebda1..b480eeafd48 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-14 Mike Stump + + * gcc.dg/Foundation.framework/empty: New. + * gcc.dg/framework-2.c: New. + 2005-04-14 Kazu Hirata PR tree-optimization/21021 diff --git a/gcc/testsuite/gcc.dg/Foundation.framework/empty b/gcc/testsuite/gcc.dg/Foundation.framework/empty new file mode 100644 index 00000000000..41347913eb9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Foundation.framework/empty @@ -0,0 +1 @@ +This directory is empty. diff --git a/gcc/testsuite/gcc.dg/framework-2.c b/gcc/testsuite/gcc.dg/framework-2.c new file mode 100644 index 00000000000..a39041df3ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/framework-2.c @@ -0,0 +1,4 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-options "-F$srcdir/gcc.dg" } */ + +#include /* { dg-error "error: Foundation/Foundation.h: No such file" } */