This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 5/6] Introduce virtual functions in testsuite/gcc.dg/plugin/one_time_plugin.c
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Fri, 19 Apr 2013 21:23:01 -0400
- Subject: [PATCH 5/6] Introduce virtual functions in testsuite/gcc.dg/plugin/one_time_plugin.c
- References: <1365087283 dot 1778 dot 35 dot camel at surprise> <1366420982-1546-1-git-send-email-dmalcolm at redhat dot 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 <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
+
+2013-04-16 David Malcolm <dmalcolm@redhat.com>
+
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)
{
--
1.7.11.7