Fixed parameter count error on variadic functions with EN/ENO
authoretisserant
Mon, 19 Jan 2009 08:27:30 +0100
changeset 167 ae423926bc84
parent 166 09004f402097
child 168 225db59fe6fe
Fixed parameter count error on variadic functions with EN/ENO
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_st.cc	Wed Jan 14 20:54:29 2009 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Mon Jan 19 08:27:30 2009 +0100
@@ -464,20 +464,24 @@
     symbol_c *function_return_type = search_expression_type->get_type(symbol);
     
     function_call_param_iterator_c function_call_param_iterator(symbol);
+
+    int nb_param = ((list_c *)symbol->parameter_assignment_list)->n;
     
     identifier_c en_param_name("EN");
     /* Get the value from EN param */
     symbol_c *EN_param_value = function_call_param_iterator.search(&en_param_name);
     if (EN_param_value == NULL)
       EN_param_value = (symbol_c*)(new boolean_literal_c((symbol_c*)(new bool_type_name_c()), new boolean_true_c()));
+    else
+      nb_param --;
     ADD_PARAM_LIST(EN_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_in)
     
     identifier_c eno_param_name("ENO");
     /* Get the value from ENO param */
     symbol_c *ENO_param_value = function_call_param_iterator.search(&eno_param_name);
+    if (ENO_param_value != NULL)
+      nb_param --;
     ADD_PARAM_LIST(ENO_param_value, (symbol_c*)(new bool_type_name_c()), function_param_iterator_c::direction_out)
-    
-    int nb_param = ((list_c *)symbol->parameter_assignment_list)->n;
 
     #include "st_code_gen.c"