A function declaration with unspecified parameter list is compatible to a declaration...
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 27 Nov 2007 15:40:15 +0000 (15:40 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 27 Nov 2007 15:40:15 +0000 (15:40 +0000)
[r18553]

parser.c

index e1db29c..19b00c0 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -443,6 +443,17 @@ static void set_context(context_t *new_context)
 static bool is_compatible_declaration (declaration_t *declaration,
                                       declaration_t *previous)
 {
+       if (declaration->type->type == TYPE_FUNCTION &&
+                       previous->type->type    == TYPE_FUNCTION &&
+                       previous->type->function.unspecified_parameters) {
+               function_type_t* const prev_func = &previous->type->function;
+               function_type_t* const decl_func = &declaration->type->function;
+               if (prev_func->unspecified_parameters &&
+                               prev_func->result_type == decl_func->result_type) {
+                       declaration->type = previous->type;
+                       return true;
+               }
+       }
        /* TODO: not correct yet */
        return declaration->type == previous->type;
 }