mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-11 02:00:51 +00:00
[qfcc] Use a function to apply function attributes
There are too may places where they need to be applied, so making them all use a function will keep things manageable in the future.
This commit is contained in:
parent
8cc6cbc157
commit
eee6744656
1 changed files with 12 additions and 6 deletions
|
@ -421,6 +421,12 @@ check_specifiers (specifier_t spec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_func_type_attrs (type_t *func, specifier_t spec)
|
||||||
|
{
|
||||||
|
func->t.func.no_va_list = spec.no_va_list;
|
||||||
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%expect 0
|
%expect 0
|
||||||
|
@ -486,7 +492,7 @@ external_def
|
||||||
ret_type = *type;
|
ret_type = *type;
|
||||||
*type = 0;
|
*type = 0;
|
||||||
*type = parse_params (0, $2);
|
*type = parse_params (0, $2);
|
||||||
(*type)->t.func.no_va_list = $1.no_va_list;
|
set_func_type_attrs ((*type), $1);
|
||||||
$<spec>$.type = find_type (append_type ($1.type, ret_type));
|
$<spec>$.type = find_type (append_type ($1.type, ret_type));
|
||||||
if ($<spec>$.type->type != ev_field)
|
if ($<spec>$.type->type != ev_field)
|
||||||
$<spec>$.params = $2;
|
$<spec>$.params = $2;
|
||||||
|
@ -527,7 +533,7 @@ function_body
|
||||||
symbol_t *sym = $<symbol>0;
|
symbol_t *sym = $<symbol>0;
|
||||||
specifier_t spec = default_type ($<spec>-1, sym);
|
specifier_t spec = default_type ($<spec>-1, sym);
|
||||||
|
|
||||||
sym->type->t.func.no_va_list = spec.no_va_list;
|
set_func_type_attrs (sym->type, spec);
|
||||||
sym->type = find_type (append_type (sym->type, spec.type));
|
sym->type = find_type (append_type (sym->type, spec.type));
|
||||||
$<symbol>$ = function_symbol (sym, spec.is_overload, 1);
|
$<symbol>$ = function_symbol (sym, spec.is_overload, 1);
|
||||||
}
|
}
|
||||||
|
@ -551,7 +557,7 @@ function_body
|
||||||
symbol_t *sym = $<symbol>0;
|
symbol_t *sym = $<symbol>0;
|
||||||
specifier_t spec = default_type ($<spec>-1, sym);
|
specifier_t spec = default_type ($<spec>-1, sym);
|
||||||
|
|
||||||
sym->type->t.func.no_va_list = spec.no_va_list;
|
set_func_type_attrs (sym->type, spec);
|
||||||
sym->type = find_type (append_type (sym->type, spec.type));
|
sym->type = find_type (append_type (sym->type, spec.type));
|
||||||
sym = function_symbol (sym, spec.is_overload, 1);
|
sym = function_symbol (sym, spec.is_overload, 1);
|
||||||
build_builtin_function (sym, $3, 0, spec.storage);
|
build_builtin_function (sym, $3, 0, spec.storage);
|
||||||
|
@ -600,7 +606,7 @@ external_decl
|
||||||
| function_decl
|
| function_decl
|
||||||
{
|
{
|
||||||
specifier_t spec = default_type ($<spec>0, $1);
|
specifier_t spec = default_type ($<spec>0, $1);
|
||||||
$1->type->t.func.no_va_list = spec.no_va_list;
|
set_func_type_attrs ($1->type, spec);
|
||||||
$1->type = find_type (append_type ($1->type, spec.type));
|
$1->type = find_type (append_type ($1->type, spec.type));
|
||||||
if (spec.is_typedef) {
|
if (spec.is_typedef) {
|
||||||
$1->sy_type = sy_type;
|
$1->sy_type = sy_type;
|
||||||
|
@ -1089,7 +1095,7 @@ qc_param_decl
|
||||||
type = &(*type)->t.fldptr.type)
|
type = &(*type)->t.fldptr.type)
|
||||||
;
|
;
|
||||||
*type = parse_params (*type, $2);
|
*type = parse_params (*type, $2);
|
||||||
(*type)->t.func.no_va_list = $1.no_va_list;
|
set_func_type_attrs ((*type), $1);
|
||||||
$3->type = find_type ($1.type);
|
$3->type = find_type ($1.type);
|
||||||
if ($3->type->type != ev_field)
|
if ($3->type->type != ev_field)
|
||||||
$3->params = $2;
|
$3->params = $2;
|
||||||
|
@ -1168,7 +1174,7 @@ local_decl_list
|
||||||
type = &(*type)->t.fldptr.type)
|
type = &(*type)->t.fldptr.type)
|
||||||
;
|
;
|
||||||
*type = parse_params (*type, $1);
|
*type = parse_params (*type, $1);
|
||||||
(*type)->t.func.no_va_list = spec.no_va_list;
|
set_func_type_attrs ((*type), spec);
|
||||||
spec.type = find_type (spec.type);
|
spec.type = find_type (spec.type);
|
||||||
$<spec>$ = spec;
|
$<spec>$ = spec;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue