fix support for packed structs with SunPro compiler
authorLisandro Dalcin <dalcinl@gmail.com>
Fri, 20 Aug 2010 15:53:48 +0000 (12:53 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Fri, 20 Aug 2010 15:53:48 +0000 (12:53 -0300)
Cython/Compiler/ModuleNode.py

index f143a62e97948bfaabdd4b64c7a7e45b37e91e80..9eb18e77ade5960b088b103c5572bc7f167e2532 100644 (file)
@@ -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):