Kaydet (Commit) 27489d4c authored tarafından Jack Jansen's avatar Jack Jansen

Optionally weed out duplicate prototypes for the same function (which

happens because the scanner ignores preprocessor #ifs).
üst c1a4a047
...@@ -67,6 +67,10 @@ class BaseFunctionGenerator: ...@@ -67,6 +67,10 @@ class BaseFunctionGenerator:
def docstring(self): def docstring(self):
return None return None
def __cmp__(self, other):
if not hasattr(other, 'name'):
return cmp(id(self), id(other))
return cmp(self.name, other.name)
_stringify_map = {'\n': '\\n', '\t': '\\t', '\r': '\\r', '\b': '\\b', _stringify_map = {'\n': '\\n', '\t': '\\t', '\r': '\\r', '\b': '\\b',
'\e': '\\e', '\a': '\\a', '\f': '\\f', '"': '\\"'} '\e': '\\e', '\a': '\\a', '\f': '\\f', '"': '\\"'}
......
...@@ -6,7 +6,11 @@ class GeneratorGroup: ...@@ -6,7 +6,11 @@ class GeneratorGroup:
self.prefix = prefix self.prefix = prefix
self.generators = [] self.generators = []
def add(self, g): def add(self, g, dupcheck=0):
if dupcheck:
if g in self.generators:
print 'DUP', g.name
return
g.setprefix(self.prefix) g.setprefix(self.prefix)
self.generators.append(g) self.generators.append(g)
......
...@@ -23,9 +23,9 @@ class ObjectDefinition(GeneratorGroup): ...@@ -23,9 +23,9 @@ class ObjectDefinition(GeneratorGroup):
self.static = "static " # set to "" to make <type>_New and <type>_Convert public self.static = "static " # set to "" to make <type>_New and <type>_Convert public
self.basechain = "NULL" # set to &<basetype>_chain to chain methods self.basechain = "NULL" # set to &<basetype>_chain to chain methods
def add(self, g): def add(self, g, dupcheck=0):
g.setselftype(self.objecttype, self.itselftype) g.setselftype(self.objecttype, self.itselftype)
GeneratorGroup.add(self, g) GeneratorGroup.add(self, g, dupcheck)
def reference(self): def reference(self):
# In case we are referenced from a module # In case we are referenced from a module
......
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