From patchwork Sat Apr 20 01:23:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 238131 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C6F0E2C020D for ; Sat, 20 Apr 2013 11:23:59 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=N9NDSyq92QygVkfC5EpvRUZNPHuz3PU6l5fEpZPhIku0DTo+vdq4N 6c4W+RHmvTYaEmShIlTcN02CkHqJ6ECd7362e2n8tt0SnLCCaYQ+Vl2tmZzC2hSI O0V8XiCu51n+aVS38QWJM89im0xCewnyAY8VTMRkOQ8BO6ZysOqbCA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=OYPpD897fqXfofsLSVFqmLry5bM=; b=Z8sm8GCe6aNhxKRGOVDl d4SXzO18f9to2X1/4XbdEenkZzawMN3b/PhzlKQbZXJHD388SfDYbAMWi1xppSTT EpOYcC808Yjbzheh7fAHsBc4uAIbCoVqCNOmjlj3oskzrmyYVSznir2nwLI3FELb Km7DWOnToPxZESXp/qiLGyY= Received: (qmail 18251 invoked by alias); 20 Apr 2013 01:23:10 -0000 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 Received: (qmail 18224 invoked by uid 89); 20 Apr 2013 01:23:10 -0000 X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 20 Apr 2013 01:23:09 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3K1N8SY001325 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Apr 2013 21:23:08 -0400 Received: from surprise.redhat.com (vpn-238-97.phx2.redhat.com [10.3.238.97]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3K1N3a3010184; Fri, 19 Apr 2013 21:23:07 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 5/6] Introduce virtual functions in testsuite/gcc.dg/plugin/one_time_plugin.c Date: Fri, 19 Apr 2013 21:23:01 -0400 Message-Id: <1366420982-1546-6-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1366420982-1546-1-git-send-email-dmalcolm@redhat.com> References: <1365087283.1778.35.camel@surprise> <1366420982-1546-1-git-send-email-dmalcolm@redhat.com> * testsuite/gcc.dg/plugin/one_time_plugin.c (one_pass_gate): convert to a virtual function: one_pass::gate (one_pass_exec): convert to a virtual function: one_pass::impl_execute --- gcc/ChangeLog | 6 +++++ gcc/testsuite/gcc.dg/plugin/one_time_plugin.c | 36 +++++++++++++-------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 84eff8b..8554fb3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2013-04-19 David Malcolm + * testsuite/gcc.dg/plugin/one_time_plugin.c (one_pass_gate): convert + to a virtual function: one_pass::gate + (one_pass_exec): convert to a virtual function: one_pass::impl_execute + +2013-04-16 David Malcolm + This is the hand-written part of the patch; it is required for the preceding auto-generated patch to make sense. diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c index c08161e..2be2d80 100644 --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c @@ -12,22 +12,6 @@ int plugin_is_GPL_compatible; -static bool one_pass_gate (void) -{ - return true; -} - -static unsigned int one_pass_exec (void) -{ - static int counter = 0; - - if (counter > 0) { - printf ("Executed more than once \n"); - } - counter++; - return 0; -} - class one_pass : public gimple_opt_pass { public: @@ -45,13 +29,29 @@ public: /* opt_pass methods: */ bool has_gate () { return true; } - bool gate () { return one_pass_gate (); } + bool gate (); bool has_execute () { return true; } - unsigned int impl_execute () { return one_pass_exec (); } + unsigned int impl_execute (); }; // class one_pass +bool one_pass::gate (void) +{ + return true; +} + +unsigned int one_pass::impl_execute () +{ + static int counter = 0; + + if (counter > 0) { + printf ("Executed more than once \n"); + } + counter++; + return 0; +} + gimple_opt_pass * make_one_pass (context &ctxt) {