Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(322)

Issue 4400048: [pph] Rebuild compilation context from PPH images (0/6) (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years ago by Diego Novillo
Modified:
13 years ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -16 lines) Patch
M gcc/cp/pph.c View 2 chunks +7 lines, -16 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
13 years ago (2011-04-14 19:40:34 UTC) #1
This patch is the first of a series of 7 patches to reconstruct the
compilation context out of a PPH image.

Currently, there are 32 failures in the PPH testsuite.  Most are
assembly miscomparisons.  There are still missing bits in the images
that we are not pickling properly, but I think it makes more sense to
commit this so we can continue fixing the problems from here.

With these patches the branch is up to the point where simple
declarations in headers are handled properly.  For instance:

$ cat a.h
#ifndef _A_H
#define _A_H
float y;
int b;
struct X {
    float a;
    int b;
};
#endif

$ cat a.cc
#include "a.h"

struct X x;
main()
{
 y = 4.2;
 b = 42;
 x.a = y - b;
 return 0;
}

$ bin/g++ -fpph-hdr=a -o a.pph a.h
$ bin/g++ -fpph-hdr=a -o a a.cc
$ echo $?
0

But, it gets confused easily too.  So, now we need to debug it until
it works.

Tested on x86_64.
    
    	* pph.c (pph_read_file_contents): Re-instate call to
    	pph_add_names_to_namespace.
    	(pph_include_handler): Return false if the file has been
    	read from an image.

diff --git a/gcc/cp/pph.c b/gcc/cp/pph.c
index bf37915..6584e72 100644
--- a/gcc/cp/pph.c
+++ b/gcc/cp/pph.c
@@ -1978,20 +1978,13 @@ pph_read_file_contents (pph_stream *stream)
     report_validation_error (stream->name, bad_use->ident_str, cur_def,
                              bad_use->before_str, bad_use->after_str);
 
-  /* FIXME pph - Temporary workaround.  Instantiating PPH images
-     causes several failures in the PPH testsuite.  */
-  if (0)
-    {
-      /* Re-instantiate all the pre-processor symbols defined by STREAM.  */
-      cpp_lt_replay (parse_in, &idents_used);
+  /* 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_input_tree (stream);
-      pph_add_names_to_namespace (global_namespace, file_ns);
-    }
-  else
-    pph_input_tree (stream);
+  /* Read global_namespace from STREAM and add all the names defined
+     there to the current global_namespace.  */
+  file_ns = pph_input_tree (stream);
+  pph_add_names_to_namespace (global_namespace, file_ns);
 }
 
 
@@ -2075,9 +2068,7 @@ pph_include_handler (cpp_reader *reader,
   if (pph_file != NULL && !cpp_included_before (reader, name, input_location))
     {
       pph_read_file (pph_file);
-      /* FIXME pph - Temporary workaround.  Instantiating PPH images
-	 causes several failures in the PPH testsuite.  */
-      read_text_file_p = /*false*/ true;
+      read_text_file_p = false;
     }
 
   return read_text_file_p;

--
This patch is available for review at http://codereview.appspot.com/4400048
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b