Order of prepare_for_weave and insert advice is fixed
authorKetan Dixit <ketan.dixit@gmail.com>
Mon, 7 Jun 2010 22:48:42 +0000 (18:48 -0400)
committerKetan Dixit <ketan.dixit@gmail.com>
Mon, 7 Jun 2010 22:48:42 +0000 (18:48 -0400)
src/aop-weave.c

index f5465b778bec8189cb7acea4e479c9357a991cea..d4b2682abe4fd54c049a04baa6294d7e17d9877e 100644 (file)
@@ -175,10 +175,6 @@ aop_insert_advice (struct aop_joinpoint *jp, const char *func_name,
   gimple func_call;
   struct aop_pointcut *pc;
 
-  va_start (argp, location);
-  func_call = build_gcc_call (func_name, void_type_node, argp);
-  va_end (argp);
-
   pc = jp->pc;
 
   /* Make sure this joinpoint is prepared for advice. */
@@ -188,9 +184,13 @@ aop_insert_advice (struct aop_joinpoint *jp, const char *func_name,
       jp->is_prepared = true;
     }
 
+  va_start (argp, location);
+  func_call = build_gcc_call (func_name, void_type_node, argp);
+  va_end (argp);
+  
   if(location == AOP_INSERT_BEFORE)
     pc->insert_before(jp, func_call);
   else if(location == AOP_INSERT_AFTER)
     pc->insert_after(jp, func_call);
-  pc = jp->pc;
+
 }