print_type_quoted(previous_declaration->type);
fputc('\n', stderr);
} else {
- unsigned old_storage_class = previous_declaration->storage_class;
- unsigned new_storage_class = declaration->storage_class;
+ unsigned old_storage_class = previous_declaration->storage_class;
+ unsigned new_storage_class = declaration->storage_class;
+ type_t *type = previous_declaration->type;
+ type = skip_typeref(type);
+
if (current_function == NULL) {
if (old_storage_class != STORAGE_CLASS_STATIC &&
new_storage_class == STORAGE_CLASS_STATIC) {
if (new_storage_class == STORAGE_CLASS_NONE) {
previous_declaration->storage_class = STORAGE_CLASS_NONE;
}
- } else {
+ } else if(!is_type_function(type)) {
parser_print_warning_prefix_pos(declaration->source_position);
fprintf(stderr, "redundant declaration for '%s'\n",
symbol->string);
static void parse_kr_declaration_list(declaration_t *declaration)
{
type_t *type = skip_typeref(declaration->type);
- assert(is_type_function(type));
+ if(!is_type_function(type))
+ return;
if(!type->function.kr_style_parameters)
return;
expression->expression.type = EXPR_FUNCTION;
expression->expression.datatype = type_string;
- expression->value = "TODO: FUNCTION";
+ expression->value = current_function->symbol->string;
return (expression_t*) expression;
}
eat(T___PRETTY_FUNCTION__);
/* TODO */
+ if (current_function == NULL) {
+ parse_error("'__PRETTY_FUNCTION__' used outside of a function");
+ }
+
string_literal_expression_t *expression
= allocate_ast_zero(sizeof(expression[0]));
expression->expression.type = EXPR_PRETTY_FUNCTION;
expression->expression.datatype = type_string;
- expression->value = "TODO: PRETTY FUNCTION";
+ expression->value = current_function->symbol->string;
return (expression_t*) expression;
}
if(return_type == NULL)
return (statement_t*) statement;
+ if(return_value != NULL && return_value->base.datatype == NULL)
+ return (statement_t*) statement;
return_type = skip_typeref(return_type);