mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
Don't warn about uninitialized stuff in accessors - remove the liferanges calculated when finalizing accessors, this would add invalid liferanges to function-local arrays and thus suppress warnings randomly
This commit is contained in:
parent
c926c4cb59
commit
6b575372cc
3 changed files with 12 additions and 1 deletions
9
ast.c
9
ast.c
|
@ -1403,6 +1403,7 @@ error: /* clean up */
|
|||
bool ast_generate_accessors(ast_value *self, ir_builder *ir)
|
||||
{
|
||||
size_t i;
|
||||
bool warn = OPTS_WARN(WARN_USED_UNINITIALIZED);
|
||||
if (!self->setter || !self->getter)
|
||||
return true;
|
||||
for (i = 0; i < self->expression.count; ++i) {
|
||||
|
@ -1419,12 +1420,15 @@ bool ast_generate_accessors(ast_value *self, ir_builder *ir)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
options_set(opts_warn, WARN_USED_UNINITIALIZED, false);
|
||||
if (self->setter) {
|
||||
if (!ast_global_codegen (self->setter, ir, false) ||
|
||||
!ast_function_codegen(self->setter->constval.vfunc, ir) ||
|
||||
!ir_function_finalize(self->setter->constval.vfunc->ir_func))
|
||||
{
|
||||
compile_error(ast_ctx(self), "internal error: failed to generate setter for `%s`", self->name);
|
||||
options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1434,9 +1438,14 @@ bool ast_generate_accessors(ast_value *self, ir_builder *ir)
|
|||
!ir_function_finalize(self->getter->constval.vfunc->ir_func))
|
||||
{
|
||||
compile_error(ast_ctx(self), "internal error: failed to generate getter for `%s`", self->name);
|
||||
options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < self->expression.count; ++i) {
|
||||
vec_free(self->ir_values[i]->life);
|
||||
}
|
||||
options_set(opts_warn, WARN_USED_UNINITIALIZED, warn);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
2
gmqcc.h
2
gmqcc.h
|
@ -946,4 +946,6 @@ extern uint32_t opts_flags [1 + (COUNT_FLAGS / 32)];
|
|||
extern uint32_t opts_warn [1 + (COUNT_WARNINGS / 32)];
|
||||
extern uint32_t opts_optimization[1 + (COUNT_OPTIMIZATIONS / 32)];
|
||||
|
||||
void options_set(uint32_t *flags, size_t idx, bool on);
|
||||
|
||||
#endif
|
||||
|
|
2
main.c
2
main.c
|
@ -169,7 +169,7 @@ static bool options_long_gcc(const char *optname, int *argc_, char ***argv_, cha
|
|||
return options_long_witharg_all(optname, argc_, argv_, out, 1, false);
|
||||
}
|
||||
|
||||
static void options_set(uint32_t *flags, size_t idx, bool on)
|
||||
void options_set(uint32_t *flags, size_t idx, bool on)
|
||||
{
|
||||
longbit lb = LONGBIT(idx);
|
||||
#if 0
|
||||
|
|
Loading…
Reference in a new issue