+static bool function_types_compatible(const function_type_t *func1,
+ const function_type_t *func2)
+{
+ const type_t* const ret1 = skip_typeref(func1->return_type);
+ const type_t* const ret2 = skip_typeref(func2->return_type);
+ if (!types_compatible(ret1, ret2))
+ return false;
+
+ /* can parameters be compared? */
+ if(func1->unspecified_parameters || func2->unspecified_parameters)
+ return true;
+
+ if(func1->variadic != func2->variadic)
+ return false;
+
+ /* TODO: handling of unspecified parameters not correct yet */
+
+ /* all argument types must be compatible */
+ function_parameter_t *parameter1 = func1->parameters;
+ function_parameter_t *parameter2 = func2->parameters;
+ for( ; parameter1 != NULL && parameter2 != NULL;
+ parameter1 = parameter1->next, parameter2 = parameter2->next) {
+ type_t *parameter1_type = skip_typeref(parameter1->type);
+ type_t *parameter2_type = skip_typeref(parameter2->type);
+
+ parameter1_type = get_unqualified_type(parameter1_type);
+ parameter2_type = get_unqualified_type(parameter2_type);
+
+ if(!types_compatible(parameter1_type, parameter2_type))
+ return false;
+ }
+ /* same number of arguments? */
+ if(parameter1 != NULL || parameter2 != NULL)
+ return false;
+
+ return true;
+}
+
+static bool array_types_compatible(const array_type_t *array1,
+ const array_type_t *array2)
+{
+ type_t *element_type1 = skip_typeref(array1->element_type);
+ type_t *element_type2 = skip_typeref(array2->element_type);
+ if(!types_compatible(element_type1, element_type2))
+ return false;
+
+ if(array1->size != NULL && array2->size != NULL) {
+ /* TODO: check if size expression evaluate to the same value
+ * if they are constant */
+ }
+
+ return true;
+}
+