We are very close to having the first simple C++ program working from
a PPH image.  Adding a runnable test case.

This produces assembly miscomparisons and does not link.  I'll be
working on it this week.


Diego.

        * g++.dg/pph/x1ten-hellos.cc: New.
        * g++.dg/pph/x1ten-hellos.h: New.
        * g++.dg/pph/pph.map: Add x1ten-hellos.h

diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc 
b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc
new file mode 100644
index 0000000..b99d08a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.cc
@@ -0,0 +1,12 @@
+// { dg-do run }
+// { dg-xfail-if "LINK ERROR" { "*-*-*" } { "-fpph-map=pph.map" } }
+// pph asm xdiff
+#include "x1ten-hellos.h"
+
+int main(void)
+{
+  A a;
+  for (int i = 0; i < 10; i++)
+    a.hello();
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pph/x1ten-hellos.h 
b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h
new file mode 100644
index 0000000..2a53b66
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x1ten-hellos.h
@@ -0,0 +1,21 @@
+#ifndef A_H_
+#define A_H_
+#include <stdio.h>
+
+class A
+{
+public:
+  A() {
+    x_ = 0;
+    printf ("constructing\n");
+  }
+
+  void hello(void) {
+    x_++;
+    printf ("Hello World (%d)\n", x_);
+  }
+
+private:
+  int x_;
+};
+#endif
diff --git a/gcc/testsuite/g++.dg/pph/pph.map b/gcc/testsuite/g++.dg/pph/pph.map
index f0c7abd..2735af8 100644
--- a/gcc/testsuite/g++.dg/pph/pph.map
+++ b/gcc/testsuite/g++.dg/pph/pph.map
@@ -38,6 +47,7 @@ x1struct0.h   x1struct0.pph
 x1struct1.h    x1struct1.pph
 x1struct2.h    x1struct2.pph
 x1template.h   x1template.pph
+x1ten-hellos.h x1ten-hellos.pph
 x1tmplclass.h  x1tmplclass.pph
 x1tmplfunc.h   x1tmplfunc.pph
 x1typerefs.h   x1typerefs.pph

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

Reply via email to