[pypy-svn] r17176 - pypy/dist/pypy/translator/c
tismer at codespeak.net
tismer at codespeak.net
Sat Sep 3 18:35:15 CEST 2005
Author: tismer
Date: Sat Sep 3 18:35:14 2005
New Revision: 17176
Modified:
pypy/dist/pypy/translator/c/node.py
Log:
re: added survival kit for empty structs
forgot to augment initialization as well.
Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py (original)
+++ pypy/dist/pypy/translator/c/node.py Sat Sep 3 18:35:14 2005
@@ -100,10 +100,10 @@
def definition(self, phase):
gcpolicy = self.db.gcpolicy
- is_empty = True
if phase == 1:
yield 'struct %s {' % self.name
# gcheader
+ is_empty = True
if needs_gcheader(self.STRUCT):
line = gcpolicy.struct_gcheader_definition(self)
if line:
@@ -336,11 +336,13 @@
return len(array.items)
def initializationexpr(self, decoration=''):
+ is_empty = True
yield '{'
if needs_gcheader(self.T):
line = self.db.gcpolicy.struct_gcheader_initializationexpr(self)
if line:
yield '\t' + line
+ is_empty = False
defnode = self.db.gettypedefnode(self.T)
for name in self.T._names:
value = getattr(self.obj, name)
@@ -349,6 +351,10 @@
'%s.%s' % (self.name, c_name),
decoration + name)
yield '\t%s' % expr
+ if not expr.startswith('/*'):
+ is_empty = False
+ if is_empty:
+ yield '\t' + '0,'
yield '}'
assert not USESLOTS or '__dict__' not in dir(StructNode)
More information about the Pypy-commit
mailing list