--- a/stage4/generate_c/generate_c.cc Thu Feb 02 00:34:04 2012 +0100
+++ b/stage4/generate_c/generate_c.cc Fri Feb 03 00:09:52 2012 +0100
@@ -182,6 +182,7 @@
class print_function_parameter_data_types_c: public generate_c_base_c {
private:
symbol_c *current_type;
+ symbol_c *return_type;
bool_type_name_c tmp_bool;
void print_list(symbol_c *var_list, symbol_c *data_type) {
@@ -197,9 +198,11 @@
}
public:
- print_function_parameter_data_types_c(stage4out_c *s4o_ptr):
- generate_c_base_c(s4o_ptr)
- {current_type = NULL;}
+ print_function_parameter_data_types_c(stage4out_c *s4o_ptr, symbol_c* return_type):
+ generate_c_base_c(s4o_ptr) {
+ current_type = NULL;
+ this->return_type = return_type;
+ }
/**************************************/
/* B.1.5 - Program organization units */
@@ -210,7 +213,11 @@
/* FUNCTION derived_function_name ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
/* | FUNCTION derived_function_name ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
void *visit(function_declaration_c *symbol) {
- symbol->type_name->accept(*this); /* return type */
+ /* return type */
+ if (this->return_type == NULL)
+ symbol->type_name->accept(*this);
+ else
+ this->return_type->accept(*this);
symbol->var_declarations_list->accept(*this);
return NULL;
}