This patch ads a bunch of small tests for multi-pph includes.

Tested on x64.


Index: gcc/testsuite/ChangeLog.pph

2011-08-04  Lawrence Crowl  <cr...@google.com>

        * g++.dg/pph/README: Add new file types.
        * g++.dg/pph/a0expinstinl.h: New.
        * g++.dg/pph/a0expinstnin.h: New.
        * g++.dg/pph/a0inline.h: New.
        * g++.dg/pph/a0keyed.h: New.
        * g++.dg/pph/a0keyno.h: New.
        * g++.dg/pph/a0noninline.h: New.
        * g++.dg/pph/a0nontrivinit.h: New.
        * g++.dg/pph/a0rawstruct.h: New.
        * g++.dg/pph/a0rtti.h: New.
        * g++.dg/pph/a0template.h: New.
        * g++.dg/pph/a0tmplclass.h: New.
        * g++.dg/pph/a0typedef.h: New.
        * g++.dg/pph/a0variables1.h: New.
        * g++.dg/pph/a0variables2.h: New.
        * g++.dg/pph/c0inline1.h: New.
        * g++.dg/pph/c0inline2.h: New.
        * g++.dg/pph/c0rawstruct1.h: New.
        * g++.dg/pph/c0rawstruct2.h: New.
        * g++.dg/pph/c0typedef1.h: New.
        * g++.dg/pph/c0typedef2.h: New.
        * g++.dg/pph/c0variables.h: Contents to a0variables.h.
        Renamed to c0variables1.h.
        * g++.dg/pph/c0variables1.h: New.
        * g++.dg/pph/c0variables2.h: New.
        * g++.dg/pph/c0variables3.h: New.
        * g++.dg/pph/c0variables4.h: New.
        * g++.dg/pph/c1variables.cc: Handle renaming.
        * g++.dg/pph/c3rawstruct.cc: New.
        * g++.dg/pph/c3rawstruct.s: New.
        * g++.dg/pph/c3typedef.cc: New.
        * g++.dg/pph/c3variables.cc: New.
        * g++.dg/pph/c4inline.cc: New.
        * g++.dg/pph/e0noninline1.h: New.
        * g++.dg/pph/e0noninline2.h: New.
        * g++.dg/pph/e4noninline.cc: New.
        * g++.dg/pph/e4variables.cc: New.
        * g++.dg/pph/pph.exp: Add FIXME.
        * g++.dg/pph/x0keyed1.h: New.
        * g++.dg/pph/x0keyed2.h: New.
        * g++.dg/pph/x0keyno1.h: New.
        * g++.dg/pph/x0keyno2.h: New.
        * g++.dg/pph/x0nontrivinit.h: Contents to a0nontrivinit.h.
        Renamed to x0nontrivinit1.h.
        * g++.dg/pph/x0nontrivinit1.h: Renamed from x0nontrivinit.h.
        * g++.dg/pph/x0nontrivinit2.h: New.
        * g++.dg/pph/x0template.h: Contents to a0template.h.
        Renamed to x0template1.h.
        * g++.dg/pph/x0template1.h: Renamed from x0template.
        * g++.dg/pph/x0template2.h: New.
        * g++.dg/pph/x0tmplclass.h: Contents to a0tmplclass.h.
        Renamed to x0tmplclass1.h.
        * g++.dg/pph/x0tmplclass1.h: Renamed from x0tmplclass.h.
        * g++.dg/pph/x0tmplclass2.h: New.
        * g++.dg/pph/x1keyed.cc: New.
        * g++.dg/pph/x1keyno.cc: New.
        * g++.dg/pph/x1nontrivinit.cc: Handle renaming.
        * g++.dg/pph/x1template.cc: Handle renaming.
        * g++.dg/pph/x1tmplclass.cc: Handle renaming.
        * g++.dg/pph/x1variables.h: Handle renaming.
        * g++.dg/pph/x4keyed.cc: New.
        * g++.dg/pph/x4keyno.cc: New.
        * g++.dg/pph/x4template.cc: New.
        * g++.dg/pph/x5rtti1.h: New.
        * g++.dg/pph/x5rtti2.h: New.
        * g++.dg/pph/x6rtti.cc: New.
        * g++.dg/pph/x7rtti.cc: New.
        * g++.dg/pph/z0expinstinl1.h: New.
        * g++.dg/pph/z0expinstinl2.h: New.
        * g++.dg/pph/z0expinstnin1.h: New.
        * g++.dg/pph/z0expinstnin2.h: New.
        * g++.dg/pph/z4expinstinl.cc: New.
        * g++.dg/pph/z4expinstnin.cc: New.
        * g++.dg/pph/z4nontrivinit.cc: New.


Index: gcc/testsuite/g++.dg/pph/z0expinstnin1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/z0expinstnin1.h    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z0expinstnin1.h    (revision 0)
@@ -0,0 +1,6 @@
+#ifndef X0EXPINSTNIN1_H
+#define X0EXPINSTNIN1_H
+
+#include "a0expinstnin.h"
+
+#endif
Index: gcc/testsuite/g++.dg/pph/e0noninline2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/e0noninline2.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/e0noninline2.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef E0NONINLINE2_H
+#define E0NONINLINE2_H
+#include "a0noninline.h"
+int h() { struct S s = { 3, 4 }; return f(s) * 3; }
+#endif
Index: gcc/testsuite/g++.dg/pph/x0tmplclass.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0tmplclass.h      (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x0tmplclass.h      (working copy)
@@ -1,17 +0,0 @@
-#ifndef X0TMPLCLASS_H
-#define X0TMPLCLASS_H
-template< typename T >
-struct wrapper {
-  T value;
-  static T cache;
-};
-
-template< typename T >
-T wrapper<T>::cache = 3;
-
-template<>
-struct wrapper<char> {
-  int value;
-  static int cache;
-};
-#endif
Index: gcc/testsuite/g++.dg/pph/x0tmplclass2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0tmplclass2.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0tmplclass2.h     (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0TMPLCLASS2_H
+#define X0TMPLCLASS2_H
+#include "a0tmplclass.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/c0rawstruct1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0rawstruct1.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0rawstruct1.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0RAWSTRUCT1_H
+#define C0RAWSTRUCT1_H
+#include "a0rawstruct.h"
+int g() { struct S s = { 1, 2 }; return s.a; }
+#endif
Index: gcc/testsuite/g++.dg/pph/c0typedef2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0typedef2.h       (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0typedef2.h       (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0TYPEDEF2_H
+#define C0TYPEDEF2_H
+#include "a0typedef.h"
+inline type func2( type arg ) { return 2 * arg; }
+#endif
Index: gcc/testsuite/g++.dg/pph/x0template2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0template2.h      (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0template2.h      (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0TEMPLATE2_H
+#define X0TEMPLATE2_H
+#include "a0template.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/z4expinstinl.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/z4expinstinl.cc    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z4expinstinl.cc    (revision 0)
@@ -0,0 +1,12 @@
+// pph asm xdiff 10014
+//FIXME Emitting a second copy of the explicit instantiation of 'function'.
+//FIXME With comdat, the linker may paper over the differences.
+
+#include "z0expinstinl1.h"
+#include "z0expinstinl2.h"
+
+int main()
+{
+  int var = 1;
+  return function(var);
+}
Index: gcc/testsuite/g++.dg/pph/a0variables2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0variables2.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0variables2.h     (revision 0)
@@ -0,0 +1,6 @@
+#ifndef A0VARIABLES2_H
+#define A0VARIABLES2_H
+int gbl_initial = 1;
+const float gbl_init_const = 1.5;
+const int gbl_manifest = 2;
+#endif
Index: gcc/testsuite/g++.dg/pph/c0variables1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0variables1.h     (revision 176951)
+++ gcc/testsuite/g++.dg/pph/c0variables1.h     (working copy)
@@ -1,7 +1,4 @@
-#ifndef C0VARIABLES_H
-#define C0VARIABLES_H
-extern int gbl_init_extern;
-extern int gbl_uninit_extern;
-int gbl_tentative;
-extern const int gbl_extern_const;
+#ifndef C0VARIABLES1_H
+#define C0VARIABLES1_H
+#include "a0variables1.h"
 #endif
Index: gcc/testsuite/g++.dg/pph/x0keyno1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0keyno1.h (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0keyno1.h (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0KEYED1_H
+#define X0KEYED1_H
+#include "a0keyed.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/x1variables.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x1variables.h      (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x1variables.h      (working copy)
@@ -1,6 +1,6 @@
 #ifndef X1VARIABLES_H
 #define X1VARIABLES_H
-#include "c0variables.h"
+#include "c0variables1.h"
 struct D {
     static int mbr_init_plain;
     static int mbr_uninit_plain;
Index: gcc/testsuite/g++.dg/pph/x5rtti2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x5rtti2.h  (revision 0)
+++ gcc/testsuite/g++.dg/pph/x5rtti2.h  (revision 0)
@@ -0,0 +1,12 @@
+#ifndef X5RTTI2_H
+#define X5RTTI2_H
+
+#include <typeinfo>
+#include "a0rtti.h"
+
+const std::type_info& poly2() { return typeid( polymorphic ); }
+const std::type_info& nonp2() { return typeid( non_polymorphic ); }
+const std::type_info& hpol2() { polymorphic var; return var.hidden(); }
+const std::type_info& hnpl2() { non_polymorphic var; return var.hidden(); }
+
+#endif
Index: gcc/testsuite/g++.dg/pph/c0variables.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0variables.h      (revision 177422)
+++ gcc/testsuite/g++.dg/pph/c0variables.h      (working copy)
@@ -1,7 +0,0 @@
-#ifndef C0VARIABLES_H
-#define C0VARIABLES_H
-extern int gbl_init_extern;
-extern int gbl_uninit_extern;
-int gbl_tentative;
-extern const int gbl_extern_const;
-#endif
Index: gcc/testsuite/g++.dg/pph/z0expinstnin2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/z0expinstnin2.h    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z0expinstnin2.h    (revision 0)
@@ -0,0 +1,6 @@
+#ifndef X0EXPINSTNIN2_H
+#define X0EXPINSTNIN2_H
+
+#include "a0expinstnin.h"
+
+#endif
Index: gcc/testsuite/g++.dg/pph/pph.exp
===================================================================
--- gcc/testsuite/g++.dg/pph/pph.exp    (revision 177422)
+++ gcc/testsuite/g++.dg/pph/pph.exp    (working copy)
@@ -29,6 +29,7 @@ dg-init
 # FIXME set scenarios [list "" "-g" "-O"]
 set scenarios [list "" ]
 
+# FIXME enable p and z tests when we feel we are ready
 set hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdpxy\]*.h]]
 set neg_tests [lsort [glob -nocomplain $srcdir/$subdir/\[dy\]*.cc]]
 set pos_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cpx\]*.cc]]
Index: gcc/testsuite/g++.dg/pph/x1keyno.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x1keyno.cc (revision 0)
+++ gcc/testsuite/g++.dg/pph/x1keyno.cc (revision 0)
@@ -0,0 +1,10 @@
+// pph asm xdiff 20949
+// Looks like destructors botched.
+
+#include "x0keyno1.h"
+
+int main()
+{
+    keyed variable;
+    return variable.mix( 3 );
+}
Index: gcc/testsuite/g++.dg/pph/a0template.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0template.h       (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0template.h       (revision 0)
@@ -0,0 +1,20 @@
+#ifndef A0TEMPLATE_H
+#define A0TEMPLATE_H
+extern int x;
+struct B;
+template< typename T >
+struct C {
+    T* b;
+    int method();
+    int another()
+    { return *b; }
+};
+template< typename T >
+int C< T >::method()
+{ return x; }
+struct D : C< int > {
+    int method();
+    int another()
+    { return *b; }
+};
+#endif
Index: gcc/testsuite/g++.dg/pph/x4keyno.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x4keyno.cc (revision 0)
+++ gcc/testsuite/g++.dg/pph/x4keyno.cc (revision 0)
@@ -0,0 +1,11 @@
+// pph asm xdiff 64958
+// Looks like destructors botched.
+
+#include "x0keyno1.h"
+#include "x0keyno2.h"
+
+int main()
+{
+    keyed variable;
+    return variable.mix( 3 );
+}
Index: gcc/testsuite/g++.dg/pph/x1template.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x1template.cc      (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x1template.cc      (working copy)
@@ -1,4 +1,4 @@
-#include "x0template.h"
+#include "x0template1.h"
 
 int x = 3;
 
Index: gcc/testsuite/g++.dg/pph/c0inline1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0inline1.h        (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0inline1.h        (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0INLINE1_H
+#define C0INLINE1_H
+#include "a0inline.h"
+inline int g() { struct S s = { 1, 2 }; return f(s) * 2; }
+#endif
Index: gcc/testsuite/g++.dg/pph/a0inline.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0inline.h (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0inline.h (revision 0)
@@ -0,0 +1,5 @@
+#ifndef A0INLINE_H
+#define A0INLINE_H
+struct S { int a, b; };
+inline int f(struct S s) { return s.a + s.b; }
+#endif
Index: gcc/testsuite/g++.dg/pph/c0rawstruct2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0rawstruct2.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0rawstruct2.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0RAWSTRUCT2_H
+#define C0RAWSTRUCT2_H
+#include "a0rawstruct.h"
+int h() { struct S s = { 3, 4 }; return s.b; }
+#endif
Index: gcc/testsuite/g++.dg/pph/a0nontrivinit.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0nontrivinit.h    (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0nontrivinit.h    (revision 0)
@@ -0,0 +1,5 @@
+#ifndef A0NONTRIVINIT_H
+#define A0NONTRIVINIT_H
+int y = 0;
+int x = y+1;
+#endif
Index: gcc/testsuite/g++.dg/pph/README
===================================================================
--- gcc/testsuite/g++.dg/pph/README     (revision 177422)
+++ gcc/testsuite/g++.dg/pph/README     (working copy)
@@ -4,13 +4,15 @@ names.
     [acdpxy][0-9]*
 
     a - auxillary headers
-    c - positive tests for c-level headers and sources
-    d - negative tests for c-level headers and sources
+    c - positive tests for C-level headers and sources
+    d - negative tests for C-level headers and sources
+    e - C-level tests for non-sharable headers
     p - positive tests for what would be c-level code, but which
         due to C++ standard namespace games are not quite C level
-        tests.
-    x - C++-level positive tests.
-    y - C++-level negative tests.
+        tests
+    x - C++-level positive tests
+    y - C++-level negative tests
+    z - C++-level tests for non-sharable headers
 
     0 - tests with no pph inclusions (usually headers)
     1 - tests with a single leading pph file
Index: gcc/testsuite/g++.dg/pph/x1tmplclass.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x1tmplclass.cc     (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x1tmplclass.cc     (working copy)
@@ -1,5 +1,4 @@
-
-#include "x0tmplclass.h"
+#include "x0tmplclass1.h"
 
 int wrapper<char>::cache = 2;
 
Index: gcc/testsuite/g++.dg/pph/a0noninline.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0noninline.h      (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0noninline.h      (revision 0)
@@ -0,0 +1,5 @@
+#ifndef A0NONINLINE_H
+#define A0NONINLINE_H
+struct S { int a, b; };
+int f(struct S s) { return s.a + s.b; }
+#endif
Index: gcc/testsuite/g++.dg/pph/c0variables2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0variables2.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0variables2.h     (revision 0)
@@ -0,0 +1,4 @@
+#ifndef C0VARIABLES2_H
+#define C0VARIABLES2_H
+#include "a0variables1.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/a0expinstinl.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0expinstinl.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0expinstinl.h     (revision 0)
@@ -0,0 +1,12 @@
+#ifndef A0EXPINSTINL_H
+#define A0EXPINSTINL_H
+
+template< typename T >
+inline int function( T t )
+{
+    return t * 2;
+}
+
+template int function(int);
+
+#endif
Index: gcc/testsuite/g++.dg/pph/a0rawstruct.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0rawstruct.h      (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0rawstruct.h      (revision 0)
@@ -0,0 +1,4 @@
+#ifndef A0RAWSTRUCT_H
+#define A0RAWSTRUCT_H
+struct S { int a, b; };
+#endif
Index: gcc/testsuite/g++.dg/pph/x0keyno2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0keyno2.h (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0keyno2.h (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0KEYED2_H
+#define X0KEYED2_H
+#include "a0keyed.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/a0typedef.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0typedef.h        (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0typedef.h        (revision 0)
@@ -0,0 +1,4 @@
+#ifndef A0TYPEDEF_H
+#define A0TYPEDEF_H
+typedef int type;
+#endif
Index: gcc/testsuite/g++.dg/pph/a0tmplclass.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0tmplclass.h      (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0tmplclass.h      (revision 0)
@@ -0,0 +1,17 @@
+#ifndef A0TMPLCLASS_H
+#define A0TMPLCLASS_H
+template< typename T >
+struct wrapper {
+  T value;
+  static T cache;
+};
+
+template< typename T >
+T wrapper<T>::cache = 3;
+
+template<>
+struct wrapper<char> {
+  int value;
+  static int cache;
+};
+#endif
Index: gcc/testsuite/g++.dg/pph/x4template.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x4template.cc      (revision 0)
+++ gcc/testsuite/g++.dg/pph/x4template.cc      (revision 0)
@@ -0,0 +1,14 @@
+// pph asm xdiff 23306
+
+#include "x0template1.h"
+#include "x0template2.h"
+
+int x = 3;
+
+int y = 4;
+
+int D::method()
+{ return y; }
+
+int main()
+{ }
Index: gcc/testsuite/g++.dg/pph/x1nontrivinit.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x1nontrivinit.cc   (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x1nontrivinit.cc   (working copy)
@@ -1 +1 @@
-#include "x0nontrivinit.h"
+#include "x0nontrivinit1.h"
Index: gcc/testsuite/g++.dg/pph/x0keyed1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0keyed1.h (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0keyed1.h (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0KEYED1_H
+#define X0KEYED1_H
+#include "a0keyed.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/e4variables.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/e4variables.cc     (revision 0)
+++ gcc/testsuite/g++.dg/pph/e4variables.cc     (revision 0)
@@ -0,0 +1,7 @@
+#include "c0variables3.h"
+#include "c0variables4.h"
+
+int main()
+{
+    return gbl_initial + gbl_init_const + gbl_manifest;
+}
Index: gcc/testsuite/g++.dg/pph/z4nontrivinit.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/z4nontrivinit.cc   (revision 0)
+++ gcc/testsuite/g++.dg/pph/z4nontrivinit.cc   (revision 0)
@@ -0,0 +1,2 @@
+#include "x0nontrivinit1.h"
+#include "x0nontrivinit2.h"
Index: gcc/testsuite/g++.dg/pph/a0rtti.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0rtti.h   (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0rtti.h   (revision 0)
@@ -0,0 +1,20 @@
+#ifndef A0RTTI_H
+#define A0RTTI_H
+
+struct polymorphic
+{
+    int field;
+    virtual int method() { return field; }
+    const std::type_info& hidden() { return typeid( field ); }
+    virtual ~polymorphic() { }
+};
+
+struct non_polymorphic
+{
+    int field;
+    int method() { return field; }
+    const std::type_info& hidden() { return typeid( field ); }
+    ~non_polymorphic() { }
+};
+
+#endif
Index: gcc/testsuite/g++.dg/pph/x1keyed.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x1keyed.cc (revision 0)
+++ gcc/testsuite/g++.dg/pph/x1keyed.cc (revision 0)
@@ -0,0 +1,12 @@
+// pph asm xdiff 17458
+// Looks like destructors botched.
+
+#include "x0keyed1.h"
+
+int keyed::key( int arg ) { return mix( field & arg ); }
+
+int main()
+{
+    keyed variable;
+    return variable.key( 3 );
+}
Index: gcc/testsuite/g++.dg/pph/x4keyed.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x4keyed.cc (revision 0)
+++ gcc/testsuite/g++.dg/pph/x4keyed.cc (revision 0)
@@ -0,0 +1,14 @@
+// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } }
+// { dg-bogus "a0keyed.h:14:1: error: redefinition of .const char _ZTS5keyed 
[]." "" { xfail *-*-* } 0 }
+// { dg-bogus "a0keyed.h:14:1: error: .const char _ZTS5keyed .7.. previously 
defined here" "" { xfail *-*-* } 0 }
+
+#include "x0keyed1.h"
+#include "x0keyed2.h"
+
+int keyed::key( int arg ) { return mix( field & arg ); }
+
+int main()
+{
+    keyed variable;
+    return variable.key( 3 );
+}
Index: gcc/testsuite/g++.dg/pph/z4expinstnin.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/z4expinstnin.cc    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z4expinstnin.cc    (revision 0)
@@ -0,0 +1,8 @@
+#include "z0expinstnin1.h"
+#include "z0expinstnin2.h"
+
+int main()
+{
+  int var = 1;
+  return function(var);
+}
Index: gcc/testsuite/g++.dg/pph/a0expinstnin.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0expinstnin.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0expinstnin.h     (revision 0)
@@ -0,0 +1,12 @@
+#ifndef A0EXPINSTNIN_H
+#define A0EXPINSTNIN_H
+
+template< typename T >
+int function( T t )
+{
+    return t * 2;
+}
+
+template int function(int);
+
+#endif
Index: gcc/testsuite/g++.dg/pph/c0inline2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0inline2.h        (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0inline2.h        (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0INLINE2_H
+#define C0INLINE2_H
+#include "a0inline.h"
+inline int h() { struct S s = { 3, 4 }; return f(s) * 3; }
+#endif
Index: gcc/testsuite/g++.dg/pph/z0expinstinl1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/z0expinstinl1.h    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z0expinstinl1.h    (revision 0)
@@ -0,0 +1,6 @@
+#ifndef X0EXPINSTINL1_H
+#define X0EXPINSTINL1_H
+
+#include "a0expinstinl.h"
+
+#endif
Index: gcc/testsuite/g++.dg/pph/c3rawstruct.s
===================================================================
--- gcc/testsuite/g++.dg/pph/c3rawstruct.s      (revision 0)
+++ gcc/testsuite/g++.dg/pph/c3rawstruct.s      (revision 0)
@@ -0,0 +1,80 @@
+       .file   "c3rawstruct.cc"
+       .text
+.globl _Z1gv
+       .type   _Z1gv, @function
+_Z1gv:
+.LFB0:
+       .cfi_startproc
+       .cfi_personality 0x3,__gxx_personality_v0
+       pushq   %rbp
+       .cfi_def_cfa_offset 16
+       movq    %rsp, %rbp
+       .cfi_offset 6, -16
+       .cfi_def_cfa_register 6
+       movl    $1, -16(%rbp)
+       movl    $2, -12(%rbp)
+       movl    -16(%rbp), %eax
+       leave
+       ret
+       .cfi_endproc
+.LFE0:
+       .size   _Z1gv, .-_Z1gv
+.globl _Z1hv
+       .type   _Z1hv, @function
+_Z1hv:
+.LFB1:
+       .cfi_startproc
+       .cfi_personality 0x3,__gxx_personality_v0
+       pushq   %rbp
+       .cfi_def_cfa_offset 16
+       movq    %rsp, %rbp
+       .cfi_offset 6, -16
+       .cfi_def_cfa_register 6
+       movl    $3, -16(%rbp)
+       movl    $4, -12(%rbp)
+       movl    -12(%rbp), %eax
+       leave
+       ret
+       .cfi_endproc
+.LFE1:
+       .size   _Z1hv, .-_Z1hv
+.globl s
+       .data
+       .align 4
+       .type   s, @object
+       .size   s, 8
+s:
+       .long   5
+       .long   6
+       .text
+.globl main
+       .type   main, @function
+main:
+.LFB2:
+       .cfi_startproc
+       .cfi_personality 0x3,__gxx_personality_v0
+       pushq   %rbp
+       .cfi_def_cfa_offset 16
+       movq    %rsp, %rbp
+       .cfi_offset 6, -16
+       .cfi_def_cfa_register 6
+       pushq   %rbx
+       subq    $8, %rsp
+       .cfi_offset 3, -24
+       call    _Z1gv
+       movl    %eax, %ebx
+       call    _Z1hv
+       leal    (%rbx,%rax), %edx
+       movl    s(%rip), %eax
+       addl    %eax, %edx
+       movl    s+4(%rip), %eax
+       leal    (%rdx,%rax), %eax
+       addq    $8, %rsp
+       popq    %rbx
+       leave
+       ret
+       .cfi_endproc
+.LFE2:
+       .size   main, .-main
+       .ident  "GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4.3"
+       .section        .note.GNU-stack,"",@progbits
Index: gcc/testsuite/g++.dg/pph/x0nontrivinit1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0nontrivinit1.h   (revision 176951)
+++ gcc/testsuite/g++.dg/pph/x0nontrivinit1.h   (working copy)
@@ -1,5 +1,4 @@
-#ifndef X0NONTRIVINIT_H
-#define X0NONTRIVINIT_H
-int y = 0;
-int x = y+1;
+#ifndef X0NONTRIVINIT1_H
+#define X0NONTRIVINIT1_H
+#include "a0nontrivinit.h"
 #endif
Index: gcc/testsuite/g++.dg/pph/c0variables3.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0variables3.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0variables3.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0VARIABLES3_H
+#define C0VARIABLES3_H
+#include "a0variables1.h"
+#include "a0variables2.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/c3rawstruct.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c3rawstruct.cc     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c3rawstruct.cc     (revision 0)
@@ -0,0 +1,9 @@
+#include "c0rawstruct1.h"
+#include "c0rawstruct2.h"
+
+struct S s = { 5, 6 };;
+
+int main()
+{
+  return g() + h() + s.a + s.b;
+}
Index: gcc/testsuite/g++.dg/pph/a0keyed.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0keyed.h  (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0keyed.h  (revision 0)
@@ -0,0 +1,9 @@
+#ifndef A0KEYED_H
+#define A0KEYED_H
+struct keyed {
+    int field;
+    virtual int mix( int arg ) { return field ^ arg; }
+    virtual int key( int arg );
+    virtual ~keyed() { }
+};
+#endif
Index: gcc/testsuite/g++.dg/pph/c3typedef.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c3typedef.cc       (revision 0)
+++ gcc/testsuite/g++.dg/pph/c3typedef.cc       (revision 0)
@@ -0,0 +1,7 @@
+#include "c0typedef1.h"
+#include "c0typedef2.h"
+
+int main()
+{
+    return func1( func2( 0 ) );
+};
Index: gcc/testsuite/g++.dg/pph/c1variables.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c1variables.cc     (revision 177422)
+++ gcc/testsuite/g++.dg/pph/c1variables.cc     (working copy)
@@ -1,5 +1,7 @@
-#include "c0variables.h"
+#include "c0variables1.h"
+#include "a0variables2.h"
 
-int gbl_initial = 1;
-const float gbl_init_const = 1.5;
-const int gbl_manifest = 2;
+int main()
+{
+    return gbl_initial + gbl_init_const + gbl_manifest;
+}
Index: gcc/testsuite/g++.dg/pph/x0nontrivinit.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0nontrivinit.h    (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x0nontrivinit.h    (working copy)
@@ -1,5 +0,0 @@
-#ifndef X0NONTRIVINIT_H
-#define X0NONTRIVINIT_H
-int y = 0;
-int x = y+1;
-#endif
Index: gcc/testsuite/g++.dg/pph/x0keyed2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0keyed2.h (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0keyed2.h (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0KEYED2_H
+#define X0KEYED2_H
+#include "a0keyed.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/c3variables.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c3variables.cc     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c3variables.cc     (revision 0)
@@ -0,0 +1,11 @@
+// pph asm xdiff 34997
+// tentative definition emitted twice
+
+#include "c0variables1.h"
+#include "c0variables2.h"
+#include "a0variables2.h"
+
+int main()
+{
+    return gbl_initial + gbl_init_const + gbl_manifest;
+}
Index: gcc/testsuite/g++.dg/pph/x7rtti.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x7rtti.cc  (revision 0)
+++ gcc/testsuite/g++.dg/pph/x7rtti.cc  (revision 0)
@@ -0,0 +1,30 @@
+// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } }
+// { dg-bogus "x5rtti1.h:11:0: warning: .__STDC_IEC_559_COMPLEX__. redefined 
.enabled by default." "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti1.h:11:0: warning: .__STDC_ISO_10646__. redefined 
.enabled by default." "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti1.h:11:0: warning: .__STDC_IEC_559__. redefined .enabled 
by default." "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti2.h:13:32: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:13:54: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:14:32: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:14:54: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:15:32: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:15:54: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:16:32: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:16:54: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti2.h:17:1: error: redefinition of .const char 
_ZTS15non_polymorphic ..." "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti2.h:17:1: error: .const char _ZTS15non_polymorphic .18.. 
previously defined here" "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti2.h:17:1: error: redefinition of .const char 
_ZTS11polymorphic ..." "" { xfail *-*-* } 0 }
+// { dg-bogus "x5rtti2.h:17:1: error: .const char _ZTS11polymorphic .14.. 
previously defined here" "" { xfail *-*-* } 0 }
+
+
+//FIXME We should make this a run test.
+
+#include "x5rtti1.h"
+#include "x5rtti2.h"
+
+int main()
+{
+    return    poly1() == poly2() && nonp1() == nonp2()
+           && hpol1() == hpol2() && hnpl1() == hnpl2()
+           && poly1() != nonp1() && hpol1() == hnpl1()
+           && poly2() != nonp2() && hpol2() == hnpl2();
+}
Index: gcc/testsuite/g++.dg/pph/e0noninline1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/e0noninline1.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/e0noninline1.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef E0NONINLINE1_H
+#define E0NONINLINE1_H
+#include "a0noninline.h"
+int g() { struct S s = { 1, 2 }; return f(s) * 2; }
+#endif
Index: gcc/testsuite/g++.dg/pph/e4noninline.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/e4noninline.cc     (revision 0)
+++ gcc/testsuite/g++.dg/pph/e4noninline.cc     (revision 0)
@@ -0,0 +1,11 @@
+// pph asm xdiff 52472
+//FIXME Emitting a second copy of the non-inline function f.
+//FIXME The linker should choke over this one.
+
+#include "e0noninline1.h"
+#include "e0noninline2.h"
+
+int main()
+{
+  return g() + h();
+}
Index: gcc/testsuite/g++.dg/pph/z0expinstinl2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/z0expinstinl2.h    (revision 0)
+++ gcc/testsuite/g++.dg/pph/z0expinstinl2.h    (revision 0)
@@ -0,0 +1,6 @@
+#ifndef X0EXPINSTINL2_H
+#define X0EXPINSTINL2_H
+
+#include "a0expinstinl.h"
+
+#endif
Index: gcc/testsuite/g++.dg/pph/x0tmplclass1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0tmplclass1.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0tmplclass1.h     (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0TMPLCLASS1_H
+#define X0TMPLCLASS1_H
+#include "a0tmplclass.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/x6rtti.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/x6rtti.cc  (revision 0)
+++ gcc/testsuite/g++.dg/pph/x6rtti.cc  (revision 0)
@@ -0,0 +1,13 @@
+// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } }
+// { dg-bogus "x5rtti1.h:13:29: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+// { dg-bogus "x5rtti1.h:13:51: error: no match for .operator" "" { xfail 
*-*-* } 0 }
+
+
+//FIXME We should make this a run test.
+
+#include "x5rtti1.h"
+
+int main()
+{
+    return poly1() != nonp1() && hpol1() == hnpl1();
+}
Index: gcc/testsuite/g++.dg/pph/c4inline.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c4inline.cc        (revision 0)
+++ gcc/testsuite/g++.dg/pph/c4inline.cc        (revision 0)
@@ -0,0 +1,11 @@
+// pph asm xdiff 46031
+//Emitting a second copy of the inline function f.
+//With comdat, the linker may paper over the differences.
+
+#include "c0inline1.h"
+#include "c0inline2.h"
+
+int main()
+{
+  return g() + h();
+}
Index: gcc/testsuite/g++.dg/pph/x0template1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0template1.h      (revision 176951)
+++ gcc/testsuite/g++.dg/pph/x0template1.h      (working copy)
@@ -1,20 +1,4 @@
-#ifndef X0TEMPLATE_H
-#define X0TEMPLATE_H
-extern int x;
-struct B;
-template< typename T >
-struct C {
-    T* b;
-    int method();
-    int another()
-    { return *b; }
-};
-template< typename T >
-int C< T >::method()
-{ return x; }
-struct D : C< int > {
-    int method();
-    int another()
-    { return *b; }
-};
+#ifndef X0TEMPLATE1_H
+#define X0TEMPLATE1_H
+#include "a0template.h"
 #endif
Index: gcc/testsuite/g++.dg/pph/c0typedef1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0typedef1.h       (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0typedef1.h       (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0TYPEDEF1_H
+#define C0TYPEDEF1_H
+#include "a0typedef.h"
+inline type func1( type arg ) { return arg; }
+#endif
Index: gcc/testsuite/g++.dg/pph/a0keyno.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0keyno.h  (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0keyno.h  (revision 0)
@@ -0,0 +1,8 @@
+#ifndef A0KEYNO_H
+#define A0KEYNO_H
+struct keyno {
+    int field;
+    virtual int mix( int arg ) { return field ^ arg; }
+    virtual ~keyno() { }
+};
+#endif
Index: gcc/testsuite/g++.dg/pph/a0variables1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/a0variables1.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/a0variables1.h     (revision 0)
@@ -0,0 +1,7 @@
+#ifndef A0VARIABLES1_H
+#define A0VARIABLES1_H
+extern int gbl_init_extern;
+extern int gbl_uninit_extern;
+int gbl_tentative;
+extern const int gbl_extern_const;
+#endif
Index: gcc/testsuite/g++.dg/pph/x0nontrivinit2.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0nontrivinit2.h   (revision 0)
+++ gcc/testsuite/g++.dg/pph/x0nontrivinit2.h   (revision 0)
@@ -0,0 +1,4 @@
+#ifndef X0NONTRIVINIT2_H
+#define X0NONTRIVINIT2_H
+#include "a0nontrivinit.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/c0variables4.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c0variables4.h     (revision 0)
+++ gcc/testsuite/g++.dg/pph/c0variables4.h     (revision 0)
@@ -0,0 +1,5 @@
+#ifndef C0VARIABLES4_H
+#define C0VARIABLES4_H
+#include "a0variables1.h"
+#include "a0variables2.h"
+#endif
Index: gcc/testsuite/g++.dg/pph/x5rtti1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x5rtti1.h  (revision 0)
+++ gcc/testsuite/g++.dg/pph/x5rtti1.h  (revision 0)
@@ -0,0 +1,12 @@
+#ifndef X5RTTI1_H
+#define X5RTTI1_H
+
+#include <typeinfo>
+#include "a0rtti.h"
+
+const std::type_info& poly1() { return typeid( polymorphic ); }
+const std::type_info& nonp1() { return typeid( non_polymorphic ); }
+const std::type_info& hpol1() { polymorphic var; return var.hidden(); }
+const std::type_info& hnpl1() { non_polymorphic var; return var.hidden(); }
+
+#endif
Index: gcc/testsuite/g++.dg/pph/x0template.h
===================================================================
--- gcc/testsuite/g++.dg/pph/x0template.h       (revision 177422)
+++ gcc/testsuite/g++.dg/pph/x0template.h       (working copy)
@@ -1,20 +0,0 @@
-#ifndef X0TEMPLATE_H
-#define X0TEMPLATE_H
-extern int x;
-struct B;
-template< typename T >
-struct C {
-    T* b;
-    int method();
-    int another()
-    { return *b; }
-};
-template< typename T >
-int C< T >::method()
-{ return x; }
-struct D : C< int > {
-    int method();
-    int another()
-    { return *b; }
-};
-#endif

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

Reply via email to