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] Remove unused code (issue4844046)


In fixing the string table memory problem, I found that this code
is not really used.  Removed.

Tested on x86_64.  Committed to branch.


Diego.


	* pph-streamer-in.c (pph_get_section_data): Remove unused function.
	(pph_free_section_data): Remove unused function.
	(pph_init_read): Do not call lto_set_in_hooks.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index eda93b8..15c5032 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -94,42 +94,6 @@ pph_unpack_value_fields (struct bitpack_d *bp, tree expr)
 }
 
 
-/* Get the section with name NAME and type SECTION_TYPE from FILE_DATA.
-   Return a pointer to the start of the section contents and store
-   the length of the section in *LEN_P.
-
-   FIXME pph, this does not currently handle multiple sections.  It
-   assumes that the file has exactly one section.  */
-
-static const char *
-pph_get_section_data (struct lto_file_decl_data *file_data,
-		      enum lto_section_type section_type ATTRIBUTE_UNUSED,
-		      const char *name ATTRIBUTE_UNUSED,
-		      size_t *len)
-{
-  /* FIXME pph - Stop abusing lto_file_decl_data fields.  */
-  const pph_stream *stream = (const pph_stream *) file_data->file_name;
-  *len = stream->encoder.r.file_size - sizeof (pph_file_header);
-  return (const char *) stream->encoder.r.file_data + sizeof (pph_file_header);
-}
-
-
-/* Free the section data from FILE_DATA of SECTION_TYPE and NAME that
-   starts at OFFSET and has LEN bytes.  */
-
-static void
-pph_free_section_data (struct lto_file_decl_data *file_data,
-		       enum lto_section_type section_type ATTRIBUTE_UNUSED,
-		       const char *name ATTRIBUTE_UNUSED,
-		       const char *offset ATTRIBUTE_UNUSED,
-		       size_t len ATTRIBUTE_UNUSED)
-{
-  /* FIXME pph - Stop abusing lto_file_decl_data fields.  */
-  const pph_stream *stream = (const pph_stream *) file_data->file_name;
-  free (stream->encoder.r.file_data);
-}
-
-
 /* Read into memory the contents of the file in STREAM.  Initialize
    internal tables and data structures needed to re-construct the
    ASTs in the file.  */
@@ -154,18 +118,12 @@ pph_init_read (pph_stream *stream)
 		      stream->encoder.r.file_size, stream->file);
   gcc_assert (bytes_read == stream->encoder.r.file_size);
 
-  /* Set LTO callbacks to read the PPH file.  */
+  /* Set up the file sections, header, body and string table for the
+     low-level streaming routines.  */
   stream->encoder.r.pph_sections = XCNEWVEC (struct lto_file_decl_data *,
 					     PPH_NUM_SECTIONS);
   for (i = 0; i < PPH_NUM_SECTIONS; i++)
-    {
-      stream->encoder.r.pph_sections[i] = XCNEW (struct lto_file_decl_data);
-      /* FIXME pph - Stop abusing fields in lto_file_decl_data.  */
-      stream->encoder.r.pph_sections[i]->file_name = (const char *) stream;
-    }
-
-  lto_set_in_hooks (stream->encoder.r.pph_sections, pph_get_section_data,
-		    pph_free_section_data);
+    stream->encoder.r.pph_sections[i] = XCNEW (struct lto_file_decl_data);
 
   header = (pph_file_header *) stream->encoder.r.file_data;
   strtab = (const char *) header + sizeof (pph_file_header);

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


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