cppfiles.c (_cpp_fake_include): New function.
[gcc.git] / gcc / cppfiles.c
index 91f886b8f798dab7654e74ced5a48e088a7593c0..c480cb456c034ff1bbdce4c013cdb9aecb6c169f 100644 (file)
@@ -1,6 +1,6 @@
 /* Part of CPP library.  (include file handling)
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
    Written by Per Bothner, 1994.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -117,6 +117,7 @@ destroy_include_file_node (v)
      splay_tree_value v;
 {
   struct include_file *f = (struct include_file *)v;
+
   if (f)
     {
       purge_cache (f);
@@ -149,6 +150,26 @@ _cpp_never_reread (file)
   file->cmacro = NEVER_REREAD;
 }
 
+/* Put a file name in the splay tree, for the sake of cpp_included ().
+   Assume that FNAME has already had its path simplified.  */
+void
+_cpp_fake_include (pfile, fname)
+     cpp_reader *pfile;
+     const char *fname;
+{
+  splay_tree_node nd;
+
+  nd = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) fname);
+  if (! nd)
+    {
+      struct include_file *file = xcnew (struct include_file);
+      file->name = xstrdup (fname);
+      splay_tree_insert (pfile->all_include_files,
+                        (splay_tree_key) file->name,
+                        (splay_tree_value) file);
+    }
+}
+
 /* Given a file name, look it up in the cache; if there is no entry,
    create one with a non-NULL value (regardless of success in opening
    the file).  If the file doesn't exist or is inaccessible, this