From 01cf28e436ea22256280f1681af53ea957bf4e3b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Mar 2020 18:08:26 +0900 Subject: [PATCH] [qfcc] Treat C-style function decls as prototypes This removes the need for extern from the declaration. --- tools/qfcc/source/qc-parse.y | 3 --- tools/qfcc/source/statements.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 70ca90fc3..516c0b491 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -487,9 +487,6 @@ external_decl symtab_addsymbol (current_symtab, $1); } else { $1 = function_symbol ($1, spec.is_overload, 1); - // things might be a confused mess from earlier errors - if ($1->sy_type == sy_func) - make_function ($1, 0, $1->table->space, spec.storage); } } ; diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index bd2508e54..6dbbbd99c 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -1314,6 +1314,9 @@ expr_symbol (sblock_t *sblock, expr_t *e, operand_t **op) } else if (sym->sy_type == sy_const) { *op = value_operand (sym->s.value, e); } else if (sym->sy_type == sy_func) { + if (!sym->s.func) { + make_function (sym, 0, pr.symtab->space, sc_extern); + } *op = def_operand (sym->s.func->def, 0, e); } else { internal_error (e, "unexpected symbol type: %s for %s",