OSDN Git Service

Index: libcpp/ChangeLog
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jan 2005 02:13:56 +0000 (02:13 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jan 2005 02:13:56 +0000 (02:13 +0000)
2005-01-03  Geoffrey Keating  <geoffk@apple.com>

* files.c (_cpp_find_file): Add files found by search_path_exhausted
to the list of all files.

Index: gcc/testsuite/ChangeLog
2005-01-03  Geoffrey Keating  <geoffk@apple.com>
    Robert Bowdidge <bowdidge@apple.com>

* gcc.dg/cpp/subframework1.c: New.
* gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h: New.
* gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h: New.
* gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h: New.
* gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92883 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/subframework1.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/files.c

index f74a542..a55eb02 100644 (file)
@@ -1,4 +1,13 @@
 2005-01-03  Geoffrey Keating  <geoffk@apple.com>
+           Robert Bowdidge <bowdidge@apple.com>
+
+       * gcc.dg/cpp/subframework1.c: New.
+       * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h: New.
+       * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h: New.
+       * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h: New.
+       * gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h: New.
+
+2005-01-03  Geoffrey Keating  <geoffk@apple.com>
 
        * gcc.dg/darwin-weakimport-1.c: Remove check for variables
        producing warning.
diff --git a/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h b/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h
new file mode 100644 (file)
index 0000000..5573729
--- /dev/null
@@ -0,0 +1 @@
+#import <OneSub/C.h>
diff --git a/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h b/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h
new file mode 100644 (file)
index 0000000..5573729
--- /dev/null
@@ -0,0 +1 @@
+#import <OneSub/C.h>
diff --git a/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h b/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h
new file mode 100644 (file)
index 0000000..5afd805
--- /dev/null
@@ -0,0 +1,4 @@
+#ifdef ONESUB_C_INCLUDED
+#error should only be imported once
+#endif
+#define ONESUB_C_INCLUDED 1
diff --git a/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h b/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h
new file mode 100644 (file)
index 0000000..adaeb95
--- /dev/null
@@ -0,0 +1,2 @@
+#import <OneSub/A.h>
+#import <OneSub/B.h>
diff --git a/gcc/testsuite/gcc.dg/cpp/subframework1.c b/gcc/testsuite/gcc.dg/cpp/subframework1.c
new file mode 100644 (file)
index 0000000..fd560fa
--- /dev/null
@@ -0,0 +1,15 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+/* { dg-options "-F$srcdir/gcc.dg/cpp/frame" } */
+
+/* Contributed by Robert Bowdidge <bowdidge@apple.com>  */
+/* include a file from a subframework that will import two files that
+   both look at the same file.  Make sure we only include that file once;
+   if so, the program will compile fine.  If not, we'll get redefinition
+   errors */
+
+#include <one/one-includeSubs.h>
+#ifndef ONESUB_C_INCLUDED
+#error C.h not included
+#endif
index 88e5b8f..fb3e928 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-03  Geoffrey Keating  <geoffk@apple.com>
+
+       * files.c (_cpp_find_file): Add files found by search_path_exhausted
+       to the list of all files.
+
 2005-01-01  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * internal.h: Update references to Cpp lib filenames.
index bd5f8dd..df5d9d7 100644 (file)
@@ -438,7 +438,15 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
       if (file->dir == NULL)
        {
          if (search_path_exhausted (pfile, fname, file))
-           return file;
+           {
+             /* Although this file must not go in the cache, because
+                the file found might depend on things (like the current file)
+                that aren't represented in the cache, it still has to go in
+                the list of all files so that #import works.  */
+             file->next_file = pfile->all_files;
+             pfile->all_files = file;
+             return file;
+           }
 
          open_file_failed (pfile, file);
          if (invalid_pch)