From: Robert Bradshaw Date: Wed, 26 Nov 2008 01:13:42 +0000 (-0800) Subject: cleanup X-Git-Tag: 0.11-beta~213 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3b7f49fb304e23d6e95de2ac7af6844e138378b4;p=cython.git cleanup --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 4ba1c329..73a57495 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -794,13 +794,13 @@ class CStructOrUnionDefNode(StatNode): self.entry = env.declare_struct_or_union( self.name, self.kind, scope, self.typedef_flag, self.pos, self.cname, visibility = self.visibility) - need_typedef_indirection = False if self.attributes is not None: if self.in_pxd and not env.in_cinclude: self.entry.defined_in_pxd = 1 for attr in self.attributes: attr.analyse_declarations(env, scope) if self.visibility != 'extern': + needs_typedef_indirection = False for attr in scope.var_entries: type = attr.type while type.is_array: @@ -812,13 +812,13 @@ class CStructOrUnionDefNode(StatNode): type = type.base_type if type == self.entry.type: need_typedef_indirection = True - if need_typedef_indirection: - # C can't handle typedef structs that refer to themselves. - struct_entry = self.entry - cname = env.new_const_cname() - self.entry = env.declare_typedef(self.name, struct_entry.type, self.pos, cname = self.cname, visibility='ignore') - struct_entry.type.typedef_flag = False - struct_entry.cname = struct_entry.type.cname = env.new_const_cname() + if need_typedef_indirection: + # C can't handle typedef structs that refer to themselves. + struct_entry = self.entry + cname = env.new_const_cname() + self.entry = env.declare_typedef(self.name, struct_entry.type, self.pos, cname = self.cname, visibility='ignore') + struct_entry.type.typedef_flag = False + struct_entry.cname = struct_entry.type.cname = env.new_const_cname() def analyse_expressions(self, env): pass