Commit 0b657721 authored by Stefan Behnel's avatar Stefan Behnel

prevent unused '_' variables from appearing in C code

parent 6e4ccc8e
......@@ -615,17 +615,19 @@ def check_definitions(flow, compiler_directives):
# Unused entries
for entry in flow.entries:
if (not entry.cf_references and not entry.is_pyclass_attr
and not entry.in_closure
and entry.name != '_'):
if entry.is_arg:
if warn_unused_arg:
messages.warning(entry.pos, "Unused argument '%s'" %
entry.name)
else:
if warn_unused:
messages.warning(entry.pos, "Unused entry '%s'" %
entry.name)
if (not entry.cf_references
and not entry.is_pyclass_attr
and not entry.in_closure):
if entry.name != '_':
# '_' is often used for unused variables, e.g. in loops
if entry.is_arg:
if warn_unused_arg:
messages.warning(entry.pos, "Unused argument '%s'" %
entry.name)
else:
if warn_unused:
messages.warning(entry.pos, "Unused entry '%s'" %
entry.name)
entry.cf_used = False
messages.report()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment