mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
Fix fieldfuncs test and track unused variables through writes as well.
This commit is contained in:
parent
6938567c6c
commit
9821b6a075
2 changed files with 8 additions and 1 deletions
7
ir.cpp
7
ir.cpp
|
@ -631,6 +631,13 @@ bool ir_function_finalize(ir_function *self)
|
|||
if (self->m_builtin)
|
||||
return true;
|
||||
|
||||
for (auto& lp : self->m_locals) {
|
||||
ir_value *v = lp.get();
|
||||
if (v->m_reads.empty() && v->m_writes.size()
|
||||
&& irwarning(v->m_context, WARN_UNUSED_VARIABLE,
|
||||
"unused variable: `%s`", v->m_name.c_str())) return false;
|
||||
}
|
||||
|
||||
if (OPTS_OPTIMIZATION(OPTIM_PEEPHOLE)) {
|
||||
if (!ir_function_pass_peephole(self)) {
|
||||
irerror(self->m_context, "generic optimization pass broke something in `%s`", self->m_name.c_str());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
I: fieldfuncs.qc
|
||||
D: test fields with functions
|
||||
T: -compile
|
||||
T: -execute
|
||||
C: -std=fte
|
||||
M: 42
|
||||
M: 42
|
||||
|
|
Loading…
Reference in a new issue