This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pph] Add testsuite for PTH/PPH


This patch adds dejagnu support for testing -fpth and -fpph.
It currently only really tests -fpth, as -fpph does nothing worth
testing yet.

The test basically compile the same .cc file twice with the -fpth
flag.  The first time the flag is used, causes the compiler to
generate pre-tokenized headers for all the included files.  The
second time, the images found in the directory are used.

The test passes if the assembly output from both compiles are the
same.  This is very similar to how PCH is tested, but at the
moment the compilation model for PPH and PCH is different, so I
couldn't reuse the dg-pch.exp.

We will be changing this soon, however.  The current compilation
model is too complex and incorporates features that are better
left to the build system.  We will be implementing a more
primitive mechanism were each header file is pre-parsed
separately.  Lawrence is working on the details.

The tests are run in a regular 'make check', and they can also be
executed independently with:

$ make check-g++ RUNTESTFLAGS=pph.exp

Currently, we have 8 failures:

                === g++ tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/dnovillo/pph/src/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /home/dnovillo/pph/src/gcc/testsuite/g++.dg/pph/pph.exp ...
FAIL: g++.dg/pph/mean.cc  -fpth -I. (test for excess errors)
WARNING: mean.s doesn't exist
FAIL: g++.dg/pph/mean.cc  -fpth assembly comparison
FAIL: g++.dg/pph/sys-types.cc  -fpth -I. (test for excess errors)
WARNING: sys-types.s doesn't exist
FAIL: g++.dg/pph/sys-types.cc  -fpth assembly comparison
FAIL: g++.dg/pph/system-include.cc  -fpth -I. (test for excess errors)
WARNING: system-include.s doesn't exist
FAIL: g++.dg/pph/system-include.cc  -fpth assembly comparison
FAIL: g++.dg/pph/variables.cc  -fpth -I. (test for excess errors)
FAIL: g++.dg/pph/variables.cc  -fpth -I. (test for excess errors)

                === g++ Summary ===

# of expected passes            103
# of unexpected failures        8


I will see about fixing these failures spearately (or mark them
XFAIL, since they are due to code that we are about to remove).


Diego.

	* lib/dg-pph.exp: New.
	* g++.dg/dg.exp: Execute tests in pph directory.
	* g++.dg/pph: New directory.
	* g++.dg/pph/pph.exp: New.
	* g++.dg/pph/staticmbrvar.cc: New.
	* g++.dg/pph/typerefs.cc: New.
	* g++.dg/pph/tmplclass.cc: New.
	* g++.dg/pph/system-include.cc: New.
	* g++.dg/pph/variables.cc: New.
	* g++.dg/pph/trivial.cc: New.
	* g++.dg/pph/where.cc: New.
	* g++.dg/pph/template.cc: New.
	* g++.dg/pph/cflow.h: New.
	* g++.dg/pph/simple1.h: New.
	* g++.dg/pph/simple2.h: New.
	* g++.dg/pph/chained1.h: New.
	* g++.dg/pph/meth2.cc: New.
	* g++.dg/pph/chained2.h: New.
	* g++.dg/pph/mean.cc: New.
	* g++.dg/pph/special.cc: New.
	* g++.dg/pph/nontrivinit.cc: New.
	* g++.dg/pph/emptyclass.cc: New.
	* g++.dg/pph/simplecall.cc: New.
	* g++.dg/pph/autometh.cc: New.
	* g++.dg/pph/tmplfunc.cc: New.
	* g++.dg/pph/simple.cc: New.
	* g++.dg/pph/builtin1.h: New.
	* g++.dg/pph/builtin2.h: New.
	* g++.dg/pph/invoke.cc: New.
	* g++.dg/pph/chained.cc: New.
	* g++.dg/pph/usearray.cc: New.
	* g++.dg/pph/builtin3.h: New.
	* g++.dg/pph/globalref.cc: New.
	* g++.dg/pph/invoke.h: New.
	* g++.dg/pph/meth.cc: New.
	* g++.dg/pph/usearray.h: New.
	* g++.dg/pph/guarded1.h: New.
	* g++.dg/pph/guarded2.h: New.
	* g++.dg/pph/guarded3.h: New.
	* g++.dg/pph/funcstatic.cc: New.
	* g++.dg/pph/builtin.cc: New.
	* g++.dg/pph/hardlookup.cc: New.
	* g++.dg/pph/functions.cc: New.
	* g++.dg/pph/incmod.cc: New.
	* g++.dg/pph/cflow.cc: New.
	* g++.dg/pph/guarded.cc: New.
	* g++.dg/pph/incmod.h: New.
	* g++.dg/pph/paste.cc: New.
	* g++.dg/pph/incsame.cc: New.
	* g++.dg/pph/sys-types.cc: New.
	* g++.dg/pph/incsame.h: New.
	* g++.dg/pph/field.cc: New.
	* g++.dg/pph/classshort.cc: New.
	* g++.dg/pph/variable.cc: New.
	* g++.dg/pph/tmplsimple.cc: New.
	* g++.dg/pph/inif.h: New.

Index: lib/dg-pph.exp
===================================================================
--- lib/dg-pph.exp	(revision 0)
+++ lib/dg-pph.exp	(revision 0)
@@ -0,0 +1,79 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Contributed by Diego Novillo <dnovillo@google.com>
+
+load_lib copy-file.exp
+
+proc dg-flags-pph { subdir test otherflags options suffix } {
+    global runtests dg-do-what-default
+
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $test] {
+	return
+    }
+    set nshort "$subdir/[file tail $test]"
+    set bname "[file rootname [file tail $nshort]]"
+
+    foreach flags $options {
+	verbose "Testing $nshort, $otherflags $flags" 1
+
+	set dg-do-what-default compile
+
+	set have_errs [llength [grep $test "{\[ \t\]\+dg-error\[ \t\]\+.*\[ \t\]\+}"]]
+	# Compile the file the first time to produce PPH/PTH images.
+	dg-test -keep-output $test "$otherflags $flags -I." ""
+
+	if { !$have_errs } {
+	    if { [ file_on_host exists "$bname.s" ] } {
+		# Rename the .s file into .s-pph to compare it after the
+		# second build.
+		remote_upload host "$bname.s" "$bname.s-pph"
+		remote_download host "$bname.s-pph"
+
+		# Compile a second time to use the generated images.
+		dg-test -keep-output $test "$otherflags $flags -I." ""
+		remote_upload host "$bname.s"
+
+		# Compare the two assembly files.  They should be identical.
+		set tmp [ diff "$bname.s" "$bname.s-pph" ]
+		if { $tmp == 0 } {
+		    verbose -log "assembly file '$bname.s', '$bname.s-pph' comparison error"
+		    fail "$nshort $otherflags $flags assembly comparison"
+		} elseif { $tmp == 1 } {
+		    pass "$nshort $otherflags $flags assembly comparison"
+		} else {
+		    fail "$nshort $otherflags $flags assembly comparison"
+		}
+		file_on_host delete "$bname$suffix"
+		file_on_host delete "$bname.s"
+		file_on_host delete "$bname.s-pph"
+	    } else {
+		verbose -log "assembly file '$bname.s' missing"
+		fail "$nshort $flags assembly comparison"
+	    }
+	}
+
+	# Remove stale .pth files, if any.
+	foreach pth_file [glob -nocomplain *.pth] {
+	    file_on_host delete $pth_file
+	}
+    }
+}
+
+proc dg-pph { subdir test options suffix } {
+  return [dg-flags-pph $subdir $test "" $options $suffix]
+}
Index: g++.dg/dg.exp
===================================================================
--- g++.dg/dg.exp	(revision 168519)
+++ g++.dg/dg.exp	(working copy)
@@ -39,6 +39,7 @@ set tests [prune $tests $srcdir/$subdir/
 set tests [prune $tests $srcdir/$subdir/gcov/*]
 set tests [prune $tests $srcdir/$subdir/lto/*]
 set tests [prune $tests $srcdir/$subdir/pch/*]
+set tests [prune $tests $srcdir/$subdir/pph/*]
 set tests [prune $tests $srcdir/$subdir/plugin/*]
 set tests [prune $tests $srcdir/$subdir/special/*]
 set tests [prune $tests $srcdir/$subdir/tls/*]
Index: g++.dg/pph/pph.exp
===================================================================
--- g++.dg/pph/pph.exp	(revision 0)
+++ g++.dg/pph/pph.exp	(revision 0)
@@ -0,0 +1,38 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite for preparsed header interaction.
+
+# Contributed by Diego Novillo <dnovillo@google.com>
+
+# Load support procs.
+load_lib "g++-dg.exp"
+load_lib dg-pph.exp
+
+# Initialize `dg'.
+dg-init
+
+set old_dg_do_what_default "${dg-do-what-default}"
+
+# Main loop.
+foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] {
+    dg-pph $subdir $test [list "-fpth" ] ".pth"
+}
+
+set dg-do-what-default "$old_dg_do_what_default"
+
+# All done.
+dg-finish
Index: g++.dg/pph/empty.cc
===================================================================
Index: g++.dg/pph/staticmbrvar.cc
===================================================================
--- g++.dg/pph/staticmbrvar.cc	(revision 0)
+++ g++.dg/pph/staticmbrvar.cc	(revision 0)
@@ -0,0 +1,5 @@
+struct D {
+    int method() { return mbr; }
+    static int mbr;
+};
+int D::mbr = 4;
Index: g++.dg/pph/typerefs.cc
===================================================================
--- g++.dg/pph/typerefs.cc	(revision 0)
+++ g++.dg/pph/typerefs.cc	(revision 0)
@@ -0,0 +1,18 @@
+struct base {
+    int field;
+};
+base function();
+int base_from_var() {
+    base variable;
+}
+int base_from_func() {
+    function();
+}
+struct derived : base {
+    int method();
+};
+int derived::method() {
+    return field;
+}
+struct vderived : virtual base {
+};
Index: g++.dg/pph/tmplclass.cc
===================================================================
--- g++.dg/pph/tmplclass.cc	(revision 0)
+++ g++.dg/pph/tmplclass.cc	(revision 0)
@@ -0,0 +1,29 @@
+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;
+};
+
+int wrapper<char>::cache = 2;
+
+template
+struct wrapper<short>;
+
+template
+long wrapper<long>::cache;
+
+int main() {
+  wrapper<char> vc;
+  wrapper<short> vs;
+  wrapper<int> vi;
+  return 0;
+}
Index: g++.dg/pph/system-include.cc
===================================================================
--- g++.dg/pph/system-include.cc	(revision 0)
+++ g++.dg/pph/system-include.cc	(revision 0)
@@ -0,0 +1,2 @@
+#include <stdlib.h>
+size_t X;
Index: g++.dg/pph/variables.cc
===================================================================
--- g++.dg/pph/variables.cc	(revision 0)
+++ g++.dg/pph/variables.cc	(revision 0)
@@ -0,0 +1,17 @@
+extern int gbl_init_extern = 3;		// need body			pass
+extern int gbl_uninit_extern;		// head only			pass
+int gbl_tentative;			// need body			pass
+int gbl_initial = 1;			// need body			pass
+extern const int gbl_extern_const;	// head only			pass
+const float gbl_init_const = 1.5;	// need body			pass
+const int gbl_manifest = 2;		// lazy body	merge head	pass
+struct D {
+    static int mbr_init_plain;		// head only			pass
+    static int mbr_uninit_plain;	// head only			pass
+    static const int mbr_init_const;	// head only			pass
+    static const int mbr_uninit_const;	// head only			pass
+    static const int mbr_manifest = 3;	// lazy body	merge head	okay
+};
+int D::mbr_init_plain = 4;		// need body	merge body	pass
+int D::mbr_uninit_plain;		// need body	merge body	FAIL
+const int D::mbr_init_const = 5;	// need body	merge body	FAIL
Index: g++.dg/pph/trivial.cc
===================================================================
--- g++.dg/pph/trivial.cc	(revision 0)
+++ g++.dg/pph/trivial.cc	(revision 0)
@@ -0,0 +1,3 @@
+int main()
+{
+}
Index: g++.dg/pph/where.cc
===================================================================
--- g++.dg/pph/where.cc	(revision 0)
+++ g++.dg/pph/where.cc	(revision 0)
@@ -0,0 +1,21 @@
+namespace A {
+int x = 3;
+struct B;
+struct C {
+    B* b;
+    int method();
+    int another()
+    { return 1; }
+};
+int C::method()
+{ return 1; }
+} // namespace A
+struct D : A::C {
+    int method();
+    int another()
+    { return 1; }
+};
+int D::method()
+{ return 1; }
+int main()
+{ }
Index: g++.dg/pph/template.cc
===================================================================
--- g++.dg/pph/template.cc	(revision 0)
+++ g++.dg/pph/template.cc	(revision 0)
@@ -0,0 +1,24 @@
+namespace A {
+int x = 3;
+struct B;
+template< typename T >
+struct C {
+    T* b;
+    int method();
+    int another()
+    { return *b; }
+};
+template< typename T >
+int C< T >::method()
+{ return x; }
+} // namespace A
+int y = 4;
+struct D : A::C< int > {
+    int method();
+    int another()
+    { return *b; }
+};
+int D::method()
+{ return y; }
+int main()
+{ }
Index: g++.dg/pph/cflow.h
===================================================================
--- g++.dg/pph/cflow.h	(revision 0)
+++ g++.dg/pph/cflow.h	(revision 0)
@@ -0,0 +1,13 @@
+#ifndef __CFLOW_H
+#define __CFLOW_H
+
+extern void foo (void);
+
+#define X	1
+#if defined X
+#include "inif.h"
+extern int var1;
+extern int var2;
+#endif
+#include "inif.h"
+#endif
Index: g++.dg/pph/simple1.h
===================================================================
--- g++.dg/pph/simple1.h	(revision 0)
+++ g++.dg/pph/simple1.h	(revision 0)
@@ -0,0 +1,11 @@
+#ifndef SIMPLE1_H
+#define SIMPLE1_H
+
+#include "simple2.h"
+
+inline int foo()
+{
+  assert(1);
+}
+
+#endif
Index: g++.dg/pph/simple2.h
===================================================================
--- g++.dg/pph/simple2.h	(revision 0)
+++ g++.dg/pph/simple2.h	(revision 0)
@@ -0,0 +1,7 @@
+#ifndef SIMPLE2_H
+#define SIMPLE2_H
+
+#define assert(x) yellow(x)
+extern void yellow(int);
+
+#endif
Index: g++.dg/pph/chained1.h
===================================================================
--- g++.dg/pph/chained1.h	(revision 0)
+++ g++.dg/pph/chained1.h	(revision 0)
@@ -0,0 +1 @@
+#define ONE 1
Index: g++.dg/pph/meth2.cc
===================================================================
--- g++.dg/pph/meth2.cc	(revision 0)
+++ g++.dg/pph/meth2.cc	(revision 0)
@@ -0,0 +1,6 @@
+class one {
+};
+typedef one type;
+class two {
+    type fld;
+};
Index: g++.dg/pph/chained2.h
===================================================================
--- g++.dg/pph/chained2.h	(revision 0)
+++ g++.dg/pph/chained2.h	(revision 0)
@@ -0,0 +1 @@
+#define TWO ONE
Index: g++.dg/pph/mean.cc
===================================================================
--- g++.dg/pph/mean.cc	(revision 0)
+++ g++.dg/pph/mean.cc	(revision 0)
@@ -0,0 +1,162 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+static unsigned long long MAX_ITEMS = 10000;
+
+static int
+cmpdouble (const void *p1, const void *p2)
+{
+  double n1 = *((double *)p1);
+  double n2 = *((double *)p2);
+
+  if (n1 < n2)
+    return -1;
+  else if (n1 > n2)
+    return 1;
+  else
+    return 0;
+}
+
+
+double
+compute_median (int n, double vec[])
+{
+  qsort (vec, n, sizeof (double), cmpdouble);
+  
+  if (n % 2 == 0)
+    return ((vec[n / 2] + vec[n / 2 - 1]) / 2.0);
+  else
+    return vec[n / 2];
+}
+
+double
+compute_stddev (int n, double avg, double vec[])
+{
+  double sd, sum, s, x;
+  int i;
+
+  for (x = 0.0, sum = 0.0, i = 0; i < n; i++)
+    {
+      double d;
+
+      x = x + vec[i];
+      d = vec[i] - avg;
+      sum += d * d;
+    }
+
+  s = sum / n;
+  sd = sqrt (s);
+
+  return sd;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+  double *vec;
+  double x, sum, product, inverse_sum, arithmetic, geometric, harmonic;
+  double min, max, median, variance, stddev;
+  int count;
+  int ret;
+
+  sum = 0.0;
+  product = 1.0;
+  inverse_sum = 0.0;
+  count = 0;
+  min = 0.0;
+  max = 0.0;
+
+  vec = (double *) malloc (MAX_ITEMS * sizeof (double));
+
+  while (1)
+    {
+      ret = scanf ("%lg", &x);
+      if (ret == EOF)
+	break;
+
+      if (count == 0)
+	min = max = x;
+
+      if (x < min)
+	min = x;
+
+      if (x > max)
+	max = x;
+
+      sum += x;
+      product *= x;
+      inverse_sum += 1.0 / x;
+      vec[count] = x;
+
+      count++;
+      if (count >= MAX_ITEMS)
+	{
+	  MAX_ITEMS *= 3;
+	  vec = (double *) realloc (vec, MAX_ITEMS * sizeof (double));
+	}
+    }
+
+  int do_min = (strstr (argv[0], "min") != NULL);
+  int do_max = (strstr (argv[0], "max") != NULL);
+  int do_avg = (strstr (argv[0], "avg") != NULL);
+  int do_geo = (strstr (argv[0], "geoavg") != NULL);
+  int do_harmonic = (strstr (argv[0], "harmonic") != NULL);
+  int do_median = (strstr (argv[0], "median") != NULL);
+  int do_variance = (strstr (argv[0], "variance") != NULL);
+  int do_stdev = (strstr (argv[0], "stdev") != NULL);
+  int do_all = (argc > 1 && strcmp (argv[1], "-a") == 0);
+
+  if (count > 0)
+    {
+      arithmetic = sum / count;
+      geometric = pow (product, (double) 1.0 / (double) count);
+      harmonic = count / inverse_sum;
+      median = compute_median (count, vec);
+      stddev = compute_stddev (count, arithmetic, vec);
+      variance = stddev * stddev;
+
+      if (do_all)
+	{
+	  printf ("# of items read --> %d\n", count);
+	  printf ("Min --------------> %lg\n", min);
+	  printf ("Max --------------> %lg\n", max);
+	  printf ("Arithmetic mean --> %lg\n", arithmetic);
+	  printf ("Geometric mean ---> %lg\n", geometric);
+	  printf ("Harmonic mean ----> %lg\n", harmonic);
+	  printf ("Median -----------> %lg\n", median);
+	  printf ("Variance ---------> %lg\n", variance);
+	  printf ("Standard dev -----> %lg\n", stddev);
+	}
+      else if (do_min)
+	printf ("%lg\n", min);
+      else if (do_max)
+	printf ("%lg\n", max);
+      else if (do_avg)
+	printf ("%lg\n", arithmetic);
+      else if (do_geo)
+	printf ("%lg\n", geometric);
+      else if (do_harmonic)
+	printf ("%lg\n", harmonic);
+      else if (do_median)
+	printf ("%lg\n", median);
+      else if (do_variance)
+	printf ("%lg\n", variance);
+      else if (do_stdev)
+	printf ("%lg\n", stddev);
+      else
+	{
+	  fprintf (stderr, "ERROR: Unknown value '%s' to compute\n", argv[0]);
+	  return 1;
+	}
+    }
+  else
+    {
+      fprintf (stderr, "ERROR: none of the input is positive\n");
+      return 1;
+    }
+
+  return 0;
+}
Index: g++.dg/pph/special.cc
===================================================================
--- g++.dg/pph/special.cc	(revision 0)
+++ g++.dg/pph/special.cc	(revision 0)
@@ -0,0 +1,30 @@
+struct B {
+    B( int );
+    B( double );
+    B( const B& );
+    B& operator=( const B& );
+    B& operator=( int );
+    operator double();
+    ~B();
+};
+
+struct D {
+    D( const B& );
+};
+
+int F( D );
+int G( double );
+
+B b(1);
+//B q("hhh");
+
+int H() {
+    F(b);
+    B a(3.2);
+    B c = b;
+    B d(b);
+    c = b;
+    d = 4;
+    //G(double(""));
+    G(d);
+}
Index: g++.dg/pph/nontrivinit.cc
===================================================================
--- g++.dg/pph/nontrivinit.cc	(revision 0)
+++ g++.dg/pph/nontrivinit.cc	(revision 0)
@@ -0,0 +1,2 @@
+int y = 0;
+int x = y+1;
Index: g++.dg/pph/emptyclass.cc
===================================================================
--- g++.dg/pph/emptyclass.cc	(revision 0)
+++ g++.dg/pph/emptyclass.cc	(revision 0)
@@ -0,0 +1,2 @@
+struct B {
+};
Index: g++.dg/pph/simplecall.cc
===================================================================
--- g++.dg/pph/simplecall.cc	(revision 0)
+++ g++.dg/pph/simplecall.cc	(revision 0)
@@ -0,0 +1,10 @@
+int H( int a, int b) {
+}
+
+int I( int a, int b) {
+    return a+b;
+}
+
+int F( int c, int d) {
+    return H(c, d) + I(c, d);
+}
Index: g++.dg/pph/autometh.cc
===================================================================
--- g++.dg/pph/autometh.cc	(revision 0)
+++ g++.dg/pph/autometh.cc	(revision 0)
@@ -0,0 +1,11 @@
+class base {
+    virtual int method() {
+        return 0;
+    }
+    int field;
+};
+void function() {
+    base var1;
+    base var2( var1 );
+    var1 = var2;
+}
Index: g++.dg/pph/tmplfunc.cc
===================================================================
--- g++.dg/pph/tmplfunc.cc	(revision 0)
+++ g++.dg/pph/tmplfunc.cc	(revision 0)
@@ -0,0 +1,17 @@
+typedef int type;
+type val = 3;
+
+template< typename T >
+T identity(T arg)
+{ return arg + val; }
+
+template<>
+int identity< type >(type arg)
+{ return arg + val; }
+
+template
+short identity(short arg);
+
+int main() {
+  return identity( 'a' );
+}
Index: g++.dg/pph/simple.cc
===================================================================
--- g++.dg/pph/simple.cc	(revision 0)
+++ g++.dg/pph/simple.cc	(revision 0)
@@ -0,0 +1,7 @@
+/* comment */
+#include "simple1.h"
+
+int main()
+{
+	return foo();
+}
Index: g++.dg/pph/builtin1.h
===================================================================
--- g++.dg/pph/builtin1.h	(revision 0)
+++ g++.dg/pph/builtin1.h	(revision 0)
@@ -0,0 +1,2 @@
+#define QUOTE(arg) #arg
+#define VALUE(arg) QUOTE(arg)
Index: g++.dg/pph/builtin2.h
===================================================================
--- g++.dg/pph/builtin2.h	(revision 0)
+++ g++.dg/pph/builtin2.h	(revision 0)
@@ -0,0 +1,7 @@
+const char *date = VALUE(__DATE__);
+const char *time = VALUE(__TIME__);
+const char *file = VALUE(__FILE__);
+const char *line = VALUE(__LINE__);
+const char *vers = VALUE(__cplusplus);
+const char *optm = VALUE(__OPTIMIZE__);
+const char *func() { return __func__; }
Index: g++.dg/pph/invoke.cc
===================================================================
--- g++.dg/pph/invoke.cc	(revision 0)
+++ g++.dg/pph/invoke.cc	(revision 0)
@@ -0,0 +1,6 @@
+#include "invoke.h"
+#define outer(major, minor) inner(major, minor)
+
+void outer(long one, short two) { }
+major(three);
+minor(four);
Index: g++.dg/pph/chained.cc
===================================================================
--- g++.dg/pph/chained.cc	(revision 0)
+++ g++.dg/pph/chained.cc	(revision 0)
@@ -0,0 +1,3 @@
+#include "chained1.h"
+#include "chained2.h"
+int x = TWO;
Index: g++.dg/pph/usearray.cc
===================================================================
--- g++.dg/pph/usearray.cc	(revision 0)
+++ g++.dg/pph/usearray.cc	(revision 0)
@@ -0,0 +1,8 @@
+#include "usearray.h"
+const int x = 3;
+const int y = 10;
+float array[x + y];
+float foo (int i)
+{
+  return array[i * 3];
+}
Index: g++.dg/pph/builtin3.h
===================================================================
--- g++.dg/pph/builtin3.h	(revision 0)
+++ g++.dg/pph/builtin3.h	(revision 0)
@@ -0,0 +1,2 @@
+const char *refile = VALUE(__FILE__);
+const char *reline = VALUE(__LINE__);
Index: g++.dg/pph/globalref.cc
===================================================================
--- g++.dg/pph/globalref.cc	(revision 0)
+++ g++.dg/pph/globalref.cc	(revision 0)
@@ -0,0 +1,7 @@
+typedef int type;
+type x = 2;
+type y = x;
+type f() { return x; }
+const type n = 3;
+const type m = 4;
+type a[n+m];
Index: g++.dg/pph/invoke.h
===================================================================
--- g++.dg/pph/invoke.h	(revision 0)
+++ g++.dg/pph/invoke.h	(revision 0)
@@ -0,0 +1,4 @@
+# define gnu_dev_major(dev) long dev
+# define gnu_dev_minor(dev) short dev
+# define major(dev) gnu_dev_major (dev)
+# define minor(dev) gnu_dev_minor (dev)
Index: g++.dg/pph/meth.cc
===================================================================
--- g++.dg/pph/meth.cc	(revision 0)
+++ g++.dg/pph/meth.cc	(revision 0)
@@ -0,0 +1,4 @@
+typedef int type;
+class base {
+    type fld;
+};
Index: g++.dg/pph/usearray.h
===================================================================
--- g++.dg/pph/usearray.h	(revision 0)
+++ g++.dg/pph/usearray.h	(revision 0)
@@ -0,0 +1 @@
+float foo(int);
Index: g++.dg/pph/guarded1.h
===================================================================
--- g++.dg/pph/guarded1.h	(revision 0)
+++ g++.dg/pph/guarded1.h	(revision 0)
@@ -0,0 +1,6 @@
+#ifndef GUARDED1_H
+#define GUARDED1_H
+
+typedef int type;
+
+#endif
Index: g++.dg/pph/guarded2.h
===================================================================
--- g++.dg/pph/guarded2.h	(revision 0)
+++ g++.dg/pph/guarded2.h	(revision 0)
@@ -0,0 +1,8 @@
+#ifndef GUARDED2_H
+#define GUARDED2_H
+
+#include "guarded1.h"
+
+type variable2;
+
+#endif
Index: g++.dg/pph/guarded3.h
===================================================================
--- g++.dg/pph/guarded3.h	(revision 0)
+++ g++.dg/pph/guarded3.h	(revision 0)
@@ -0,0 +1,8 @@
+#ifndef GUARDED3_H
+#define GUARDED3_H
+
+#include "guarded1.h"
+
+type variable3;
+
+#endif
Index: g++.dg/pph/funcstatic.cc
===================================================================
--- g++.dg/pph/funcstatic.cc	(revision 0)
+++ g++.dg/pph/funcstatic.cc	(revision 0)
@@ -0,0 +1,3 @@
+int f() {
+    static int x = 3;
+}
Index: g++.dg/pph/builtin.cc
===================================================================
--- g++.dg/pph/builtin.cc	(revision 0)
+++ g++.dg/pph/builtin.cc	(revision 0)
@@ -0,0 +1,3 @@
+#include "builtin1.h"
+#include "builtin2.h"
+#include "builtin3.h"
Index: g++.dg/pph/hardlookup.cc
===================================================================
--- g++.dg/pph/hardlookup.cc	(revision 0)
+++ g++.dg/pph/hardlookup.cc	(revision 0)
@@ -0,0 +1,29 @@
+struct V { int a; static int b;};
+namespace N {
+   int V;
+   struct C { };
+   int operator + (int i, C c);
+   C O;
+   int I(int arg)
+   { return arg + V; }
+   struct V w;
+   int x = V::b;
+}
+
+int V;
+struct D { };
+D P;
+int operator + (int i, D d);
+int I(int arg)
+{ return arg + V; }
+
+int F() {
+   return I(N::V + N::O);
+}
+
+int G() {
+   return I(::V + P);
+}
+
+struct V w;
+int x = V::b;
Index: g++.dg/pph/functions.cc
===================================================================
--- g++.dg/pph/functions.cc	(revision 0)
+++ g++.dg/pph/functions.cc	(revision 0)
@@ -0,0 +1,22 @@
+extern int extern_only(int);		//
+extern int extern_then_body(int);	//
+inline int extern_inline(int i)		// lazy body
+{ return extern_then_body(i); }
+int extern_then_body(int i)		// need body, merge head to body
+{ return extern_only( i ); }
+static int fwdref_static(int);
+int fwdref_static(int i)
+{ return extern_then_body( i ); }	// need body, merge head to body
+struct type {
+    int mbr_decl_only(int);
+    int mbr_decl_then_def(int);
+    inline int mbr_inl_then_def(int);
+    int mbr_decl_inline(int i)		// lazy body
+    { return mbr_decl_only( i ); }
+    virtual int mbr_virtual_inline()	// lazy body, but circular dependence
+    { return mbr_decl_only( 1 ); }
+};
+int type::mbr_decl_then_def(int i)	// need body
+{ return mbr_decl_inline( i ); }
+int type::mbr_inl_then_def(int i)	// lazy body
+{ return mbr_decl_then_def( i ); }
Index: g++.dg/pph/incmod.cc
===================================================================
--- g++.dg/pph/incmod.cc	(revision 0)
+++ g++.dg/pph/incmod.cc	(revision 0)
@@ -0,0 +1,9 @@
+struct T { int f; };
+#define NAME v
+#define VALUE 1
+#include "incmod.h"
+#undef NAME
+#define NAME w
+#undef VALUE
+#define VALUE 2
+#include "incmod.h"
Index: g++.dg/pph/cflow.cc
===================================================================
--- g++.dg/pph/cflow.cc	(revision 0)
+++ g++.dg/pph/cflow.cc	(revision 0)
@@ -0,0 +1,6 @@
+#include "cflow.h"
+
+void foo (void)
+{
+  int x = var1 + var2 - (int) f1;
+}
Index: g++.dg/pph/guarded.cc
===================================================================
--- g++.dg/pph/guarded.cc	(revision 0)
+++ g++.dg/pph/guarded.cc	(revision 0)
@@ -0,0 +1,2 @@
+#include "guarded2.h"
+#include "guarded3.h"
Index: g++.dg/pph/incmod.h
===================================================================
--- g++.dg/pph/incmod.h	(revision 0)
+++ g++.dg/pph/incmod.h	(revision 0)
@@ -0,0 +1 @@
+struct T NAME = { VALUE };
Index: g++.dg/pph/paste.cc
===================================================================
--- g++.dg/pph/paste.cc	(revision 0)
+++ g++.dg/pph/paste.cc	(revision 0)
@@ -0,0 +1,10 @@
+#define major	"beef"
+#define M(major)	foo##_##major##_(major)
+
+void foo_30_(int);
+void bar(void);
+
+void bar(void)
+{
+  M(30);
+}
Index: g++.dg/pph/incsame.cc
===================================================================
--- g++.dg/pph/incsame.cc	(revision 0)
+++ g++.dg/pph/incsame.cc	(revision 0)
@@ -0,0 +1,5 @@
+struct T { int f; };
+struct T v
+#include "incsame.h"
+struct T w
+#include "incsame.h"
Index: g++.dg/pph/sys-types.cc
===================================================================
--- g++.dg/pph/sys-types.cc	(revision 0)
+++ g++.dg/pph/sys-types.cc	(revision 0)
@@ -0,0 +1 @@
+#include <sys/types.h>
Index: g++.dg/pph/incsame.h
===================================================================
--- g++.dg/pph/incsame.h	(revision 0)
+++ g++.dg/pph/incsame.h	(revision 0)
@@ -0,0 +1 @@
+= { 1 };
Index: g++.dg/pph/field.cc
===================================================================
--- g++.dg/pph/field.cc	(revision 0)
+++ g++.dg/pph/field.cc	(revision 0)
@@ -0,0 +1,7 @@
+typedef int language;
+struct program {
+    language field;
+};
+struct client {
+    program field;
+};
Index: g++.dg/pph/classshort.cc
===================================================================
--- g++.dg/pph/classshort.cc	(revision 0)
+++ g++.dg/pph/classshort.cc	(revision 0)
@@ -0,0 +1,19 @@
+typedef int type;
+type gbl = 1;
+struct B {
+    type fld;
+};
+struct D : B {
+    type method();
+    type another()
+    { return fld + mbr + gbl; }
+    type fld;
+    static type mbr;
+};
+type D::method()
+{ static int x = 2;
+  return fld + mbr + gbl; }
+type D::mbr = 4;
+typedef D D2;
+D2 var1;
+D2 var2 = var1;
Index: g++.dg/pph/variable.cc
===================================================================
--- g++.dg/pph/variable.cc	(revision 0)
+++ g++.dg/pph/variable.cc	(revision 0)
@@ -0,0 +1,2 @@
+int one;
+int two;
Index: g++.dg/pph/tmplsimple.cc
===================================================================
--- g++.dg/pph/tmplsimple.cc	(revision 0)
+++ g++.dg/pph/tmplsimple.cc	(revision 0)
@@ -0,0 +1,11 @@
+template< typename T >
+struct C {
+    int* b;
+    int method();
+    int another()
+    { return 1; }
+};
+template< typename T >
+int C< T >::method()
+{ return 1; }
+C<int> v;
Index: g++.dg/pph/inif.h
===================================================================
--- g++.dg/pph/inif.h	(revision 0)
+++ g++.dg/pph/inif.h	(revision 0)
@@ -0,0 +1 @@
+extern float f1;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]