diff options
author | Peter Wu <lekensteyn@gmail.com> | 2011-12-03 10:22:18 +0000 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2011-12-03 10:22:18 +0000 |
commit | 3e8b807851337de5abf668892da2a589b6d8fad2 (patch) | |
tree | e4579bee5247b18e17b1adaf7035e2fd6f9f3f30 /pp2cc.py | |
parent | 30fc12c61857d9f242953e49b97118c976170d13 (diff) | |
download | pp2cc-3e8b807851337de5abf668892da2a589b6d8fad2.tar.gz |
Give the context in the warning for undefined functions
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-x | pp2cc.py | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -243,10 +243,7 @@ class Parse(object): if name in self.functions: function = self.functions[name] return function.labelBegin() - # name not found :? perhaps an external declaration - lbl = "fn_" + name - self.logger.warning("call to undefined function, assuming label '{}'".format(lbl)) - return lbl + return None def parseCompound(self, linked_node): linked_node.incrementLevel() @@ -749,7 +746,13 @@ class Parse(object): lines += line lines.append(self.asm.push(result_reg)) - lines.append(self.asm.branch_op("BRS", self.functionLabel(funcname))) + lbl_func = self.functionLabel(funcname) + if lbl_func is None: + # name not found :? perhaps an external declaration + lbl = "fn_" + funcname + self.logger.warning("call to undefined function, assuming label" + " '{}'".format(lbl), linked_node=linked_node) + lines.append(self.asm.branch_op("BRS", lbl_func)) if params: lines.append(self.asm.binary_op("ADD", "SP", len(params.exprs))) |