From patchwork Thu Apr 14 19:40:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 91281 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BF4ACB6F94 for ; Fri, 15 Apr 2011 05:40:42 +1000 (EST) Received: (qmail 20810 invoked by alias); 14 Apr 2011 19:40:41 -0000 Received: (qmail 20797 invoked by uid 22791); 14 Apr 2011 19:40:40 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Apr 2011 19:40:35 +0000 Received: from hpaq12.eem.corp.google.com (hpaq12.eem.corp.google.com [172.25.149.12]) by smtp-out.google.com with ESMTP id p3EJeXGW007464; Thu, 14 Apr 2011 12:40:33 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by hpaq12.eem.corp.google.com with ESMTP id p3EJeW15013633; Thu, 14 Apr 2011 12:40:32 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id B6192A00D; Thu, 14 Apr 2011 15:40:31 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Rebuild compilation context from PPH images (0/6) (issue4400048) Message-Id: <20110414194031.B6192A00D@topo.tor.corp.google.com> Date: Thu, 14 Apr 2011 15:40:31 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. --- This patch is available for review at http://codereview.appspot.com/4400048 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;