From 73b92d8d3495b12f38de4bbaf705cbb4fce49708 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 3 Jun 2008 15:11:21 +0000 Subject: [PATCH] prototypes should override non-prototypes [r19958] --- ast2firm.c | 6 +++--- parser.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index 24f0547..917230d 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -344,20 +344,20 @@ static ir_type *create_method_type(const function_type_t *function_type) dbg_info *dbgi = get_dbg_info(&function_type->base.source_position); ir_type *irtype = new_d_type_method(id, n_parameters, n_results, dbgi); - if(return_type != type_void) { + if (return_type != type_void) { ir_type *restype = get_ir_type(return_type); set_method_res_type(irtype, 0, restype); } function_parameter_t *parameter = function_type->parameters; int n = 0; - for( ; parameter != NULL; parameter = parameter->next) { + for ( ; parameter != NULL; parameter = parameter->next) { ir_type *p_irtype = get_ir_type(parameter->type); set_method_param_type(irtype, n, p_irtype); ++n; } - if(function_type->variadic || function_type->unspecified_parameters) { + if (function_type->variadic || function_type->unspecified_parameters) { set_method_variadicity(irtype, variadicity_variadic); } diff --git a/parser.c b/parser.c index 79122e5..8a3e868 100644 --- a/parser.c +++ b/parser.c @@ -3867,6 +3867,11 @@ static declaration_t *internal_record_declaration( * declarations (except if the previous declaration is neither * none nor extern) */ if (is_type_function(type)) { + if (prev_type->function.unspecified_parameters) { + previous_declaration->type = type; + prev_type = type; + } + switch (old_storage_class) { case STORAGE_CLASS_NONE: old_storage_class = STORAGE_CLASS_EXTERN; -- 2.20.1