summaryrefslogtreecommitdiff
path: root/pp2cc.py
diff options
context:
space:
mode:
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-xpp2cc.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pp2cc.py b/pp2cc.py
index 190f10a..bc9259f 100755
--- a/pp2cc.py
+++ b/pp2cc.py
@@ -150,6 +150,10 @@ class Parse(object):
" node, but also found " +
str(thing), linked_node=linked_node)
self.codeSegment += self.parseStatement(thing, root_node)
+ # hack: static functions are local to a file, so remove them
+ for funcname, function in self.functions.items():
+ if function.isStatic():
+ del self.functions[funcname]
def compileASM(self):
"""Processes lines of assembly and merge it into the output"""
for label in self.asm_node.labels:
@@ -212,8 +216,6 @@ class Parse(object):
lbl_func = function.labelBegin()
lbl_end = function.labelEnd()
- self.addLabel(lbl_func)
- self.addLabel(lbl_end)
linked_node.setFunction(function)
# save Base Pointer
lines = [self.asm.push(self.registers.BP, lbl_func)]
@@ -1225,7 +1227,9 @@ class Parse(object):
node = linked_node.node
funcname = node.type.declname
if not funcname in self.functions:
- self.functions[funcname] = Function(node)
+ is_static = "static" in linked_node.parent.node.storage
+ self.functions[funcname] = Function(node, is_static=is_static,
+ uniq_provider=self.uniqLbl)
if node.args:
argstype = type(node.args).__name__
assert argstype == "ParamList", "Expected function arguments, found '{}' instead".format(argstype)