From patchwork Tue Aug 16 23:17:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 110251 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 6E369B6F8B for ; Wed, 17 Aug 2011 09:18:19 +1000 (EST) Received: (qmail 9788 invoked by alias); 16 Aug 2011 23:18:14 -0000 Received: (qmail 9777 invoked by uid 22791); 16 Aug 2011 23:18:13 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Aug 2011 23:17:59 +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 p7GNHwgP032703; Tue, 16 Aug 2011 16:17:58 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by hpaq12.eem.corp.google.com with ESMTP id p7GNHuMa007910; Tue, 16 Aug 2011 16:17:56 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id D9FD81C0F8B; Tue, 16 Aug 2011 16:17:55 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] New test - highlights issue with loading of pph child references (issue4898054) Message-Id: <20110816231755.D9FD81C0F8B@gchare.mtv.corp.google.com> Date: Tue, 16 Aug 2011 16:17:55 -0700 (PDT) From: gchare@google.com (Gabriel Charette) 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 I noticed an issue while reading the code the child referencing code more in depth and wrote the following tests which exposes that issue. We are loading every single header in the translation unit (not only the direct children) when doing pph_in_includes, but the children themselves correctly load their children; thus we end up with multiple instances of the same things. I think this is due to the fact that everytime we call pph_read_file we add the file read to the list of includes (i.e. this also adds children of children to the includes list when the children itself is read and reads its children...). I'm working on a better linemap streaming, but I must rely on the list of includes consisting only of the top-level includes (direct children) for the current pph. Committed to pph. Gab 2011-08-16 Gabriel Charette * g++.dg/pph/c0deepincl1.h: New. * g++.dg/pph/c1deepincl2.h: New. * g++.dg/pph/c2deepincl3.h: New. * g++.dg/pph/c2deepincl.cc: New asm xdiff. --- This patch is available for review at http://codereview.appspot.com/4898054 diff --git a/gcc/testsuite/g++.dg/pph/c0deepincl1.h b/gcc/testsuite/g++.dg/pph/c0deepincl1.h new file mode 100644 index 0000000..4360163 --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c0deepincl1.h @@ -0,0 +1,6 @@ +#ifndef C0DEEPINCL1_H +#define C0DEEPINCL1_H + +int a = 0; + +#endif diff --git a/gcc/testsuite/g++.dg/pph/c1deepincl2.h b/gcc/testsuite/g++.dg/pph/c1deepincl2.h new file mode 100644 index 0000000..4861064 --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c1deepincl2.h @@ -0,0 +1,8 @@ +#ifndef C1DEEPINCL2_H +#define C1DEEPINCL2_H + +#include "c0deepincl1.h" + +int b = 1; + +#endif diff --git a/gcc/testsuite/g++.dg/pph/c2deepincl.cc b/gcc/testsuite/g++.dg/pph/c2deepincl.cc new file mode 100644 index 0000000..da56b1e --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c2deepincl.cc @@ -0,0 +1,7 @@ +// pph asm xdiff 00611 + +#include "c2deepincl3.h" + +int test() { + return a + b + c; +} diff --git a/gcc/testsuite/g++.dg/pph/c2deepincl3.h b/gcc/testsuite/g++.dg/pph/c2deepincl3.h new file mode 100644 index 0000000..d3a1522 --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c2deepincl3.h @@ -0,0 +1,8 @@ +#ifndef C2DEEPINCL3_H +#define C2DEEPINCL3_H + +#include "c1deepincl2.h" + +int c = 2; + +#endif