Commit 5183ca9b authored by Vitja Makarov's avatar Vitja Makarov

Don't track arrays and c-structs/unions

parent f368d4f1
...@@ -130,6 +130,8 @@ class ControlFlow(object): ...@@ -130,6 +130,8 @@ class ControlFlow(object):
def is_tracked(self, entry): def is_tracked(self, entry):
if entry.is_anonymous: if entry.is_anonymous:
return False return False
if entry.type.is_array or entry.type.is_struct_or_union:
return False
return entry.is_local or entry.is_pyclass_attr or entry.is_arg return entry.is_local or entry.is_pyclass_attr or entry.is_arg
def mark_position(self, node): def mark_position(self, node):
...@@ -394,9 +396,6 @@ def check_definitions(flow, compiler_directives): ...@@ -394,9 +396,6 @@ def check_definitions(flow, compiler_directives):
pass pass
elif stat.entry.type.is_pyobject or stat.entry.type.is_unspecified: elif stat.entry.type.is_pyobject or stat.entry.type.is_unspecified:
messages.error(stat.pos, "local variable '%s' referenced before assignment" % stat.entry.name) messages.error(stat.pos, "local variable '%s' referenced before assignment" % stat.entry.name)
elif not stat.entry.type.is_array and not stat.entry.type.is_struct_or_union:
# TODO: not sure here
messages.warning(stat.pos, "local variable '%s' referenced before assignment" % stat.entry.name)
else: else:
if compiler_directives['warn.maybe_uninitialized']: if compiler_directives['warn.maybe_uninitialized']:
messages.warning(stat.pos, "local variable '%s' might be referenced before assignment" % stat.entry.name) messages.warning(stat.pos, "local variable '%s' might be referenced before assignment" % stat.entry.name)
......
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