Patchwork [5/6] Introduce virtual functions in testsuite/gcc.dg/plugin/one_time_plugin.c

login
register
mail settings
Submitter David Malcolm
Date April 20, 2013, 1:23 a.m.
Message ID <1366420982-1546-6-git-send-email-dmalcolm@redhat.com>
Download mbox | patch
Permalink /patch/238131/
State New
Headers show

Comments

David Malcolm - April 20, 2013, 1:23 a.m.
* 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(-)

Patch

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)
 {