diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs index 877fdd72..934ff19c 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs @@ -483,10 +483,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { callConv = "ThisCall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@"using System; @@ -533,13 +535,13 @@ public int GetType(int objA, int objB) public partial struct Vtbl {{ - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "new ")}IntPtr GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "2" : "")}; - [NativeTypeName(""int ()"")] + [NativeTypeName(""int (){nativeCallConv}"")] public IntPtr GetType1; - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "new " : "")}IntPtr GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "2")}; }} }} diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs index a4d02349..054d12b5 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs @@ -483,10 +483,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { callConv = "ThisCall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@"using System; @@ -533,13 +535,13 @@ public int GetType(int objA, int objB) public partial struct Vtbl {{ - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "new ")}IntPtr GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "2" : "")}; - [NativeTypeName(""int ()"")] + [NativeTypeName(""int (){nativeCallConv}"")] public IntPtr GetType1; - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "new " : "")}IntPtr GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "2")}; }} }} diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs index 2dce96ea..e488d504 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/CXXMethodDeclarationTest.cs @@ -422,7 +422,7 @@ public override Task NewKeywordVirtualTest() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -464,10 +464,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -495,13 +497,13 @@ public int GetType(int objA, int objB) public partial struct Vtbl {{ - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "new ")}delegate* unmanaged[{callConv}] GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "2" : "")}; - [NativeTypeName(""int ()"")] + [NativeTypeName(""int (){nativeCallConv}"")] public delegate* unmanaged[{callConv}] GetType1; - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "new " : "")}delegate* unmanaged[{callConv}] GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "2")}; }} }} @@ -773,7 +775,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -833,7 +835,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs index 3c28d3fa..3a4b67cd 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs @@ -500,7 +500,7 @@ struct MyStructB : MyStructA { }; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs index 5362d7a7..ecaebcf5 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/CXXMethodDeclarationTest.cs @@ -422,7 +422,7 @@ public override Task NewKeywordVirtualTest() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -464,10 +464,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -495,13 +497,13 @@ public int GetType(int objA, int objB) public partial struct Vtbl {{ - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int, int)" : "int (int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "new ")}delegate* unmanaged[{callConv}] GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "2" : "")}; - [NativeTypeName(""int ()"")] + [NativeTypeName(""int (){nativeCallConv}"")] public delegate* unmanaged[{callConv}] GetType1; - [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}"")] + [NativeTypeName(""{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "int (int)" : "int (int, int)")}{nativeCallConv}"")] public {(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "new " : "")}delegate* unmanaged[{callConv}] GetType{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : "2")}; }} }} @@ -773,7 +775,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; @@ -833,7 +835,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs index 2538ded1..6584c70c 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs @@ -500,7 +500,7 @@ struct MyStructB : MyStructA { }; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"using System.Runtime.CompilerServices; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs index 58cd31b6..dd1fec06 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/CXXMethodDeclarationTest.cs @@ -566,10 +566,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { callConv = "ThisCall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@" @@ -644,13 +646,13 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() - IntPtr + IntPtr - IntPtr + IntPtr - IntPtr + IntPtr diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs index 1e3385b5..3700e014 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/CXXMethodDeclarationTest.cs @@ -566,10 +566,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { callConv = "ThisCall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@" @@ -644,13 +646,13 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() - IntPtr + IntPtr - IntPtr + IntPtr - IntPtr + IntPtr diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs index 18f8a882..d16726cc 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/CXXMethodDeclarationTest.cs @@ -475,7 +475,7 @@ public override Task NewKeywordVirtualTest() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" @@ -530,10 +530,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@" @@ -572,13 +574,13 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() - delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", int" : "")}> + delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", int" : "")}> - delegate* unmanaged[{callConv}]<MyStruct*, int> + delegate* unmanaged[{callConv}]<MyStruct*, int> - delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : ", int")}> + delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : ", int")}> @@ -885,7 +887,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" @@ -948,7 +950,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs index 558e0130..21322de3 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs @@ -582,7 +582,7 @@ struct MyStructB : MyStructA { }; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs index 055a97a8..9bb0d332 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/CXXMethodDeclarationTest.cs @@ -475,7 +475,7 @@ public override Task NewKeywordVirtualTest() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" @@ -530,10 +530,12 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() };"; var callConv = "Cdecl"; + var nativeCallConv = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; + nativeCallConv = " __attribute__((thiscall))"; } var expectedOutputContents = $@" @@ -572,13 +574,13 @@ public override Task NewKeywordVirtualWithExplicitVtblTest() - delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", int" : "")}> + delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ", int" : "")}> - delegate* unmanaged[{callConv}]<MyStruct*, int> + delegate* unmanaged[{callConv}]<MyStruct*, int> - delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : ", int")}> + delegate* unmanaged[{callConv}]<MyStruct*, int, int{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "" : ", int")}> @@ -885,7 +887,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" @@ -948,7 +950,7 @@ virtual char MyInt8Method() if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@" diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs index f19bfe4c..df5e80dd 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs @@ -582,7 +582,7 @@ struct MyStructB : MyStructA { }; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !Environment.Is64BitProcess) { - callConv = "ThisCall"; + callConv = "Thiscall"; } var expectedOutputContents = $@"