mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 01:42:04 +00:00
[qfcc] Ensure pascal functions always have a block
I had never tested empty functions, so I hadn't noticed they cause a segfault.
This commit is contained in:
parent
4a8c53aa6f
commit
35c0b84ccc
1 changed files with 4 additions and 0 deletions
|
@ -387,6 +387,10 @@ subprogram_declaration
|
|||
// actual function symbol in rvalue
|
||||
auto fsym = (symbol_t *) sym->xvalue.rvalue;
|
||||
auto statements = $5;
|
||||
if (!statements) {
|
||||
statements = new_block_expr (0);
|
||||
statements->block.scope = current_symtab;
|
||||
}
|
||||
auto ret_expr = new_return_expr (function_return (current_func));
|
||||
append_expr (statements, ret_expr);
|
||||
statements = (expr_t *) expr_process (statements, ctx);
|
||||
|
|
Loading…
Reference in a new issue