[pypy-commit] pypy win32-fixes5: check more carefully for empty unions
mattip
noreply at buildbot.pypy.org
Fri Sep 12 16:45:36 CEST 2014
Author: mattip <matti.picus at gmail.com>
Branch: win32-fixes5
Changeset: r73505:f2ddd548054d
Date: 2014-09-12 17:45 +0300
http://bitbucket.org/pypy/pypy/changeset/f2ddd548054d/
Log: check more carefully for empty unions
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -525,7 +525,7 @@
# a union with length 0
lines[0] = cdecl(type, name, self.is_thread_local())
else:
- if name != self.name:
+ if name != self.name:
lines[0] = '{ ' + lines[0] # extra braces around the 'a' part
lines[-1] += ' }' # of the union
lines[0] = '%s = %s' % (
@@ -567,12 +567,6 @@
def initializationexpr(self, decoration=''):
T = self.getTYPE()
is_empty = True
- type, name = self.get_declaration()
- if name != self.name and self.getvarlength() < 1:
- # an empty union
- yield ''
- return
- yield '{'
defnode = self.db.gettypedefnode(T)
data = []
@@ -601,7 +595,13 @@
padding_drop = T._hints['get_padding_drop'](d)
else:
padding_drop = []
+ type, name = self.get_declaration()
+ if name != self.name and self.getvarlength() < 1 and len(data) < 1:
+ # an empty union
+ yield ''
+ return
+ yield '{'
for name, value in data:
if name in padding_drop:
continue
More information about the pypy-commit
mailing list