Patchwork [pph] New test - highlights issue with loading of pph child references (issue4898054)

login
register
mail settings
Submitter Gab Charette
Date Aug. 16, 2011, 11:17 p.m.
Message ID <20110816231755.D9FD81C0F8B@gchare.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/110251/
State New
Headers show

Comments

Gab Charette - Aug. 16, 2011, 11:17 p.m.
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  <gchare@google.com>

	* 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

Patch

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