darwin-c.c (framework_construct_pathname): We must find all headers of a framework...
authorMike Stump <mrs@apple.com>
Fri, 15 Apr 2005 01:55:58 +0000 (01:55 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 15 Apr 2005 01:55:58 +0000 (01:55 +0000)
        * 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.

        * gcc.dg/Foundation.framework/empty: New.
        * gcc.dg/framework-2.c: New.

From-SVN: r98162

gcc/ChangeLog
gcc/config/darwin-c.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Foundation.framework/empty [new file with mode: 0644]
gcc/testsuite/gcc.dg/framework-2.c [new file with mode: 0644]

index df59529802112a018ff22e78aa07c541249edfbd..6cd1f287de21ad8e4f4db4a908ef74cdb2acb45b 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-14  Mike Stump  <mrs@apple.com>
+
+       * 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  <kazu@cs.umass.edu>
 
        PR tree-optimization/21021
index feb26f185d297721401cb8b1f7894a4aa63963ba..58366f757457e2737618dd5e4f4542618d7d7660 100644 (file)
@@ -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);
index eed557ebda182297727e41ea92456597a07092e8..b480eeafd48eb8dc79c9c118884472570c2e6df7 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-14  Mike Stump  <mrs@apple.com>
+
+       * gcc.dg/Foundation.framework/empty: New.
+       * gcc.dg/framework-2.c: New.
+
 2005-04-14  Kazu Hirata  <kazu@cs.umass.edu>
 
        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 (file)
index 0000000..4134791
--- /dev/null
@@ -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 (file)
index 0000000..a39041d
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-F$srcdir/gcc.dg" } */
+
+#include <Foundation/Foundation.h> /* { dg-error "error: Foundation/Foundation.h: No such file" } */