diff --git a/tools/qfcc/include/function.h b/tools/qfcc/include/function.h index 5d2eefbdc..2941ae499 100644 --- a/tools/qfcc/include/function.h +++ b/tools/qfcc/include/function.h @@ -161,7 +161,7 @@ struct defspace_s; int value_too_large (const type_t *val_type) __attribute__((pure)); void make_function (symbol_t *sym, const char *nice_name, struct defspace_s *space, enum storage_class_e storage); -symbol_t *function_symbol (symbol_t *sym, int overload); +symbol_t *function_symbol (symbol_t *sym, specifier_t spec); const expr_t *find_function (const expr_t *fexpr, const expr_t *params); function_t *new_function (const char *name, const char *nice_name); void add_function (function_t *f); diff --git a/tools/qfcc/source/class.c b/tools/qfcc/source/class.c index 5cf951634..320f5e88c 100644 --- a/tools/qfcc/source/class.c +++ b/tools/qfcc/source/class.c @@ -1635,13 +1635,18 @@ class_finish_module (void) if (!exec_class_sym) { exec_class_sym = new_symbol_type ("__obj_exec_class", &type_exec_class); - exec_class_sym = function_symbol (exec_class_sym, 0); + exec_class_sym = function_symbol (exec_class_sym, + (specifier_t) { + .is_overload = false + }); make_function (exec_class_sym, 0, exec_class_sym->table->space, sc_extern); } init_sym = new_symbol_type (".ctor", &type_func); - init_sym = function_symbol (init_sym, 0); + init_sym = function_symbol (init_sym, (specifier_t) { + .is_overload = false + }); const expr_t *module_expr; module_expr = address_expr (new_symbol_expr (module_sym), 0); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 671270dfd..f1cd3047c 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -3063,7 +3063,9 @@ think_expr (symbol_t *think_sym) } else { think_sym->type = &type_func; } - think_sym = function_symbol (think_sym, 0); + think_sym = function_symbol (think_sym, (specifier_t) { + .is_overload = false + }); make_function (think_sym, 0, current_symtab->space, current_storage); return new_symbol_expr (think_sym); } diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index 60ba4bc77..6f00af5a0 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -301,13 +301,13 @@ get_function (const char *name, const type_t *type, int overload) } symbol_t * -function_symbol (symbol_t *sym, int overload) +function_symbol (symbol_t *sym, specifier_t spec) { const char *name = sym->name; overloaded_function_t *func; symbol_t *s; - func = get_function (name, unalias_type (sym->type), overload); + func = get_function (name, unalias_type (sym->type), spec.is_overload); if (func && func->overloaded) name = func->full_name; @@ -685,12 +685,12 @@ begin_function (symbol_t *sym, const char *nicename, symtab_t *parent, if (sym->sy_type != sy_func) { error (0, "%s is not a function", sym->name); sym = new_symbol_type (sym->name, &type_func); - sym = function_symbol (sym, 1); + sym = function_symbol (sym, (specifier_t) { .is_overload = true }); } if (sym->s.func && sym->s.func->def && sym->s.func->def->initialized) { error (0, "%s redefined", sym->name); sym = new_symbol_type (sym->name, sym->type); - sym = function_symbol (sym, 1); + sym = function_symbol (sym, (specifier_t) { .is_overload = true }); } space = sym->table->space; if (far) diff --git a/tools/qfcc/source/glsl-parse.y b/tools/qfcc/source/glsl-parse.y index 796b3c1ff..5a9027d6f 100644 --- a/tools/qfcc/source/glsl-parse.y +++ b/tools/qfcc/source/glsl-parse.y @@ -241,7 +241,7 @@ function_definition spec.sym->type = parse_params (spec.sym->type, spec.params); auto sym = function_sym_type (spec, spec.sym); sym->params = spec.params; - sym = function_symbol (sym, true); + sym = function_symbol (sym, (specifier_t) { .is_overload = true }); current_func = begin_function (sym, nullptr, current_symtab, false, spec.storage); current_symtab = current_func->locals; diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index 6d1c5585d..9196e1f14 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -183,7 +183,7 @@ method_symbol (class_type_t *class_type, method_t *method) //printf ("%s %s %s %ld\n", method->name, method->types, str->str, // str->size); sym = new_symbol_type (str->str, method->type); - sym = function_symbol (sym, 0); + sym = function_symbol (sym, (specifier_t) { .is_overload = false }); sym->params = method->params; dstring_delete (str); return sym; @@ -369,7 +369,7 @@ send_message (int super) symtab_t *save = current_symtab; current_symtab = pr.symtab; sym = new_symbol_type (sm_name, sm_type); - sym = function_symbol (sym, 0); + sym = function_symbol (sym, (specifier_t) { .is_overload = false }); make_function (sym, 0, sym->table->space, sc_extern); current_symtab = save; } diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index d7101daef..f8682b4fb 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -665,7 +665,7 @@ qc_nocode_func const expr_t *expr = $4; sym->params = spec.sym->params; sym = function_sym_type (spec, sym); - sym = function_symbol (sym, spec.is_overload); + sym = function_symbol (sym, spec); build_builtin_function (sym, expr, 0, spec.storage); } | identifier '=' expr @@ -684,7 +684,7 @@ qc_nocode_func sym->params = spec.sym->params; sym = function_sym_type (spec, sym); if (!local_expr && !is_field (spec.sym->type)) { - sym = function_symbol (sym, spec.is_overload); + sym = function_symbol (sym, spec); } if (!local_expr && !is_field (sym->type)) { // things might be a confused mess from earlier errors @@ -711,7 +711,7 @@ qc_code_func symbol_t *sym = $1; sym->params = spec.sym->params; sym = function_sym_type (spec, sym); - sym = function_symbol (sym, spec.is_overload); + sym = function_symbol (sym, spec); current_func = begin_function (sym, 0, current_symtab, 0, spec.storage); current_symtab = current_func->locals; @@ -1012,7 +1012,7 @@ function_body { specifier_t spec = default_type ($0, $0.sym); symbol_t *sym = function_sym_type (spec, spec.sym); - $$ = function_symbol (sym, spec.is_overload); + $$ = function_symbol (sym, spec); } save_storage { @@ -1036,7 +1036,7 @@ function_body { specifier_t spec = default_type ($0, $0.sym); symbol_t *sym = function_sym_type (spec, spec.sym); - sym = function_symbol (sym, spec.is_overload); + sym = function_symbol (sym, spec); build_builtin_function (sym, $3, 0, spec.storage); } ; diff --git a/tools/qfcc/source/qp-parse.y b/tools/qfcc/source/qp-parse.y index 5f7448767..2960ef9af 100644 --- a/tools/qfcc/source/qp-parse.y +++ b/tools/qfcc/source/qp-parse.y @@ -169,7 +169,7 @@ build_dotmain (symbol_t *program) dotmain->params = 0; dotmain->type = parse_params (&type_int, 0); dotmain->type = find_type (dotmain->type); - dotmain = function_symbol (dotmain, 0); + dotmain = function_symbol (dotmain, (specifier_t) { .is_overload = false }); exitcode = new_symbol_expr (symtab_lookup (current_symtab, "ExitCode")); @@ -252,7 +252,7 @@ program_head } $$->type = parse_params (&type_void, 0); $$->type = find_type ($$->type); - $$ = function_symbol ($$, 0); + $$ = function_symbol ($$, (specifier_t) { .is_overload = false }); } ; @@ -339,7 +339,9 @@ subprogram_head $$->params = $3; $$->type = parse_params ($5, $3); $$->type = find_type ($$->type); - $$ = function_symbol ($$, 0); + $$ = function_symbol ($$, (specifier_t) { + .is_overload = false + }); } } | PROCEDURE ID arguments @@ -351,7 +353,9 @@ subprogram_head $$->params = $3; $$->type = parse_params (&type_void, $3); $$->type = find_type ($$->type); - $$ = function_symbol ($$, 0); + $$ = function_symbol ($$, (specifier_t) { + .is_overload = false + }); } } ; diff --git a/tools/qfcc/source/symtab.c b/tools/qfcc/source/symtab.c index 36939ed8c..d1051f5af 100644 --- a/tools/qfcc/source/symtab.c +++ b/tools/qfcc/source/symtab.c @@ -293,7 +293,7 @@ declare_symbol (specifier_t spec, const expr_t *init, symtab_t *symtab) error (0, "function %s is initialized", s->name); } s->type = find_type (s->type); - s = function_symbol (s, spec.is_overload); + s = function_symbol (s, spec); } else { s->type = find_type (s->type); initialize_def (s, init, space, spec.storage, symtab);