diff --git a/tools/qfcc/include/function.h b/tools/qfcc/include/function.h index 587ae4675..221fb1cc9 100644 --- a/tools/qfcc/include/function.h +++ b/tools/qfcc/include/function.h @@ -217,7 +217,7 @@ function_t *begin_function (symbol_t *sym, const char *nicename, enum storage_class_e storage); function_t *build_code_function (symbol_t *fsym, const expr_t *state_expr, expr_t *statements); -function_t *build_builtin_function (symbol_t *sym, +function_t *build_builtin_function (symbol_t *sym, const char *ext_name, const expr_t *bi_val, int far, enum storage_class_e storage); void build_intrinsic_function (specifier_t spec, const expr_t *intrinsic); diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index 8dd2ed4a5..738db821e 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -1194,8 +1194,8 @@ build_code_function (symbol_t *fsym, const expr_t *state_expr, } function_t * -build_builtin_function (symbol_t *sym, const expr_t *bi_val, int far, - storage_class_t storage) +build_builtin_function (symbol_t *sym, const char *ext_name, + const expr_t *bi_val, int far, storage_class_t storage) { int bi; @@ -1219,7 +1219,10 @@ build_builtin_function (symbol_t *sym, const expr_t *bi_val, int far, } defspace_t *space = far ? pr.far_data : sym->table->space; - func = make_function (sym, 0, space, storage); + func = make_function (sym, nullptr, space, storage); + if (ext_name) { + func->s_name = ReuseString (ext_name); + } if (func->def->external) return 0; diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 5434f3c4c..07e2f5366 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -833,7 +833,7 @@ qc_nocode_func spec.is_overload |= ctx->language->always_overload; symbol_t *sym = function_symbol (spec); - build_builtin_function (sym, bi_val, 0, spec.storage); + build_builtin_function (sym, nullptr, bi_val, 0, spec.storage); } | identifier '=' intrinsic { @@ -1204,7 +1204,7 @@ function_body spec.is_overload |= ctx->language->always_overload; symbol_t *sym = function_symbol (spec); - build_builtin_function (sym, bi_val, 0, spec.storage); + build_builtin_function (sym, nullptr, bi_val, 0, spec.storage); } | '=' intrinsic { @@ -2649,7 +2649,7 @@ methoddef method->instance = $1; method = class_find_method (current_class, method); sym = method_symbol (current_class, method); - build_builtin_function (sym, bi_val, 1, sc_static); + build_builtin_function (sym, nullptr, bi_val, 1, sc_static); method->func = sym->metafunc->func; method->def = method->func->def; } diff --git a/tools/qfcc/source/qp-parse.y b/tools/qfcc/source/qp-parse.y index 1ea8d0a93..ee91ff7ce 100644 --- a/tools/qfcc/source/qp-parse.y +++ b/tools/qfcc/source/qp-parse.y @@ -400,7 +400,7 @@ subprogram_declaration // always an sy_xvalue with callable symbol in lvalue and // actual function symbol in rvalue auto fsym = (symbol_t *) sym->xvalue.rvalue; - build_builtin_function (fsym, $4, 0, current_storage); + build_builtin_function (fsym, sym->name, $4, 0, current_storage); } ;