Commit bb13f3b7 authored by Lisandro Dalcin's avatar Lisandro Dalcin

fix support for packed structs with SunPro compiler

parent 1879e2ed
...@@ -748,8 +748,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -748,8 +748,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.sue_header_footer(type, kind, type.cname) self.sue_header_footer(type, kind, type.cname)
code.putln("") code.putln("")
if packed: if packed:
code.putln("#if !defined(__GNUC__)") code.putln("#if defined(__SUNPRO_C)")
code.putln("#pragma pack(push, 1)") code.putln(" #pragma pack(1)")
code.putln("#elif !defined(__GNUC__)")
code.putln(" #pragma pack(push, 1)")
code.putln("#endif") code.putln("#endif")
code.putln(header) code.putln(header)
var_entries = scope.var_entries var_entries = scope.var_entries
...@@ -763,8 +765,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -763,8 +765,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
attr.type.declaration_code(attr.cname)) attr.type.declaration_code(attr.cname))
code.putln(footer) code.putln(footer)
if packed: if packed:
code.putln("#if !defined(__GNUC__)") code.putln("#if defined(__SUNPRO_C)")
code.putln("#pragma pack(pop)") code.putln(" #pragma pack()")
code.putln("#elif !defined(__GNUC__)")
code.putln(" #pragma pack(pop)")
code.putln("#endif") code.putln("#endif")
def generate_enum_definition(self, entry, code): def generate_enum_definition(self, entry, code):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment