From patchwork Thu Aug 11 02:00:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lawrence Crowl X-Patchwork-Id: 109485 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 49EB7B6EE8 for ; Thu, 11 Aug 2011 12:01:17 +1000 (EST) Received: (qmail 7089 invoked by alias); 11 Aug 2011 02:01:13 -0000 Received: (qmail 7074 invoked by uid 22791); 11 Aug 2011 02:01:09 -0000 X-SWARE-Spam-Status: No, hits=-2.2 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; Thu, 11 Aug 2011 02:00:49 +0000 Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id p7B20mgP005661; Wed, 10 Aug 2011 19:00:48 -0700 Received: from jade.mtv.corp.google.com (jade.mtv.corp.google.com [172.18.110.116]) by wpaz37.hot.corp.google.com with ESMTP id p7B20lXv021593; Wed, 10 Aug 2011 19:00:47 -0700 Received: by jade.mtv.corp.google.com (Postfix, from userid 21482) id 14462222687; Wed, 10 Aug 2011 19:00:46 -0700 (PDT) To: reply@codereview.appspotmail.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Template test upgrade. (issue4864041) Message-Id: <20110811020047.14462222687@jade.mtv.corp.google.com> Date: Wed, 10 Aug 2011 19:00:46 -0700 (PDT) From: crowl@google.com (Lawrence Crowl) 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 This patch adds new well-factored PPH template tests. In the process, some old template tests get removed. Enable the e and z tests for PPH files with unsharable headers. Add xdiff markers where appropriate. Compile tests with -fno-dwarf2-cfi-asm to reduce environmental differences. Tests run on x64. --- This patch is available for review at http://codereview.appspot.com/4864041 Index: gcc/testsuite/ChangeLog.pph 2011-08-10 Lawrence Crowl * lib/dg-pph.exp: Compile with -fno-dwarf2-cfi-asm to reduce environmental differences. * g++.dg/pph/z0expinstnin1.h: Remove in favor of new tests. * g++.dg/pph/x0tmplfuncninl3.h: New. * g++.dg/pph/x0tmplclass12.h: New. * g++.dg/pph/a0tmplfuncninl_u.h: New. * g++.dg/pph/x4tmplfuncninl.cc: New. * g++.dg/pph/z4tmplfuncninl.cc: New. * g++.dg/pph/x0tmplclass2.h: Remove in favor of new tests. * g++.dg/pph/x1tmplfunc.cc: Remove in favor of new tests. * g++.dg/pph/x0tmplfunc.h: Remove in favor of new tests. * g++.dg/pph/x0tmplfuncinln3.h: New. * g++.dg/pph/x0template2.h: Remove in favor of new tests. * g++.dg/pph/z4expinstinl.cc: Remove in favor of new tests. * g++.dg/pph/x0tmplclass21.h: New. * g++.dg/pph/a0tmplfuncinln_u.h: New. * g++.dg/pph/x4tmplfuncinln.cc: New. * g++.dg/pph/z4tmplfuncinln.cc: New. * g++.dg/pph/z0expinstnin2.h: Remove in favor of new tests. * g++.dg/pph/a0template.h: Remove in favor of new tests. * g++.dg/pph/pph.exp: Enable e and z tests. * g++.dg/pph/z4tmplclass2.cc: New. * g++.dg/pph/x0tmplfuncninl4.h: New. * g++.dg/pph/a0tmplclass2_g.h: New. * g++.dg/pph/x0tmplclass13.h: New. * g++.dg/pph/x1template.cc: Remove in favor of new tests. * g++.dg/pph/a0tmplclass2_s.h: New. * g++.dg/pph/a0tmplclass1_u.h: New. * g++.dg/pph/x4tmplclass1.cc: New. * g++.dg/pph/x0tmplfuncinln4.h: New. * g++.dg/pph/x1tmplclass.cc: Remove in favor of new tests. * g++.dg/pph/a0expinstinl.h: Remove in favor of new tests. * g++.dg/pph/x0tmplclass22.h: New. * g++.dg/pph/x1tmplfuncninl.cc: New. * g++.dg/pph/a0tmplclass.h: Remove in favor of new tests. * g++.dg/pph/x4template.cc: Remove in favor of new tests. * g++.dg/pph/x1tmplclass1.cc: New. * g++.dg/pph/z4nontrivinit.cc: Add xdiff. * g++.dg/pph/e4variables.cc: Add xdiff. * g++.dg/pph/a0tmplfuncninl_g.h: New. * g++.dg/pph/x0tmplfuncninl1.h: New. * g++.dg/pph/z4expinstnin.cc: Remove in favor of new tests. * g++.dg/pph/a0tmplfuncninl_s.h: New. * g++.dg/pph/x0tmplclass14.h: New. * g++.dg/pph/a0expinstnin.h: Remove in favor of new tests. * g++.dg/pph/x1tmplfuncinln.cc: New. * g++.dg/pph/z0expinstinl1.h: Remove in favor of new tests. * g++.dg/pph/a0tmplfuncinln_g.h: New. * g++.dg/pph/x0tmplfuncinln1.h: New. * g++.dg/pph/a0tmplfuncinln_s.h: New. * g++.dg/pph/x0tmplclass23.h: New. * g++.dg/pph/x4tmplclass2.cc: New. * g++.dg/pph/x0tmplfuncninl2.h: New. * g++.dg/pph/a0tmplclass1_g.h: New. * g++.dg/pph/x0tmplclass11.h: New. * g++.dg/pph/e4noninline.cc: Remove xdiff. * g++.dg/pph/a0tmplclass1_s.h: New. * g++.dg/pph/z0expinstinl2.h: Remove in favor of new tests. * g++.dg/pph/a0tmplclass2_u.h: New. * g++.dg/pph/x0tmplclass1.h: Remove in favor of new tests. * g++.dg/pph/x1tmplclass2.cc: New. * g++.dg/pph/z4tmplclass1.cc: New. * g++.dg/pph/x0tmplfuncinln2.h: New. * g++.dg/pph/x0template1.h: Remove in favor of new tests. * g++.dg/pph/x0tmplclass24.h: New. Index: gcc/testsuite/lib/dg-pph.exp =================================================================== --- gcc/testsuite/lib/dg-pph.exp (revision 177632) +++ gcc/testsuite/lib/dg-pph.exp (working copy) @@ -54,7 +54,7 @@ proc dg-pph-neg { subdir test options ma verbose -log "\nTesting $nshort, $options" set dg-do-what-default compile - dg-test -keep-output $test "$options $mapflag -I." "" + dg-test -keep-output $test "-fno-dwarf2-cfi-asm $options $mapflag -I." "" if { [file_on_host exists "$bname.s"] } { file_on_host delete "$bname.s" @@ -76,7 +76,7 @@ proc dg-pph-pos { subdir test options ma # Compile the file the first time for a base case. set dg-do-what-default compile - dg-test -keep-output $test "$options -I." "" + dg-test -keep-output $test "-fno-dwarf2-cfi-asm $options -I." "" # Determine whether this is an assembly comparison test set is_exec [llength [grep $test "dg-do run"]] @@ -102,7 +102,7 @@ proc dg-pph-pos { subdir test options ma verbose -log "" # Compile a second time using the pph files. - dg-test -keep-output $test "$options $mapflag -I." "" + dg-test -keep-output $test "-fno-dwarf2-cfi-asm $options $mapflag -I." "" if { !$is_asm } { # No assembly means we cannot compare them, Index: gcc/testsuite/g++.dg/pph/z0expinstnin1.h =================================================================== --- gcc/testsuite/g++.dg/pph/z0expinstnin1.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/z0expinstnin1.h (working copy) @@ -1,6 +0,0 @@ -#ifndef X0EXPINSTNIN1_H -#define X0EXPINSTNIN1_H - -#include "a0expinstnin.h" - -#endif Index: gcc/testsuite/g++.dg/pph/x0tmplfuncninl3.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncninl3.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncninl3.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLFUNCNINL3_H +#define X0TMPLFUNCNINL3_H + +#include "a0tmplfuncninl_g.h" +#include "a0tmplfuncninl_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass12.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass12.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass12.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLCLASS12_H +#define X0TMPLCLASS12_H + +#include "a0tmplclass1_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplfuncninl_u.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncninl_u.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncninl_u.h (revision 0) @@ -0,0 +1,9 @@ +#ifndef A0TMPLFUNCNINL_U_H +#define A0TMPLFUNCNINL_U_H + +double tmplfuncninl_user() +{ + return function2('a') + function2(4) + function2(5.6); +} + +#endif Index: gcc/testsuite/g++.dg/pph/x4tmplfuncninl.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x4tmplfuncninl.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4tmplfuncninl.cc (revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 37887 +#include "x0tmplfuncninl1.h" +#include "x0tmplfuncninl2.h" +#include "a0tmplfuncninl_u.h" Index: gcc/testsuite/g++.dg/pph/z4tmplfuncninl.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4tmplfuncninl.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/z4tmplfuncninl.cc (revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 05125 +#include "x0tmplfuncninl3.h" +#include "x0tmplfuncninl4.h" +#include "a0tmplfuncninl_u.h" Index: gcc/testsuite/g++.dg/pph/x0tmplclass2.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass2.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/x0tmplclass2.h (working copy) @@ -1,4 +0,0 @@ -#ifndef X0TMPLCLASS2_H -#define X0TMPLCLASS2_H -#include "a0tmplclass.h" -#endif Index: gcc/testsuite/g++.dg/pph/x1tmplfunc.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplfunc.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/x1tmplfunc.cc (working copy) @@ -1,14 +0,0 @@ -#include "x0tmplfunc.h" - -type val = 3; - -template<> -int identity< type >(type arg) -{ return arg + val; } - -template -short identity(short arg); - -int main() { - return identity( 'a' ); -} Index: gcc/testsuite/g++.dg/pph/x0tmplfunc.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfunc.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/x0tmplfunc.h (working copy) @@ -1,9 +0,0 @@ -#ifndef X0TMPLFUNC_H -#define X0TMPLFUNC_H -typedef int type; -extern type val; - -template< typename T > -T identity(T arg) -{ return arg + val; } -#endif Index: gcc/testsuite/g++.dg/pph/x0tmplfuncinln3.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncinln3.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncinln3.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLFUNCINLN3_H +#define X0TMPLFUNCINLN3_H + +#include "a0tmplfuncinln_g.h" +#include "a0tmplfuncinln_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x0template2.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0template2.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/x0template2.h (working copy) @@ -1,4 +0,0 @@ -#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 177632) +++ gcc/testsuite/g++.dg/pph/z4expinstinl.cc (working copy) @@ -1,12 +0,0 @@ -// 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/x0tmplclass21.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass21.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass21.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLCLASS21_H +#define X0TMPLCLASS21_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass2_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplfuncinln_u.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncinln_u.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncinln_u.h (revision 0) @@ -0,0 +1,9 @@ +#ifndef A0TMPLFUNCINLN_U_H +#define A0TMPLFUNCINLN_U_H + +double tmplfuncinln_user() +{ + return function1('a') + function1(4) + function1(5.6); +} + +#endif Index: gcc/testsuite/g++.dg/pph/x4tmplfuncinln.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x4tmplfuncinln.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4tmplfuncinln.cc (revision 0) @@ -0,0 +1,6 @@ +// pph asm xdiff 16845 +// duplicate function emission + +#include "x0tmplfuncinln1.h" +#include "x0tmplfuncinln2.h" +#include "a0tmplfuncinln_u.h" Index: gcc/testsuite/g++.dg/pph/z4tmplfuncinln.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4tmplfuncinln.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/z4tmplfuncinln.cc (revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 65129 +#include "x0tmplfuncinln3.h" +#include "x0tmplfuncinln4.h" +#include "a0tmplfuncinln_u.h" Index: gcc/testsuite/g++.dg/pph/z0expinstnin2.h =================================================================== --- gcc/testsuite/g++.dg/pph/z0expinstnin2.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/z0expinstnin2.h (working copy) @@ -1,6 +0,0 @@ -#ifndef X0EXPINSTNIN2_H -#define X0EXPINSTNIN2_H - -#include "a0expinstnin.h" - -#endif Index: gcc/testsuite/g++.dg/pph/a0template.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0template.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/a0template.h (working copy) @@ -1,20 +0,0 @@ -#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/pph.exp =================================================================== --- gcc/testsuite/g++.dg/pph/pph.exp (revision 177632) +++ gcc/testsuite/g++.dg/pph/pph.exp (working copy) @@ -29,10 +29,9 @@ 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 hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdepxyz\]*.h]] set neg_tests [lsort [glob -nocomplain $srcdir/$subdir/\[dy\]*.cc]] -set pos_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cpx\]*.cc]] +set pos_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cepxz\]*.cc]] exec ls $srcdir/$subdir | sed -e /^\[cpdxy\].*\.h$/!d -e s/.*/&\t&/ -e s/\.h$/\.pph/ > pph.map exec echo "math.h math.pph" >> pph.map Index: gcc/testsuite/g++.dg/pph/z4tmplclass2.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4tmplclass2.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/z4tmplclass2.cc (revision 0) @@ -0,0 +1,6 @@ +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-bogus "z4tmplclass2.cc:1:0: fatal error: LTO_tags out of range: Range is 0 to 355, value is 22276" "" { xfail *-*-* } 0 } + +#include "x0tmplclass23.h" +#include "x0tmplclass24.h" +#include "a0tmplclass2_u.h" Index: gcc/testsuite/g++.dg/pph/x0tmplfuncninl4.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncninl4.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncninl4.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLFUNCNINL4_H +#define X0TMPLFUNCNINL4_H + +#include "a0tmplfuncninl_g.h" +#include "a0tmplfuncninl_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplclass2_g.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass2_g.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass2_g.h (revision 0) @@ -0,0 +1,53 @@ +#ifndef A0TMPLCLASS2_G_H +#define A0TMPLCLASS2_G_H + +template<> +short base< short >::variable; + +template<> +short base< short >::dynamic_early_inline() +{ return 2 * field; } + +template<> +inline short base< short >::dynamic_late_inline() +{ return 2 * field; } + +template<> +short base< short >::static_early_inline() +{ return 2 * variable; } + +template<> +inline short base< short >::static_late_inline() +{ return 2 * variable; } + + +template<> +struct base +{ + double d_field; + static double d_variable; + + double d_dynamic_in_class() { return d_field; } + inline double d_dynamic_early_inline(); + double d_dynamic_late_inline(); + double d_dynamic_non_inline(); + + static double d_static_in_class() { return d_variable; } + static inline double d_static_early_inline(); + static double d_static_late_inline(); + static double d_static_non_inline(); +}; + +double base< double >::d_dynamic_early_inline() +{ return d_field; } + +inline double base< double >::d_dynamic_late_inline() +{ return d_field; } + +double base< double >::d_static_early_inline() +{ return d_variable; } + +inline double base< double >::d_static_late_inline() +{ return d_variable; } + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass13.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass13.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass13.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLCLASS13_H +#define X0TMPLCLASS13_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass1_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x1template.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1template.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/x1template.cc (working copy) @@ -1,11 +0,0 @@ -#include "x0template1.h" - -int x = 3; - -int y = 4; - -int D::method() -{ return y; } - -int main() -{ } Index: gcc/testsuite/g++.dg/pph/a0tmplclass2_s.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass2_s.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass2_s.h (revision 0) @@ -0,0 +1,24 @@ +#ifndef A0TMPLCLASS2_S_H +#define A0TMPLCLASS2_S_H + +template<> +short base< short >::variable = 2; + +template<> +short base< short >::dynamic_non_inline() +{ return 2 * field; } + +template<> +short base< short >::static_non_inline() +{ return 2 * variable; } + + +double base< double >::d_variable = 3; + +double base< double >::d_dynamic_non_inline() +{ return d_field; } + +double base< double >::d_static_non_inline() +{ return d_variable; } + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplclass1_u.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass1_u.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass1_u.h (revision 0) @@ -0,0 +1,25 @@ +#ifndef A0TMPLCLASS1_U_H +#define A0TMPLCLASS1_U_H + +double tmplclass_user1() +{ + base variable1; + base variable2; + base variable3; + return + variable1.dynamic_in_class() + base::static_in_class() + + variable1.dynamic_early_inline() + base::static_early_inline() + + variable1.dynamic_late_inline() + base::static_late_inline() + + variable1.dynamic_non_inline() + base::static_non_inline() + + variable2.dynamic_in_class() + base::static_in_class() + + variable2.dynamic_early_inline() + base::static_early_inline() + + variable2.dynamic_late_inline() + base::static_late_inline() + + variable2.dynamic_non_inline() + base::static_non_inline() + + variable3.dynamic_in_class() + base::static_in_class() + + variable3.dynamic_early_inline() + base::static_early_inline() + + variable3.dynamic_late_inline() + base::static_late_inline() + + variable3.dynamic_non_inline() + base::static_non_inline(); +} + +#endif + Index: gcc/testsuite/g++.dg/pph/x4tmplclass1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x4tmplclass1.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4tmplclass1.cc (revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 36067 +#include "x0tmplclass11.h" +#include "x0tmplclass12.h" +#include "a0tmplclass1_u.h" Index: gcc/testsuite/g++.dg/pph/x0tmplfuncinln4.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncinln4.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncinln4.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLFUNCINLN4_H +#define X0TMPLFUNCINLN4_H + +#include "a0tmplfuncinln_g.h" +#include "a0tmplfuncinln_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x1tmplclass.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplclass.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/x1tmplclass.cc (working copy) @@ -1,16 +0,0 @@ -#include "x0tmplclass1.h" - -int wrapper::cache = 2; - -template -struct wrapper; - -template -long wrapper::cache; - -int main() { - wrapper vc; - wrapper vs; - wrapper vi; - return 0; -} Index: gcc/testsuite/g++.dg/pph/a0expinstinl.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0expinstinl.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/a0expinstinl.h (working copy) @@ -1,12 +0,0 @@ -#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/x0tmplclass22.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass22.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass22.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLCLASS22_H +#define X0TMPLCLASS22_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass2_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x1tmplfuncninl.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplfuncninl.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x1tmplfuncninl.cc (revision 0) @@ -0,0 +1,3 @@ +#include "x0tmplfuncninl1.h" +#include "a0tmplfuncninl_s.h" +#include "a0tmplfuncninl_u.h" Index: gcc/testsuite/g++.dg/pph/a0tmplclass.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/a0tmplclass.h (working copy) @@ -1,17 +0,0 @@ -#ifndef A0TMPLCLASS_H -#define A0TMPLCLASS_H -template< typename T > -struct wrapper { - T value; - static T cache; -}; - -template< typename T > -T wrapper::cache = 3; - -template<> -struct wrapper { - int value; - static int cache; -}; -#endif Index: gcc/testsuite/g++.dg/pph/x4template.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x4template.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/x4template.cc (working copy) @@ -1,14 +0,0 @@ -// pph asm xdiff 52012 - -#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/x1tmplclass1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplclass1.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x1tmplclass1.cc (revision 0) @@ -0,0 +1,3 @@ +// pph asm xdiff 11432 +#include "x0tmplclass13.h" +#include "a0tmplclass1_u.h" Index: gcc/testsuite/g++.dg/pph/z4nontrivinit.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4nontrivinit.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/z4nontrivinit.cc (working copy) @@ -1,2 +1,3 @@ +// pph asm xdiff 65039 #include "x0nontrivinit1.h" #include "x0nontrivinit2.h" Index: gcc/testsuite/g++.dg/pph/e4variables.cc =================================================================== --- gcc/testsuite/g++.dg/pph/e4variables.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/e4variables.cc (working copy) @@ -1,3 +1,4 @@ +// pph asm xdiff 26015 #include "c0variables3.h" #include "c0variables4.h" Index: gcc/testsuite/g++.dg/pph/a0tmplfuncninl_g.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncninl_g.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncninl_g.h (revision 0) @@ -0,0 +1,15 @@ +#ifndef A0TMPLFUNCNINL_G_H +#define A0TMPLFUNCNINL_G_H + +template< typename T > +T function2( T t ) +{ + return t * 3; +} + +inline char instantiator2(char c) +{ + return function2(c); +} + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplfuncninl1.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncninl1.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncninl1.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLFUNCNINL1_H +#define X0TMPLFUNCNINL1_H + +#include "a0tmplfuncninl_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/z4expinstnin.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4expinstnin.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/z4expinstnin.cc (working copy) @@ -1,8 +0,0 @@ -#include "z0expinstnin1.h" -#include "z0expinstnin2.h" - -int main() -{ - int var = 1; - return function(var); -} Index: gcc/testsuite/g++.dg/pph/a0tmplfuncninl_s.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncninl_s.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncninl_s.h (revision 0) @@ -0,0 +1,11 @@ +#ifndef A0TMPLFUNCNINL_S_H +#define A0TMPLFUNCNINL_S_H + +template int function2(int); + +template<> double function2(double d) +{ + return d * 4.0; +} + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass14.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass14.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass14.h (revision 0) @@ -0,0 +1,7 @@ +#ifndef X0TMPLCLASS14_H +#define X0TMPLCLASS14_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass1_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0expinstnin.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0expinstnin.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/a0expinstnin.h (working copy) @@ -1,12 +0,0 @@ -#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/x1tmplfuncinln.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplfuncinln.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x1tmplfuncinln.cc (revision 0) @@ -0,0 +1,3 @@ +#include "x0tmplfuncinln1.h" +#include "a0tmplfuncinln_s.h" +#include "a0tmplfuncinln_u.h" Index: gcc/testsuite/g++.dg/pph/z0expinstinl1.h =================================================================== --- gcc/testsuite/g++.dg/pph/z0expinstinl1.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/z0expinstinl1.h (working copy) @@ -1,6 +0,0 @@ -#ifndef X0EXPINSTINL1_H -#define X0EXPINSTINL1_H - -#include "a0expinstinl.h" - -#endif Index: gcc/testsuite/g++.dg/pph/a0tmplfuncinln_g.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncinln_g.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncinln_g.h (revision 0) @@ -0,0 +1,20 @@ +#ifndef A0TMPLFUNCINLN_G_H +#define A0TMPLFUNCINLN_G_H + +template< typename T > +inline T function1( T t ) +{ + return t * 2; +} + +template<> double function1(double d) +{ + return d * 3.0; +} + +inline char instantiator1(char c) +{ + return function1(c); +} + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplfuncinln1.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncinln1.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncinln1.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLFUNCINLN1_H +#define X0TMPLFUNCINLN1_H + +#include "a0tmplfuncinln_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplfuncinln_s.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplfuncinln_s.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplfuncinln_s.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef A0TMPLFUNCINLN_S_H +#define A0TMPLFUNCINLN_S_H + +template int function1(int); + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass23.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass23.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass23.h (revision 0) @@ -0,0 +1,9 @@ +#ifndef X0TMPLCLASS13_H +#define X0TMPLCLASS13_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass1_s.h" +#include "a0tmplclass2_g.h" +#include "a0tmplclass2_s.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x4tmplclass2.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x4tmplclass2.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4tmplclass2.cc (revision 0) @@ -0,0 +1,6 @@ +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-bogus "x4tmplclass2.cc:1:0: fatal error: LTO_tags out of range: Range is 0 to 355, value is 22275" "" { xfail *-*-* } 0 } + +#include "x0tmplclass21.h" +#include "x0tmplclass22.h" +#include "a0tmplclass2_u.h" Index: gcc/testsuite/g++.dg/pph/x0tmplfuncninl2.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncninl2.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncninl2.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLFUNCNINL2_H +#define X0TMPLFUNCNINL2_H + +#include "a0tmplfuncninl_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/a0tmplclass1_g.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass1_g.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass1_g.h (revision 0) @@ -0,0 +1,59 @@ +#ifndef A0TMPLCLASS1_G_H +#define A0TMPLCLASS1_G_H + +template< typename T > +struct base +{ + T field; + static T variable; + + T dynamic_in_class() { return field; } + inline T dynamic_early_inline(); + T dynamic_late_inline(); + T dynamic_non_inline(); + + static T static_in_class() { return variable; } + static inline T static_early_inline(); + static T static_late_inline(); + static T static_non_inline(); +}; + +template< typename T > +T base< T >::variable = 1; + +template< typename T > +T base< T >::dynamic_early_inline() +{ return field; } + +template< typename T > +inline T base< T >::dynamic_late_inline() +{ return field; } + +template< typename T > +T base< T >::dynamic_non_inline() +{ return field; } + +template< typename T > +T base< T >::static_early_inline() +{ return variable; } + +template< typename T > +inline T base< T >::static_late_inline() +{ return variable; } + +template< typename T > +T base< T >::static_non_inline() +{ return variable; } + + +inline char instantiator1(char c) +{ + base variable; + return + variable.dynamic_in_class() + base::static_in_class() + + variable.dynamic_early_inline() + base::static_early_inline() + + variable.dynamic_late_inline() + base::static_late_inline() + + variable.dynamic_non_inline() + base::static_non_inline(); +} + +#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass11.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass11.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass11.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLCLASS11_H +#define X0TMPLCLASS11_H + +#include "a0tmplclass1_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/e4noninline.cc =================================================================== --- gcc/testsuite/g++.dg/pph/e4noninline.cc (revision 177632) +++ gcc/testsuite/g++.dg/pph/e4noninline.cc (working copy) @@ -1,7 +1,3 @@ -// 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" Index: gcc/testsuite/g++.dg/pph/a0tmplclass1_s.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass1_s.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass1_s.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef A0TMPLCLASS1_S_H +#define A0TMPLCLASS1_S_H + +template struct base< int >; + +#endif Index: gcc/testsuite/g++.dg/pph/z0expinstinl2.h =================================================================== --- gcc/testsuite/g++.dg/pph/z0expinstinl2.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/z0expinstinl2.h (working copy) @@ -1,6 +0,0 @@ -#ifndef X0EXPINSTINL2_H -#define X0EXPINSTINL2_H - -#include "a0expinstinl.h" - -#endif Index: gcc/testsuite/g++.dg/pph/a0tmplclass2_u.h =================================================================== --- gcc/testsuite/g++.dg/pph/a0tmplclass2_u.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0tmplclass2_u.h (revision 0) @@ -0,0 +1,29 @@ +#ifndef A0TMPLCLASS2_U_H +#define A0TMPLCLASS2_U_H + +double tmplclass_user2() +{ + base variable1; + base variable2; + base variable3; + return + variable1.dynamic_in_class() + base::static_in_class() + + variable1.dynamic_early_inline() + base::static_early_inline() + + variable1.dynamic_late_inline() + base::static_late_inline() + + variable1.dynamic_non_inline() + base::static_non_inline() + + variable2.dynamic_in_class() + base::static_in_class() + + variable2.dynamic_early_inline() + base::static_early_inline() + + variable2.dynamic_late_inline() + base::static_late_inline() + + variable2.dynamic_non_inline() + base::static_non_inline() + + variable3.d_dynamic_in_class() + + base::d_static_in_class() + + variable3.d_dynamic_early_inline() + + base::d_static_early_inline() + + variable3.d_dynamic_late_inline() + + base::d_static_late_inline() + + variable3.d_dynamic_non_inline() + + base::d_static_non_inline(); +} + +#endif + Index: gcc/testsuite/g++.dg/pph/x0tmplclass1.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass1.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/x0tmplclass1.h (working copy) @@ -1,4 +0,0 @@ -#ifndef X0TMPLCLASS1_H -#define X0TMPLCLASS1_H -#include "a0tmplclass.h" -#endif Index: gcc/testsuite/g++.dg/pph/x1tmplclass2.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1tmplclass2.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x1tmplclass2.cc (revision 0) @@ -0,0 +1,5 @@ +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-bogus "x1tmplclass2.cc:1:0: fatal error: LTO_tags out of range: Range is 0 to 355, value is 22276" "" { xfail *-*-* } 0 } + +#include "x0tmplclass23.h" +#include "a0tmplclass2_u.h" Index: gcc/testsuite/g++.dg/pph/z4tmplclass1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/z4tmplclass1.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/z4tmplclass1.cc (revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 10444 +#include "x0tmplclass13.h" +#include "x0tmplclass14.h" +#include "a0tmplclass1_u.h" Index: gcc/testsuite/g++.dg/pph/x0tmplfuncinln2.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplfuncinln2.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplfuncinln2.h (revision 0) @@ -0,0 +1,6 @@ +#ifndef X0TMPLFUNCINLN2_H +#define X0TMPLFUNCINLN2_H + +#include "a0tmplfuncinln_g.h" + +#endif Index: gcc/testsuite/g++.dg/pph/x0template1.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0template1.h (revision 177632) +++ gcc/testsuite/g++.dg/pph/x0template1.h (working copy) @@ -1,4 +0,0 @@ -#ifndef X0TEMPLATE1_H -#define X0TEMPLATE1_H -#include "a0template.h" -#endif Index: gcc/testsuite/g++.dg/pph/x0tmplclass24.h =================================================================== --- gcc/testsuite/g++.dg/pph/x0tmplclass24.h (revision 0) +++ gcc/testsuite/g++.dg/pph/x0tmplclass24.h (revision 0) @@ -0,0 +1,9 @@ +#ifndef X0TMPLCLASS24_H +#define X0TMPLCLASS24_H + +#include "a0tmplclass1_g.h" +#include "a0tmplclass1_s.h" +#include "a0tmplclass2_g.h" +#include "a0tmplclass2_s.h" + +#endif