OSDN Git Service

* include/ext/pool_allocator.h: Include c++config.h.
[pf3gnuchains/gcc-fork.git] / gcc / cpppch.c
index e1dc1d7..8cb5bcf 100644 (file)
@@ -1,5 +1,5 @@
 /* Part of CPP library.  (Precompiled header reading/writing.)
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -80,7 +80,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
        if (fwrite (&s, sizeof (s), 1, f) != 1
            || fwrite (defn, 1, s.definition_length, f) != s.definition_length)
          {
-           cpp_errno (pfile, DL_ERROR, "while writing precompiled header");
+           cpp_errno (pfile, CPP_DL_ERROR,
+                      "while writing precompiled header");
            return 0;
          }
       }
@@ -328,7 +329,7 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f)
   if (fwrite (&z, sizeof (z), 1, f) != 1
       || fwrite (ss->definedstrs, ss->hashsize, 1, f) != 1)
     {
-      cpp_errno (r, DL_ERROR, "while writing precompiled header");
+      cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
       return -1;
     }
   free (ss->definedstrs);
@@ -352,7 +353,7 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
   memset (&z, 0, sizeof (z));
   if (fwrite (&z, sizeof (z), 1, f) != 1)
     {
-      cpp_errno (r, DL_ERROR, "while writing precompiled header");
+      cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
       return -1;
     }
 
@@ -361,7 +362,13 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
 
   if (deps_save (r->deps, f) != 0)
     {
-      cpp_errno (r, DL_ERROR, "while writing precompiled header");
+      cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
+      return -1;
+    }
+
+  if (! _cpp_save_file_entries (r, f))
+    {
+      cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
       return -1;
     }
 
@@ -458,7 +465,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
          || h->flags & NODE_POISONED)
        {
          if (CPP_OPTION (r, warn_invalid_pch))
-           cpp_error (r, DL_WARNING_SYSHDR,
+           cpp_error (r, CPP_DL_WARNING_SYSHDR,
                       "%s: not used because `%.*s' not defined",
                       name, m.name_length, namebuf);
          goto fail;
@@ -470,7 +477,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
          || memcmp (namebuf, newdefn, m.definition_length) != 0)
        {
          if (CPP_OPTION (r, warn_invalid_pch))
-           cpp_error (r, DL_WARNING_SYSHDR,
+           cpp_error (r, CPP_DL_WARNING_SYSHDR,
               "%s: not used because `%.*s' defined as `%s' not `%.*s'",
                       name, m.name_length, namebuf, newdefn + m.name_length,
                       m.definition_length - m.name_length,
@@ -511,7 +518,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
       else
        {
          if (CPP_OPTION (r, warn_invalid_pch))
-           cpp_error (r, DL_WARNING_SYSHDR, 
+           cpp_error (r, CPP_DL_WARNING_SYSHDR, 
                       "%s: not used because `%s' is defined",
                       name, first);
          goto fail;
@@ -525,7 +532,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
   return 0;
 
  error:
-  cpp_errno (r, DL_ERROR, "while reading precompiled header");
+  cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
   return -1;
 
  fail:
@@ -686,8 +693,8 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
       else if (m.name_length != m.definition_length)
        {
          if (cpp_push_buffer (r, defn + m.name_length, 
-                              m.definition_length - m.name_length, 
-                              true, 1) != NULL)
+                              m.definition_length - m.name_length, true)
+             != NULL)
            {
              _cpp_clean_line (r);
              if (!_cpp_create_definition (r, h))
@@ -708,9 +715,12 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
       != 0)
     goto error;
 
+  if (! _cpp_read_file_entries (r, f))
+    goto error;
+
   return 0;
   
  error:
-  cpp_errno (r, DL_ERROR, "while reading precompiled header");
+  cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header");
   return -1;
 }