From bb13f3b7684719cb3ed353c04b321929fbe9dbb4 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Fri, 20 Aug 2010 12:53:48 -0300 Subject: [PATCH] fix support for packed structs with SunPro compiler --- Cython/Compiler/ModuleNode.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index f143a62e..9eb18e77 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -748,8 +748,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): self.sue_header_footer(type, kind, type.cname) code.putln("") if packed: - code.putln("#if !defined(__GNUC__)") - code.putln("#pragma pack(push, 1)") + code.putln("#if defined(__SUNPRO_C)") + code.putln(" #pragma pack(1)") + code.putln("#elif !defined(__GNUC__)") + code.putln(" #pragma pack(push, 1)") code.putln("#endif") code.putln(header) var_entries = scope.var_entries @@ -763,8 +765,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): attr.type.declaration_code(attr.cname)) code.putln(footer) if packed: - code.putln("#if !defined(__GNUC__)") - code.putln("#pragma pack(pop)") + code.putln("#if defined(__SUNPRO_C)") + code.putln(" #pragma pack()") + code.putln("#elif !defined(__GNUC__)") + code.putln(" #pragma pack(pop)") code.putln("#endif") def generate_enum_definition(self, entry, code): -- 2.26.2