Commit f7c25fe4 authored by Nikita Nemkin's avatar Nikita Nemkin

Consistently declare local error reporting variables (lineno, clineno,...

Consistently declare local error reporting variables (lineno, clineno, filename) for all types of functions.
parent 34e5a65a
...@@ -1618,6 +1618,12 @@ class CCodeWriter(object): ...@@ -1618,6 +1618,12 @@ class CCodeWriter(object):
else: else:
self.putln("%s%s;" % (static and "static " or "", decl)) self.putln("%s%s;" % (static and "static " or "", decl))
if func_context.should_declare_error_indicator:
# Initialize these variables to silence compiler warnings
self.putln("int %s = 0;" % Naming.lineno_cname)
self.putln("const char *%s = NULL;" % Naming.filename_cname)
self.putln("int %s = 0;" % Naming.clineno_cname)
def put_h_guard(self, guard): def put_h_guard(self, guard):
self.putln("#ifndef %s" % guard) self.putln("#ifndef %s" % guard)
self.putln("#define %s" % guard) self.putln("#define %s" % guard)
......
...@@ -1914,13 +1914,6 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1914,13 +1914,6 @@ class FuncDefNode(StatNode, BlockNode):
# ----- Go back and insert temp variable declarations # ----- Go back and insert temp variable declarations
tempvardecl_code.put_temp_declarations(code.funcstate) tempvardecl_code.put_temp_declarations(code.funcstate)
if code.funcstate.should_declare_error_indicator:
# Initialize these variables to silence compiler warnings
tempvardecl_code.putln("int %s = 0;" % Naming.lineno_cname)
tempvardecl_code.putln("const char *%s = NULL;" %
Naming.filename_cname)
if code.c_line_in_traceback:
tempvardecl_code.putln("int %s = 0;" % Naming.clineno_cname)
# ----- Python version # ----- Python version
code.exit_cfunc_scope() code.exit_cfunc_scope()
......
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