[pypy-svn] r31388 - pypy/dist/pypy/translator/c
ac at codespeak.net
ac at codespeak.net
Fri Aug 18 12:23:19 CEST 2006
Author: ac
Date: Fri Aug 18 12:23:17 2006
New Revision: 31388
Modified:
pypy/dist/pypy/translator/c/genc.py
pypy/dist/pypy/translator/c/node.py
Log:
Do not emit a forward declaration for external structs/unions
Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py (original)
+++ pypy/dist/pypy/translator/c/genc.py Fri Aug 18 12:23:17 2006
@@ -396,6 +396,8 @@
print >> fi, '/*** Structure definitions ***/'
print >> fi
for node in structdeflist:
+ if node.is_external():
+ continue
print >> fi, '%s %s;' % (node.typetag, node.name)
print >> fi
for node in structdeflist:
@@ -512,7 +514,7 @@
print >> f, '/*** Structure definitions ***/'
print >> f
for node in structdeflist:
- if node.name:
+ if node.name and not node.is_external():
print >> f, '%s %s;' % (node.typetag, node.name)
print >> f
for node in structdeflist:
Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py (original)
+++ pypy/dist/pypy/translator/c/node.py Fri Aug 18 12:23:17 2006
@@ -145,6 +145,9 @@
fldname = self.c_struct_field_name(fldname)
return '%s->%s' % (baseexpr, fldname)
+ def is_external(self):
+ return self.STRUCT._hints.get('external') # XXX hack
+
def definition(self):
if self.fields is None: # external definition only
return
@@ -240,6 +243,9 @@
def ptr_access_expr(self, baseexpr, index):
return '%s->items[%d]' % (baseexpr, index)
+ def is_external(self):
+ return False
+
def definition(self):
gcpolicy = self.db.gcpolicy
yield 'struct %s {' % self.name
@@ -323,6 +329,9 @@
ptr_access_expr = access_expr
+ def is_external(self):
+ return False
+
def definition(self):
return [] # no declaration is needed
More information about the Pypy-commit
mailing list