diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
index 1dc144e2..90c551d4 100644
--- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
+++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs
@@ -1113,8 +1113,7 @@ private void VisitRecordDecl(RecordDecl recordDecl)
long alignment32 = -1;
long alignment64 = -1;
- GetTypeSize(recordDecl, recordDecl.TypeForDecl, ref alignment32, ref alignment64, out var size32,
- out var size64);
+ GetTypeSize(recordDecl, recordDecl.TypeForDecl, ref alignment32, ref alignment64, out var size32, out var size64);
string nativeNameWithExtras = null, nativeInheritance = null;
if ((cxxRecordDecl != null) && cxxRecordDecl.Bases.Any())
@@ -1151,7 +1150,7 @@ private void VisitRecordDecl(RecordDecl recordDecl)
Alignment64 = alignment64,
Size32 = size32,
Size64 = size64,
- Pack = recordDecl.HasAttrs && recordDecl.Attrs.Any((attr) => attr.Kind == CX_AttrKind.CX_AttrKind_MaxFieldAlignment) && ((alignment != alignment32) || (alignment != alignment64)) ? alignment : 0,
+ Pack = alignment < maxAlignm ? alignment : 0,
MaxFieldAlignment = maxAlignm,
Kind = layoutKind
},
@@ -2183,8 +2182,7 @@ void VisitConstantArrayFieldDecl(RecordDecl recordDecl, FieldDecl constantArray)
long alignment32 = -1;
long alignment64 = -1;
- GetTypeSize(constantArray, constantArray.Type, ref alignment32, ref alignment64, out var size32,
- out var size64);
+ GetTypeSize(constantArray, constantArray.Type, ref alignment32, ref alignment64, out var size32, out var size64);
if ((size32 == 0 || size64 == 0) && _testOutputBuilder != null)
{
@@ -2201,7 +2199,7 @@ void VisitConstantArrayFieldDecl(RecordDecl recordDecl, FieldDecl constantArray)
Alignment64 = alignment64,
Size32 = size32,
Size64 = size64,
- Pack = recordDecl.HasAttrs && recordDecl.Attrs.Any((attr) => attr.Kind == CX_AttrKind.CX_AttrKind_MaxFieldAlignment) && ((alignment != alignment32) || (alignment != alignment64)) ? alignment : 0,
+ Pack = alignment < maxAlignm ? alignment : 0,
MaxFieldAlignment = maxAlignm,
Kind = LayoutKind.Sequential
},
@@ -3136,8 +3134,7 @@ private bool IsConstant(Expr initExpr)
long alignment32 = -1;
long alignment64 = -1;
- GetTypeSize(unaryExprOrTypeTraitExpr, argumentType, ref alignment32, ref alignment64, out var size32,
- out var size64);
+ GetTypeSize(unaryExprOrTypeTraitExpr, argumentType, ref alignment32, ref alignment64, out var size32, out var size64);
switch (unaryExprOrTypeTraitExpr.Kind)
{
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs
index db48acab..96bf833d 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs
@@ -1323,12 +1323,19 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"using System.Runtime.InteropServices;
+ var usingStatement = "using System.Runtime.InteropServices;\n\n";
+ var packing = " [StructLayout(LayoutKind.Sequential, Pack = 4)]\n";
-namespace ClangSharp.Test
-{
+ if (!Environment.Is64BitProcess)
+ {
+ usingStatement = string.Empty;
+ packing = string.Empty;
+ }
+
+ var expectedOutputContents = $@"{usingStatement}namespace ClangSharp.Test
+{{
public unsafe partial struct MyStruct1
- {
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1336,11 +1343,10 @@ public unsafe partial struct MyStruct1
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
+ }}
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public unsafe partial struct MyStruct2
- {
+{packing} public unsafe partial struct MyStruct2
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1348,11 +1354,11 @@ public unsafe partial struct MyStruct2
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
-}
+ }}
+}}
";
- return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedCSharpCompatibleUnixBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs
index ffecb72c..d69e6a47 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs
@@ -133,12 +133,13 @@ union MyUnion3
unsigned int o0_b1_1 : 1;
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", Pack = 1" : "";
var expectedOutputContents = $@"using System.Runtime.InteropServices;
namespace ClangSharp.Test
{{
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion1
{{
[FieldOffset(0)]
@@ -287,7 +288,7 @@ public uint o8_b0_1
}}
}}
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion3
{{
[FieldOffset(0)]
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs
index 1db5c2d4..31d4d31f 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/StructDeclarationTest.cs
@@ -1327,12 +1327,19 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"using System.Runtime.InteropServices;
+ var usingStatement = "using System.Runtime.InteropServices;\n\n";
+ var packing = " [StructLayout(LayoutKind.Sequential, Pack = 4)]\n";
-namespace ClangSharp.Test
-{
+ if (!Environment.Is64BitProcess)
+ {
+ usingStatement = string.Empty;
+ packing = string.Empty;
+ }
+
+ var expectedOutputContents = $@"{usingStatement}namespace ClangSharp.Test
+{{
public unsafe partial struct MyStruct1
- {
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1340,11 +1347,10 @@ public unsafe partial struct MyStruct1
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
+ }}
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public unsafe partial struct MyStruct2
- {
+{packing} public unsafe partial struct MyStruct2
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1352,11 +1358,11 @@ public unsafe partial struct MyStruct2
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
-}
+ }}
+}}
";
- return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs
index 05c66377..08164d43 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/UnionDeclarationTest.cs
@@ -134,11 +134,13 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", Pack = 1" : "";
+
var expectedOutputContents = $@"using System.Runtime.InteropServices;
namespace ClangSharp.Test
{{
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion1
{{
[FieldOffset(0)]
@@ -293,7 +295,7 @@ public uint o8_b0_1
}}
}}
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion3
{{
[FieldOffset(0)]
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs
index 961e0630..5954b1c3 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/StructDeclarationTest.cs
@@ -1302,12 +1302,19 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"using System.Runtime.InteropServices;
+ var usingStatement = "using System.Runtime.InteropServices;\n\n";
+ var packing = " [StructLayout(LayoutKind.Sequential, Pack = 4)]\n";
-namespace ClangSharp.Test
-{
+ if (!Environment.Is64BitProcess)
+ {
+ usingStatement = string.Empty;
+ packing = string.Empty;
+ }
+
+ var expectedOutputContents = $@"{usingStatement}namespace ClangSharp.Test
+{{
public unsafe partial struct MyStruct1
- {
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1315,11 +1322,10 @@ public unsafe partial struct MyStruct1
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
+ }}
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public unsafe partial struct MyStruct2
- {
+{packing} public unsafe partial struct MyStruct2
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1327,11 +1333,11 @@ public unsafe partial struct MyStruct2
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
-}
+ }}
+}}
";
- return ValidateGeneratedCSharpLatestUnixBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedCSharpLatestUnixBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs
index 621ddc2e..5bcd49a4 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/UnionDeclarationTest.cs
@@ -134,11 +134,13 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", Pack = 1" : "";
+
var expectedOutputContents = $@"using System.Runtime.InteropServices;
namespace ClangSharp.Test
{{
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion1
{{
[FieldOffset(0)]
@@ -287,7 +289,7 @@ public uint o8_b0_1
}}
}}
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion3
{{
[FieldOffset(0)]
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs
index 65c12e3a..86d526b1 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/StructDeclarationTest.cs
@@ -1306,12 +1306,19 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"using System.Runtime.InteropServices;
+ var usingStatement = "using System.Runtime.InteropServices;\n\n";
+ var packing = " [StructLayout(LayoutKind.Sequential, Pack = 4)]\n";
-namespace ClangSharp.Test
-{
+ if (!Environment.Is64BitProcess)
+ {
+ usingStatement = string.Empty;
+ packing = string.Empty;
+ }
+
+ var expectedOutputContents = $@"{usingStatement}namespace ClangSharp.Test
+{{
public unsafe partial struct MyStruct1
- {
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1319,11 +1326,10 @@ public unsafe partial struct MyStruct1
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
+ }}
- [StructLayout(LayoutKind.Sequential, Pack = 4)]
- public unsafe partial struct MyStruct2
- {
+{packing} public unsafe partial struct MyStruct2
+ {{
[NativeTypeName(""unsigned int"")]
public uint Field1;
@@ -1331,11 +1337,11 @@ public unsafe partial struct MyStruct2
[NativeTypeName(""unsigned int"")]
public uint Field3;
- }
-}
+ }}
+}}
";
- return ValidateGeneratedCSharpLatestWindowsBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedCSharpLatestWindowsBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs
index 48cf3bdd..b4616620 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/UnionDeclarationTest.cs
@@ -134,11 +134,13 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", Pack = 1" : "";
+
var expectedOutputContents = $@"using System.Runtime.InteropServices;
namespace ClangSharp.Test
{{
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion1
{{
[FieldOffset(0)]
@@ -293,7 +295,7 @@ public uint o8_b0_1
}}
}}
- [StructLayout(LayoutKind.Explicit)]
+ [StructLayout(LayoutKind.Explicit{expectedPack})]
public partial struct MyUnion3
{{
[FieldOffset(0)]
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs
index 4f41749c..2d596af5 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/StructDeclarationTest.cs
@@ -1302,7 +1302,9 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"
+ var packing = Environment.Is64BitProcess ? " layout=\"Sequential\" pack=\"4\"" : string.Empty;
+
+ var expectedOutputContents = $@"
@@ -1316,7 +1318,7 @@ struct MyStruct2 {
uint
-
+
uint
@@ -1331,7 +1333,7 @@ struct MyStruct2 {
";
- return ValidateGeneratedXmlCompatibleUnixBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedXmlCompatibleUnixBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs
index fb47477f..4816b4e0 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/UnionDeclarationTest.cs
@@ -128,10 +128,12 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @" pack=""1""" : "";
+
var expectedOutputContents = $@"
-
+
uint
@@ -240,7 +242,7 @@ union MyUnion3
-
+
uint
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs
index ed496341..11c00f12 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/StructDeclarationTest.cs
@@ -1307,7 +1307,9 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"
+ var packing = Environment.Is64BitProcess ? " layout=\"Sequential\" pack=\"4\"" : string.Empty;
+
+ var expectedOutputContents = $@"
@@ -1321,7 +1323,7 @@ struct MyStruct2 {
uint
-
+
uint
@@ -1336,7 +1338,7 @@ struct MyStruct2 {
";
- return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedXmlCompatibleWindowsBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs
index e47022e7..3f7e1e1d 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/UnionDeclarationTest.cs
@@ -128,10 +128,12 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @" pack=""1""" : "";
+
var expectedOutputContents = $@"
-
+
uint
@@ -246,7 +248,7 @@ union MyUnion3
-
+
uint
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs
index 08e8ebf2..7c6e8672 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/StructDeclarationTest.cs
@@ -1285,7 +1285,9 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"
+ var packing = Environment.Is64BitProcess ? " layout=\"Sequential\" pack=\"4\"" : string.Empty;
+
+ var expectedOutputContents = $@"
@@ -1299,7 +1301,7 @@ struct MyStruct2 {
uint
-
+
uint
@@ -1314,7 +1316,7 @@ struct MyStruct2 {
";
- return ValidateGeneratedXmlLatestUnixBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedXmlLatestUnixBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs
index ea0b63a0..dc4fde0b 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/UnionDeclarationTest.cs
@@ -128,10 +128,12 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @" pack=""1""" : "";
+
var expectedOutputContents = $@"
-
+
uint
@@ -240,7 +242,7 @@ union MyUnion3
-
+
uint
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs
index 60830606..a3bc1385 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/StructDeclarationTest.cs
@@ -1291,7 +1291,9 @@ struct MyStruct2 {
};
";
- const string ExpectedOutputContents = @"
+ var packing = Environment.Is64BitProcess ? " layout=\"Sequential\" pack=\"4\"" : string.Empty;
+
+ var expectedOutputContents = $@"
@@ -1305,7 +1307,7 @@ struct MyStruct2 {
uint
-
+
uint
@@ -1320,7 +1322,7 @@ struct MyStruct2 {
";
- return ValidateGeneratedXmlLatestWindowsBindingsAsync(InputContents, ExpectedOutputContents);
+ return ValidateGeneratedXmlLatestWindowsBindingsAsync(InputContents, expectedOutputContents);
}
public override Task PointerToSelfTest()
diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs
index 993e9aa3..068bd366 100644
--- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs
+++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/UnionDeclarationTest.cs
@@ -128,10 +128,12 @@ union MyUnion3
};
";
+ var expectedPack = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @" pack=""1""" : "";
+
var expectedOutputContents = $@"
-
+
uint
@@ -246,7 +248,7 @@ union MyUnion3
-
+
uint