This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pph] Reorganize pph read/write file into their respective streamers (issue4657042)


Avoid exposing more and more streamer functions in the headers by moving all
the read logic to pph-streamer-in.c and the write logic to pph-streamer-out.c

This is a pure copy/paste of the functions, 
no new functionality was added in this patch

Tested with bootstrap build and pph regression testing.

2011-06-21  Gabriel Charette  <gchare@google.com>

	* gcc/cp/pph-streamer-in.c (pph_in_tree_vec): Make static.
	(pph_add_names_to_namespace): Moved from pph.c.
	(wrap_macro_def): Moved from pph.c.
	(report_validation_error): Moved from pph.c.
	(pth_load_identifiers): Moved from pph.c.
	(pph_read_file_contents): Moved from pph.c.
	(pph_read_file): Moved from pph.c
	* gcc/cp/pph-streamer-out.c (pph_out_tree_vec): Make static.
	(pph_out_chain_filtered): Make static.
	(pth_save_identifiers): Moved from pph.c.
	(pph_write_file_contents): Moved from pph.c.
	(pph_write_file): Moved from pph.c.
	* gcc/cp/pph-streamer.h (pph_out_tree_vec): Now static, removed.
	(pph_out_chain_filtered): Now static, removed.
	(pph_write_file): Now public, added.
	(pph_in_tree_vec): Now static, removed.
	(pph_read_file): Now public, added.
	* gcc/cp/pph.h (pph_dump_namespace): Exposed.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index af6102b..e71f744 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -281,7 +281,7 @@ pph_in_ld_min (pph_stream *stream, struct lang_decl_min *ldm)
 
 /* Read and return a gc VEC of trees from STREAM.  */
 
-VEC(tree,gc) *
+static VEC(tree,gc) *
 pph_in_tree_vec (pph_stream *stream)
 {
   unsigned i, num;
@@ -976,6 +976,208 @@ pph_in_lang_type (pph_stream *stream)
 }
 
 
+/* Add all the new names declared in NEW_NS to NS.  */
+
+static void
+pph_add_names_to_namespace (tree ns, tree new_ns)
+{
+  tree t, chain;
+  struct cp_binding_level *level = NAMESPACE_LEVEL (new_ns);
+
+  for (t = level->names; t; t = chain)
+    {
+      /* Pushing a decl into a scope clobbers its DECL_CHAIN.
+	 Preserve it.  */
+      chain = DECL_CHAIN (t);
+      pushdecl_into_namespace (t, ns);
+    }
+
+  for (t = level->namespaces; t; t = chain)
+    {
+      /* Pushing a decl into a scope clobbers its DECL_CHAIN.
+	 Preserve it.  */
+      /* FIXME pph: we should first check to see if it isn't already there.  */
+      chain = DECL_CHAIN (t);
+      pushdecl_into_namespace (t, ns);
+      pph_add_names_to_namespace (t, t);
+    }
+}
+
+
+/* Wrap a macro DEFINITION for printing in an error.  */
+
+static char *
+wrap_macro_def (const char *definition)
+{
+  char *string;
+  if (definition)
+    {
+      size_t length;
+      length = strlen (definition);
+      string = (char *) xmalloc (length+3);
+      string[0] = '"';
+      strcpy (string + 1, definition);
+      string[length + 1] = '"';
+      string[length + 2] = '\0';
+    }
+  else
+    string = xstrdup ("undefined");
+  return string;
+}
+
+
+/* Report a macro validation error in FILENAME for macro IDENT,
+   which should have the value EXPECTED but actually had the value FOUND. */
+
+static void
+report_validation_error (const char *filename,
+			 const char *ident, const char *found,
+			 const char *before, const char *after)
+{
+  char* quote_found = wrap_macro_def (found);
+  char* quote_before = wrap_macro_def (before);
+  char* quote_after = wrap_macro_def (after);
+  error ("PPH file %s fails macro validation, "
+         "%s is %s and should be %s or %s\n",
+         filename, ident, quote_found, quote_before, quote_after);
+  free (quote_found);
+  free (quote_before);
+  free (quote_after);
+}
+
+
+/* Load the IDENTIFERS for a hunk from a STREAM.  */
+
+static void
+pth_load_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
+{
+  unsigned int j;
+  unsigned int max_ident_len, max_value_len, num_entries;
+  unsigned int ident_len, before_len, after_len;
+
+  max_ident_len = pph_in_uint (stream);
+  identifiers->max_ident_len = max_ident_len;
+  max_value_len = pph_in_uint (stream);
+  identifiers->max_value_len = max_value_len;
+  num_entries = pph_in_uint (stream);
+  identifiers->num_entries = num_entries;
+  identifiers->entries = XCNEWVEC (cpp_ident_use, num_entries);
+  identifiers->strings = XCNEW (struct obstack);
+
+  /* Strings need no alignment.  */
+  _obstack_begin (identifiers->strings, 0, 0,
+                  (void *(*) (long)) xmalloc,
+                  (void (*) (void *)) free);
+  obstack_alignment_mask (identifiers->strings) = 0;
+  /* FIXME pph: We probably need to free all these things somewhere.  */
+
+  /* Read the identifiers in HUNK. */
+  for (j = 0; j < num_entries; ++j)
+    {
+      const char *s;
+      identifiers->entries[j].used_by_directive = pph_in_uint (stream);
+      identifiers->entries[j].expanded_to_text = pph_in_uint (stream);
+      s = pph_in_string (stream);
+      gcc_assert (s);
+      ident_len = strlen (s);
+      identifiers->entries[j].ident_len = ident_len;
+      identifiers->entries[j].ident_str =
+        (const char *) obstack_copy0 (identifiers->strings, s, ident_len);
+
+      s = pph_in_string (stream);
+      if (s)
+	{
+	  before_len = strlen (s);
+	  identifiers->entries[j].before_len = before_len;
+	  identifiers->entries[j].before_str = (const char *)
+	      obstack_copy0 (identifiers->strings, s, before_len);
+	}
+      else
+	{
+	  /* The identifier table expects NULL entries to have
+	     a length of -1U.  */
+	  identifiers->entries[j].before_len = -1U;
+	  identifiers->entries[j].before_str = NULL;
+	}
+
+      s = pph_in_string (stream);
+      if (s)
+	{
+	  after_len = strlen (s);
+	  identifiers->entries[j].after_len = after_len;
+	  identifiers->entries[j].after_str = (const char *)
+	      obstack_copy0 (identifiers->strings, s, after_len);
+	}
+      else
+	{
+	  /* The identifier table expects NULL entries to have
+	     a length of -1U.  */
+	  identifiers->entries[j].after_len = -1U;
+	  identifiers->entries[j].after_str = NULL;
+	}
+    }
+}
+
+
+/* Read contents of PPH file in STREAM.  */
+
+static void
+pph_read_file_contents (pph_stream *stream)
+{
+  bool verified;
+  cpp_ident_use *bad_use;
+  const char *cur_def;
+  cpp_idents_used idents_used;
+  tree file_ns;
+
+  pth_load_identifiers (&idents_used, stream);
+
+  /* FIXME pph: This validation is weak.  */
+  verified = cpp_lt_verify_1 (parse_in, &idents_used, &bad_use, &cur_def, true);
+  if (!verified)
+    report_validation_error (stream->name, bad_use->ident_str, cur_def,
+                             bad_use->before_str, bad_use->after_str);
+
+  /* Re-instantiate all the pre-processor symbols defined by STREAM.  */
+  cpp_lt_replay (parse_in, &idents_used);
+
+  /* Read global_namespace from STREAM and add all the names defined
+     there to the current global_namespace.  */
+  file_ns = pph_in_tree (stream);
+  if (flag_pph_dump_tree)
+    pph_dump_namespace (pph_logfile, file_ns);
+  pph_add_names_to_namespace (global_namespace, file_ns);
+  keyed_classes = pph_in_tree (stream);
+  unemitted_tinfo_decls = pph_in_tree_vec (stream);
+  /* FIXME pph: This call replaces the tinfo, we should merge instead.
+     See pph_in_tree_VEC.  */
+}
+
+
+/* Read PPH file FILENAME.  */
+
+void
+pph_read_file (const char *filename)
+{
+  pph_stream *stream;
+
+  if (flag_pph_debug >= 1)
+    fprintf (pph_logfile, "PPH: Reading %s\n", filename);
+
+  stream = pph_stream_open (filename, "rb");
+  if (stream)
+    {
+      pph_read_file_contents (stream);
+      pph_stream_close (stream);
+
+      if (flag_pph_debug >= 1)
+        fprintf (pph_logfile, "PPH: Closing %s\n", filename);
+    }
+  else
+    error ("Cannot open PPH file for reading: %s: %m", filename);
+}
+
+
 /* Callback for reading ASTs from a stream.  This reads all the fields
    that are not processed by default by the common tree pickler.
    IB, DATA_IN are as in lto_read_tree.  EXPR is the partially materialized
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index 1f9ae1d..3187338 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -275,7 +275,7 @@ pph_out_ld_min (pph_stream *stream, struct lang_decl_min *ldm,
 /* Write all the trees in gc VEC V to STREAM.  REF_P is true if the
    trees should be written as references. */
 
-void
+static void
 pph_out_tree_vec (pph_stream *stream, VEC(tree,gc) *v, bool ref_p)
 {
   unsigned i;
@@ -415,7 +415,7 @@ pph_count_filter_match (tree first, enum chain_filter filter)
    nodes that do not match FILTER.  REF_P is true if nodes in the chain
    should be emitted as references.  */
 
-void
+static void
 pph_out_chain_filtered (pph_stream *stream, tree first, bool ref_p,
 			   enum chain_filter filter)
 {
@@ -935,6 +935,92 @@ pph_out_lang_type (pph_stream *stream, tree type, bool ref_p)
 }
 
 
+/* Save the IDENTIFIERS to the STREAM.  */
+
+static void
+pth_save_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
+{
+  unsigned int num_entries, active_entries, id;
+
+  num_entries = identifiers->num_entries;
+  pph_out_uint (stream, identifiers->max_ident_len);
+  pph_out_uint (stream, identifiers->max_value_len);
+
+  active_entries = 0;
+  for ( id = 0; id < num_entries; ++id )
+    {
+      cpp_ident_use *entry = identifiers->entries + id;
+      if (!(entry->used_by_directive || entry->expanded_to_text))
+        continue;
+      ++active_entries;
+    }
+
+  pph_out_uint (stream, active_entries);
+
+  for ( id = 0; id < num_entries; ++id )
+    {
+      cpp_ident_use *entry = identifiers->entries + id;
+
+      if (!(entry->used_by_directive || entry->expanded_to_text))
+        continue;
+
+      /* FIXME pph: We are wasting space; ident_len, used_by_directive
+      and expanded_to_text together could fit into a single uint. */
+
+      pph_out_uint (stream, entry->used_by_directive);
+      pph_out_uint (stream, entry->expanded_to_text);
+
+      gcc_assert (entry->ident_len <= identifiers->max_ident_len);
+      pph_out_string_with_length (stream, entry->ident_str,
+				     entry->ident_len);
+
+      gcc_assert (entry->before_len <= identifiers->max_value_len);
+      pph_out_string_with_length (stream, entry->before_str,
+				     entry->before_len);
+
+      gcc_assert (entry->after_len <= identifiers->max_value_len);
+      pph_out_string_with_length (stream, entry->after_str,
+				     entry->after_len);
+    }
+}
+
+
+/* Write PPH output symbols and IDENTS_USED to STREAM as an object.  */
+
+static void
+pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used)
+{ 
+  pth_save_identifiers (idents_used, stream);
+  if (flag_pph_dump_tree)
+    pph_dump_namespace (pph_logfile, global_namespace);
+  pph_out_tree (stream, global_namespace, false);
+  pph_out_tree (stream, keyed_classes, false);
+  pph_out_tree_vec (stream, unemitted_tinfo_decls, false);
+}
+
+
+/* Write PPH output file.  */
+
+void
+pph_write_file (void)
+{
+  pph_stream *stream;
+  cpp_idents_used idents_used;
+
+  if (flag_pph_debug >= 1)
+    fprintf (pph_logfile, "PPH: Writing %s\n", pph_out_file);
+
+  stream = pph_stream_open (pph_out_file, "wb");
+  if (!stream)
+    fatal_error ("Cannot open PPH file for writing: %s: %m", pph_out_file);
+
+  idents_used = cpp_lt_capture (parse_in);
+  pph_write_file_contents (stream, &idents_used);
+
+  pph_stream_close (stream);
+}
+
+
 /* Write header information for some AST nodes not handled by the
    common streamer code.  EXPR is the tree to write to output block
    OB.  If EXPR does not need to be handled specially, do nothing.  */
diff --git a/gcc/cp/pph-streamer.h b/gcc/cp/pph-streamer.h
index d781f71..c8fb4a9 100644
--- a/gcc/cp/pph-streamer.h
+++ b/gcc/cp/pph-streamer.h
@@ -137,13 +137,11 @@ void *pph_cache_get (pph_stream *, unsigned);
 
 /* In pph-streamer-out.c.  */
 void pph_flush_buffers (pph_stream *);
-void pph_out_tree_vec (pph_stream *stream, VEC(tree,gc) *v,
-                                bool ref_p);
 void pph_init_write (pph_stream *);
 void pph_write_tree (struct output_block *, tree, bool ref_p);
 void pph_pack_value_fields (struct bitpack_d *, tree);
 void pph_out_tree_header (struct output_block *, tree);
-void pph_out_chain_filtered (pph_stream *, tree, bool, enum chain_filter);
+void pph_write_file (void);
 
 /* In name-lookup.c.  */
 struct binding_table_s;
@@ -153,11 +151,12 @@ struct binding_table_s *pph_in_binding_table (pph_stream *);
 
 /* In pph-streamer-in.c.  */
 void pph_init_read (pph_stream *);
-VEC(tree,gc) *pph_in_tree_vec (pph_stream *stream);
 void pph_read_tree (struct lto_input_block *, struct data_in *, tree);
 void pph_unpack_value_fields (struct bitpack_d *, tree);
 tree pph_alloc_tree (enum tree_code, struct lto_input_block *,
 			    struct data_in *);
+void pph_read_file (const char *filename);
+
 /* In pph.c.  FIXME pph move these to pph-streamer.c.  */
 struct cp_token_cache;
 void pth_save_token_cache (struct cp_token_cache *, pph_stream *);
diff --git a/gcc/cp/pph.c b/gcc/cp/pph.c
index de127a9..480c0fe 100644
--- a/gcc/cp/pph.c
+++ b/gcc/cp/pph.c
@@ -244,55 +244,6 @@ pth_save_token_cache (cp_token_cache *cache, pph_stream *f)
 }
 
 
-/* Save the IDENTIFIERS to the STREAM.  */
-
-static void
-pth_save_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
-{
-  unsigned int num_entries, active_entries, id;
-
-  num_entries = identifiers->num_entries;
-  pph_out_uint (stream, identifiers->max_ident_len);
-  pph_out_uint (stream, identifiers->max_value_len);
-
-  active_entries = 0;
-  for ( id = 0; id < num_entries; ++id )
-    {
-      cpp_ident_use *entry = identifiers->entries + id;
-      if (!(entry->used_by_directive || entry->expanded_to_text))
-        continue;
-      ++active_entries;
-    }
-
-  pph_out_uint (stream, active_entries);
-
-  for ( id = 0; id < num_entries; ++id )
-    {
-      cpp_ident_use *entry = identifiers->entries + id;
-
-      if (!(entry->used_by_directive || entry->expanded_to_text))
-        continue;
-
-      /* FIXME pph: We are wasting space; ident_len, used_by_directive
-      and expanded_to_text together could fit into a single uint. */
-
-      pph_out_uint (stream, entry->used_by_directive);
-      pph_out_uint (stream, entry->expanded_to_text);
-
-      gcc_assert (entry->ident_len <= identifiers->max_ident_len);
-      pph_out_string_with_length (stream, entry->ident_str,
-				     entry->ident_len);
-
-      gcc_assert (entry->before_len <= identifiers->max_value_len);
-      pph_out_string_with_length (stream, entry->before_str,
-				     entry->before_len);
-
-      gcc_assert (entry->after_len <= identifiers->max_value_len);
-      pph_out_string_with_length (stream, entry->after_str,
-				     entry->after_len);
-    }
-}
-
 /* Given a type index TYPE_IDX and TYPE_KIND specifying the kind of type,
    return a type from integer_types or global_trees.  */
 
@@ -451,79 +402,6 @@ pth_load_token_cache (pph_stream *stream)
 }
 
 
-/* Load the IDENTIFERS for a hunk from a STREAM.  */
-
-static void
-pth_load_identifiers (cpp_idents_used *identifiers, pph_stream *stream)
-{
-  unsigned int j;
-  unsigned int max_ident_len, max_value_len, num_entries;
-  unsigned int ident_len, before_len, after_len;
-
-  max_ident_len = pph_in_uint (stream);
-  identifiers->max_ident_len = max_ident_len;
-  max_value_len = pph_in_uint (stream);
-  identifiers->max_value_len = max_value_len;
-  num_entries = pph_in_uint (stream);
-  identifiers->num_entries = num_entries;
-  identifiers->entries = XCNEWVEC (cpp_ident_use, num_entries);
-  identifiers->strings = XCNEW (struct obstack);
-
-  /* Strings need no alignment.  */
-  _obstack_begin (identifiers->strings, 0, 0,
-                  (void *(*) (long)) xmalloc,
-                  (void (*) (void *)) free);
-  obstack_alignment_mask (identifiers->strings) = 0;
-  /* FIXME pph: We probably need to free all these things somewhere.  */
-
-  /* Read the identifiers in HUNK. */
-  for (j = 0; j < num_entries; ++j)
-    {
-      const char *s;
-      identifiers->entries[j].used_by_directive = pph_in_uint (stream);
-      identifiers->entries[j].expanded_to_text = pph_in_uint (stream);
-      s = pph_in_string (stream);
-      gcc_assert (s);
-      ident_len = strlen (s);
-      identifiers->entries[j].ident_len = ident_len;
-      identifiers->entries[j].ident_str =
-        (const char *) obstack_copy0 (identifiers->strings, s, ident_len);
-
-      s = pph_in_string (stream);
-      if (s)
-	{
-	  before_len = strlen (s);
-	  identifiers->entries[j].before_len = before_len;
-	  identifiers->entries[j].before_str = (const char *)
-	      obstack_copy0 (identifiers->strings, s, before_len);
-	}
-      else
-	{
-	  /* The identifier table expects NULL entries to have
-	     a length of -1U.  */
-	  identifiers->entries[j].before_len = -1U;
-	  identifiers->entries[j].before_str = NULL;
-	}
-
-      s = pph_in_string (stream);
-      if (s)
-	{
-	  after_len = strlen (s);
-	  identifiers->entries[j].after_len = after_len;
-	  identifiers->entries[j].after_str = (const char *)
-	      obstack_copy0 (identifiers->strings, s, after_len);
-	}
-      else
-	{
-	  /* The identifier table expects NULL entries to have
-	     a length of -1U.  */
-	  identifiers->entries[j].after_len = -1U;
-	  identifiers->entries[j].after_str = NULL;
-	}
-    }
-}
-
-
 /* Dump a complicated name for tree T to FILE using FLAGS.
    See TDF_* in tree-pass.h for flags.  */
 
@@ -549,7 +427,7 @@ pph_dump_tree_name (FILE *file, tree t, int flags)
 
 /* Dump namespace NS for PPH.  */
 
-static void
+void
 pph_dump_namespace (FILE *file, tree ns)
 {
   struct cp_binding_level *level;
@@ -575,172 +453,6 @@ pph_dump_namespace (FILE *file, tree ns)
 }
 
 
-/* Write PPH output symbols and IDENTS_USED to STREAM as an object.  */
-
-static void
-pph_write_file_contents (pph_stream *stream, cpp_idents_used *idents_used)
-{ 
-  pth_save_identifiers (idents_used, stream);
-  if (flag_pph_dump_tree)
-    pph_dump_namespace (pph_logfile, global_namespace);
-  pph_out_tree (stream, global_namespace, false);
-  pph_out_tree (stream, keyed_classes, false);
-  pph_out_tree_vec (stream, unemitted_tinfo_decls, false);
-}
-
-
-/* Write PPH output file.  */
-
-static void
-pph_write_file (void)
-{
-  pph_stream *stream;
-  cpp_idents_used idents_used;
-
-  if (flag_pph_debug >= 1)
-    fprintf (pph_logfile, "PPH: Writing %s\n", pph_out_file);
-
-  stream = pph_stream_open (pph_out_file, "wb");
-  if (!stream)
-    fatal_error ("Cannot open PPH file for writing: %s: %m", pph_out_file);
-
-  idents_used = cpp_lt_capture (parse_in);
-  pph_write_file_contents (stream, &idents_used);
-
-  pph_stream_close (stream);
-}
-
-
-/* Wrap a macro DEFINITION for printing in an error.  */
-
-static char *
-wrap_macro_def (const char *definition)
-{
-  char *string;
-  if (definition)
-    {
-      size_t length;
-      length = strlen (definition);
-      string = (char *) xmalloc (length+3);
-      string[0] = '"';
-      strcpy (string + 1, definition);
-      string[length + 1] = '"';
-      string[length + 2] = '\0';
-    }
-  else
-    string = xstrdup ("undefined");
-  return string;
-}
-
-
-/* Report a macro validation error in FILENAME for macro IDENT,
-   which should have the value EXPECTED but actually had the value FOUND. */
-
-static void
-report_validation_error (const char *filename,
-			 const char *ident, const char *found,
-			 const char *before, const char *after)
-{
-  char* quote_found = wrap_macro_def (found);
-  char* quote_before = wrap_macro_def (before);
-  char* quote_after = wrap_macro_def (after);
-  error ("PPH file %s fails macro validation, "
-         "%s is %s and should be %s or %s\n",
-         filename, ident, quote_found, quote_before, quote_after);
-  free (quote_found);
-  free (quote_before);
-  free (quote_after);
-}
-
-
-
-/* Add all the new names declared in NEW_NS to NS.  */
-
-static void
-pph_add_names_to_namespace (tree ns, tree new_ns)
-{
-  tree t, chain;
-  struct cp_binding_level *level = NAMESPACE_LEVEL (new_ns);
-
-  for (t = level->names; t; t = chain)
-    {
-      /* Pushing a decl into a scope clobbers its DECL_CHAIN.
-	 Preserve it.  */
-      chain = DECL_CHAIN (t);
-      pushdecl_into_namespace (t, ns);
-    }
-
-  for (t = level->namespaces; t; t = chain)
-    {
-      /* Pushing a decl into a scope clobbers its DECL_CHAIN.
-	 Preserve it.  */
-      /* FIXME pph: we should first check to see if it isn't already there.  */
-      chain = DECL_CHAIN (t);
-      pushdecl_into_namespace (t, ns);
-      pph_add_names_to_namespace (t, t);
-    }
-}
-
-
-/* Read contents of PPH file in STREAM.  */
-
-static void
-pph_read_file_contents (pph_stream *stream)
-{
-  bool verified;
-  cpp_ident_use *bad_use;
-  const char *cur_def;
-  cpp_idents_used idents_used;
-  tree file_ns;
-
-  pth_load_identifiers (&idents_used, stream);
-
-  /* FIXME pph: This validation is weak.  */
-  verified = cpp_lt_verify_1 (parse_in, &idents_used, &bad_use, &cur_def, true);
-  if (!verified)
-    report_validation_error (stream->name, bad_use->ident_str, cur_def,
-                             bad_use->before_str, bad_use->after_str);
-
-  /* Re-instantiate all the pre-processor symbols defined by STREAM.  */
-  cpp_lt_replay (parse_in, &idents_used);
-
-  /* Read global_namespace from STREAM and add all the names defined
-     there to the current global_namespace.  */
-  file_ns = pph_in_tree (stream);
-  if (flag_pph_dump_tree)
-    pph_dump_namespace (pph_logfile, file_ns);
-  pph_add_names_to_namespace (global_namespace, file_ns);
-  keyed_classes = pph_in_tree (stream);
-  unemitted_tinfo_decls = pph_in_tree_vec (stream);
-  /* FIXME pph: This call replaces the tinfo, we should merge instead.
-     See pph_in_tree_VEC.  */
-}
-
-
-/* Read PPH file FILENAME.  */
-
-static void
-pph_read_file (const char *filename)
-{
-  pph_stream *stream;
-
-  if (flag_pph_debug >= 1)
-    fprintf (pph_logfile, "PPH: Reading %s\n", filename);
-
-  stream = pph_stream_open (filename, "rb");
-  if (stream)
-    {
-      pph_read_file_contents (stream);
-      pph_stream_close (stream);
-
-      if (flag_pph_debug >= 1)
-        fprintf (pph_logfile, "PPH: Closing %s\n", filename);
-    }
-  else
-    error ("Cannot open PPH file for reading: %s: %m", filename);
-}
-
-
 /* Record a #include or #include_next for PPH.  */
 
 static bool
diff --git a/gcc/cp/pph.h b/gcc/cp/pph.h
index 95fc10a..7e1a4e1 100644
--- a/gcc/cp/pph.h
+++ b/gcc/cp/pph.h
@@ -52,5 +52,6 @@ extern FILE *pph_logfile;
 /* In pph.c  */
 extern void pph_init (void);
 extern void pph_finish (void);
+extern void pph_dump_namespace (FILE *, tree ns);
 
 #endif  /* GCC_CP_PPH_H  */

--
This patch is available for review at http://codereview.appspot.com/4657042


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]